Repository navigation
Releases
Releases · StafLoker/libtexpr
v0.2.0
libtexpr v0.2.0
Changelog
Added
- Optional blocks
{text [FIELD]}: removed whole when a placeholder inside is empty, kept without the braces otherwise Engine.render_blocks(only the blocks),Engine.render_placeholders(only the[...]) andEngine.render_text(both, blocks first)BlockwithPATTERNandcheck, which returnsBlockIssue(kind, text)with aBlockIssueKind:UNCLOSED,UNOPENED,EMPTY,NESTED
Install
Latest
uv add libtexprVersioned
uv add libtexpr==0.2.0What's Changed
- Release v0.2.0 by @StafLoker in #1
New Contributors
- @StafLoker made their first contribution in #1
Full Changelog: v0.1.0...v0.2.0
v0.1.0
libtexpr v0.1.0
Changelog
Added
- Parser for placeholders such as
[ДОЛГ.СУММА * 2 | деньги: кратко]: fields, numbers, words, names in Latin or Cyrillic, arithmetic with parentheses and unary minus, and a pipeline of functions with arguments Enginewithregister,validate,evaluateandrender_text, which leaves a placeholder that fails exactly as writtenFunctionandParam: a function declares its name, code, input and output types, and arguments with allowed values and defaults- Typed values between functions:
TEXTisstr,NUMBERisDecimal,DATEisdatetime.date;evaluateconverts to the input type of each function and always returns text - Exact arithmetic with
Decimal; numbers in data may use a comma as the decimal separator and spaces as thousands separators, and dates areYYYY-MM-DD validatereturns every problem found:UNKNOWN_FIELD,UNKNOWN_FUNCTION,TYPE_MISMATCHandBAD_ARGUMENT- Errors rooted in
TexprError:ParseErrorsubclasses carry the position of the error, an exception or a wrongly typed result from a function becomesFunctionError - Limits of 500 characters and 20 nesting levels, exposed as
Placeholder.MAX_LENGTHandPlaceholder.MAX_NESTINGand reported asLimitExceededError Placeholder.parseandPlaceholder.extractto read a placeholder and to find the placeholders in a text- No runtime dependencies; Python 3.12 or newer
Install
Latest
uv add libtexprVersioned
uv add libtexpr==0.1.0Full Changelog: https://github.com/StafLoker/libtexpr/commits/v0.1.0