class Can::Parser

Overview

Strict XML-ish parser for the can template language. Tags must be explicitly closed (or self-closed). Quoted attribute values are literal; expression-form attributes (={...}) evaluate Crystal.

<style> and <script> switch to raw-text mode — content is captured verbatim until the matching close tag, no nested-tag or interpolation parsing. (Trade-off: no {expr} inside CSS for now; revisit later.)

Defined in:

can/parser.cr

Constant Summary

RAW_TEXT_TAGS = {"style", "script"}

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(source : String) #

[View source]

Class Method Detail

def self.parse(source : String) : AST::Template #

[View source]

Instance Method Detail

def parse : AST::Template #

[View source]