Added support for operator.itemgetter
.
Fixed double XML escaping when the renders()
method was called inside
a renderx
tag.
Removed package.json
from package.json
.
Add method timestamp
to UL4 type datetime
.
Add attributes namespace
and fullname
to class Template
.
Fixed handling of indentation in RenderAST._repr()
.
Fixed format()
for integers and booleans.
Fixed version number in package.json
.
Add support for the e
and f
formats for floating point numbers in format()
.
TextAST
objects now store their text directly.
Template source code offsets are now stored as two integer values instead
of as a Slice
objects.
Fixed calling Type.getattr()
and Type.hasattr()
with null
.
Removed the attribute __id__
for all instances of ul4.Proto
, since a Map
can now be used for mapping objects to their backref index in UL4ON dumps.
Added a repr
method to ul4.Module
.
Detect "classes" in repr
so that they don't get output as <function foo>
.
Use Symbol.for()
to reuse symbols defined by another version of UL4.
Added new classes RenderOrPrintAST
, RenderOrPrintXAST
,
RenderXOrPrintAST
, RenderXOrPrintXAST
.
Fixed a bug for item access in objects.
Updated logic for exporting the version number for Webpack compatibility.
Removed all Protocol
classes and their use.
Implement the UL4 method dict.keys()
.
Add color methods withhue()
and withsat()
.
Passing null
to Type.getattr()
or Type.hasattr()
now raises the correct
exception.
Fixed handling of calls to undefined functions or templates. Now a call to an undefined function will be properly terminated with an exception:
TypeError: <undefined> is not callable by UL4
Fixed construction of UL4 stacktraces: Now the stacktrace will only consist of
the initial exception, a LocationError
for the originating AST
and
additional LocationError
for each template call. Previously each AST node
added a stack frame.
UL4 now supports positional-only arguments. Thy following functions use that now:
* `first(iterable, /, default=None)`,
* `last(iterable, /, default=None)`,
* `isfirst(iterable, /)`,
* `islast(iterable, /)`,
* `isfirstlast(iterable, /)`,
* `enumfl(iterable, /)`,
* `monthdelta(months=0, /)`,
* `ul4on.dumps(obj, /, indent)`,
* `ul4on.loads(dump, /, registry=None)`,
type()
now returns type objects instead of a simple string. Type objects can
be used for type testing via the new isinstance()
function. Some type objects
can be called to create new instances of those types.
The following functions are now callable type objects instead: bool
, int
,
float
, str
, date
, datetime
, timedelta
, monthdelta
, list
, set
,
dict
and color
.
The following modules have been added to the builtin UL4 objects:
ul4
contains all UL4 AST classes;ul4on
contains the functionsdumps()
andloads()
and the typesEncoder
andDecoder
;operator
contains the typeattrgetter
andmath
contains the constantse
,pi
andtau
as well as the functionscos()
,sin()
,tan()
,sqrt()
andisclose()
.color
contains the typeColor
and the functionscss
andmix
.
Tag delimiters can now no longer be customized. They are always <?
and ?>
.
The color method abslum()
has been renamed to abslight()
and rellum()
has
been renamed to rellight()
.
The following methods have been added to color.Color
: hue()
, light()
,
sat()
, withhue()
, withsat()
, withlum()
, ablum()
, rellum()
,
invert()
and combine()
.
Always assume that the Javascript types Map
and Set
exist.
Use symbols for implementing UL4 poeation in classes.
Fixed the implementation of various division operations.
Added support for persistent objects to UL4ON.
Undefined operands are now rejected in arithmetic operations (i.e. add, subtract, multiply, true and floor division, and modulo).
Added a function report_exc
that can be used to report an exception
originating from an UL4 template on the browser console.
The Template
methods renders
and call
now have default values for the
parameters and global variables, so they can be called without any global
variables by passing only the parameter object or without parameters and global
variables by passing no arguments.
Implement the "module" ul4on
with the attributes loads
, dumps
, Encoder
and Decoder
. Encoder
and Decoder
can be use to encode/decode an UL4ON
dump in multiple steps.
Update dependencies.
The source code now uses the constant undefined
for type checks instead of
typeof(foo) === "undefined"
.
Added support for global variables in the methods render
, renders
and
call
.
Added dictionary method pop()
.
The function scrypt
can't be implemented in Javascript, so a version that
throws a NotImplementedError
exception has been added.
Protect against renamed classes when the code gets reminified by a minifier that changes classes names (which breaks the UL4ON type names in the UL4ON registry).
Added attributes to UL4 AST nodes: startpos
, startsource
,
startsourceprefix
and startsourcesuffix
. Renamed line
to startline
and
col
to startcol
.
Added attributes to block AST nodes: stoppos
, stopline
, stopcol
,
stopsource
, stopsourceprefix
and stopsourcesuffix
.
Update dependencies.
The UMD version is the default version now (i.e. in package.json/main
).
The UL4 source is a Javascript module now. However the default babeled version
in dist/umd/ul4.js
still uses UMD to support Node and the browser. For the
module version use dist/esm/ul4.js
.
Building is now done with rollup
and the md5 module is bundled directly into
UL4.
Fixed the variable _js_Date
(which should be a local variable).