Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Templating engine #28

Draft
wants to merge 91 commits into
base: main
Choose a base branch
from
Draft

Templating engine #28

wants to merge 91 commits into from

Conversation

lofcz
Copy link
Member

@lofcz lofcz commented Apr 19, 2022

This PR is here to track the progress on templating engine.
Spec: https://github.com/WattleScript/wattlescript/wiki/razor_like_templating_proposal

Escaping

  • @@ escape

Implicit transitions

  • calls
  • access/indexing
  • if
  • else if
  • elseif
  • else
  • for
  • while
  • do..while
  • custom directives
  • top level annotations? no viable syntax found, declare in a block @{}
  • require
  • function
  • class
  • mixin
  • enum

Explicit transitions

  • @()

Blocks

  • @{}
  • line transition @:
  • preprocessor transition @#
  • html transition
  • <text> transition

Comments

  • @* *@

Html encoding

  • raw
  • encode

Tests / parser functionality

  • assert no input can hardlock the parser (infinite loop) added loop detector, we crash if something goes off
  • report incorrect closing tags <div></divv> hard to do reliably. We crash where we can't recover instead.
  • let parser enter recovery mode after an error
  • cover more cases with HTML comments
  • handle implicit closing of tags in terse mode <p>, <tr>, <td>... W3 spec
  • parse attributes with understanding of content, report errors in attributes
  • support <!div> notation to force plain element over taghelper
  • report errors on implicit transitions via banned keywords else, elseif, else if
  • sometimes BLOCK with empty content is emmited, discard
  • add real world test cases
  • test foreign html elements (svg, mathex..)
  • make the tests pass on unix
  • emit #line in debug mode
  • self contained export

@lofcz lofcz marked this pull request as draft April 19, 2022 21:56
@lofcz lofcz changed the title DRAFT: templating engine Templating engine Apr 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants