feat: add async/await keywords, Num/String extensions, and Jinja markdown example
Add `async` and `await` token support to the Wren compiler with scheduler resolution logic, extend `Num` with `e` constant, hyperbolic trig, base conversion, and new methods (`isZero`, `gcd`, `lcm`, `digits`, etc.), extend `String` with `lower`, `upper`, `capitalize`, `title`, and regenerate `wren_core.wren.inc`. Include `Makefile` for multi-platform builds, rewrite `README.md` with updated build instructions, and add `example/await_demo.wren` and `example/jinja_markdown.wren` demonstrating new features.
This commit is contained in:
Vendored
+21
@@ -0,0 +1,21 @@
|
||||
// retoor <retoor@molodetz.nl>
|
||||
|
||||
import "jinja" for Environment, DictLoader
|
||||
|
||||
var env = Environment.new(DictLoader.new({
|
||||
"md_heading": "{\% markdowntohtml \%}# Hello{\% endmarkdowntohtml \%}",
|
||||
"md_bold": "{\% markdowntohtml \%}**bold**{\% endmarkdowntohtml \%}",
|
||||
"md_var": "{\% markdowntohtml \%}# {{ title }}{\% endmarkdowntohtml \%}",
|
||||
"html_to_md": "{\% markdownfromhtml \%}<h1>Hello</h1>{\% endmarkdownfromhtml \%}",
|
||||
"html_to_md_bold": "{\% markdownfromhtml \%}<p><strong>bold</strong></p>{\% endmarkdownfromhtml \%}",
|
||||
"filter_md": "{{ text|markdown }}",
|
||||
"filter_fromhtml": "{{ html|markdownfromhtml }}"
|
||||
}))
|
||||
|
||||
System.print(env.getTemplate("md_heading").render({})) // expect: <h1>Hello</h1>
|
||||
System.print(env.getTemplate("md_bold").render({})) // expect: <p><strong>bold</strong></p>
|
||||
System.print(env.getTemplate("md_var").render({"title": "World"})) // expect: <h1>World</h1>
|
||||
System.print(env.getTemplate("html_to_md").render({})) // expect: # Hello
|
||||
System.print(env.getTemplate("html_to_md_bold").render({})) // expect: **bold**
|
||||
System.print(env.getTemplate("filter_md").render({"text": "**strong**"})) // expect: <p><strong>strong</strong></p>
|
||||
System.print(env.getTemplate("filter_fromhtml").render({"html": "<h1>Title</h1>"})) // expect: # Title
|
||||
Reference in New Issue
Block a user