Skip to content

Commit

Permalink
(feat) remove line breaks for invisible element [#258]
Browse files Browse the repository at this point in the history
  • Loading branch information
sunng87 committed Dec 25, 2020
1 parent 7e4a994 commit b3f6c38
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions src/grammar.pest
Original file line number Diff line number Diff line change
Expand Up @@ -56,36 +56,36 @@ pro_whitespace_omitter? ~ "}}" }
partial_expression = { "{{" ~ pre_whitespace_omitter? ~ ">" ~ partial_exp_line
~ pro_whitespace_omitter? ~ "}}" }
invert_tag_item = { "else"|"^" }
invert_tag = { !escape ~ "{{" ~ pre_whitespace_omitter? ~ invert_tag_item
~ pro_whitespace_omitter? ~ "}}"}
helper_block_start = { "{{" ~ pre_whitespace_omitter? ~ "#" ~ exp_line ~
pro_whitespace_omitter? ~ "}}" }
helper_block_end = { "{{" ~ pre_whitespace_omitter? ~ "/" ~ identifier ~
pro_whitespace_omitter? ~ "}}" }
invert_tag = { !escape ~ PUSH(LINE_SEPARATOR?) ~ "{{" ~ pre_whitespace_omitter? ~ invert_tag_item
~ pro_whitespace_omitter? ~ "}}" ~ POP }
helper_block_start = { PUSH(LINE_SEPARATOR?) ~ "{{" ~ pre_whitespace_omitter? ~ "#" ~ exp_line ~
pro_whitespace_omitter? ~ "}}" ~ POP }
helper_block_end = { PUSH(LINE_SEPARATOR?) ~ "{{" ~ pre_whitespace_omitter? ~ "/" ~ identifier ~
pro_whitespace_omitter? ~ "}}" ~ POP }
helper_block = _{ helper_block_start ~ template ~
(invert_tag ~ template)? ~ helper_block_end }

decorator_block_start = { "{{" ~ pre_whitespace_omitter? ~ "#" ~ "*"
~ exp_line ~ pro_whitespace_omitter? ~ "}}" }
decorator_block_end = { "{{" ~ pre_whitespace_omitter? ~ "/" ~ identifier ~
pro_whitespace_omitter? ~ "}}" }
decorator_block_start = { PUSH(LINE_SEPARATOR?) ~ "{{" ~ pre_whitespace_omitter? ~ "#" ~ "*"
~ exp_line ~ pro_whitespace_omitter? ~ "}}" ~ POP }
decorator_block_end = { PUSH(LINE_SEPARATOR?) ~ "{{" ~ pre_whitespace_omitter? ~ "/" ~ identifier ~
pro_whitespace_omitter? ~ "}}" ~ POP }
decorator_block = _{ decorator_block_start ~ template ~
decorator_block_end }

partial_block_start = { "{{" ~ pre_whitespace_omitter? ~ "#" ~ ">"
~ partial_exp_line ~ pro_whitespace_omitter? ~ "}}" }
partial_block_end = { "{{" ~ pre_whitespace_omitter? ~ "/" ~ partial_identifier ~
pro_whitespace_omitter? ~ "}}" }
partial_block_start = { PUSH(LINE_SEPARATOR?) ~ "{{" ~ pre_whitespace_omitter? ~ "#" ~ ">"
~ partial_exp_line ~ pro_whitespace_omitter? ~ "}}" ~ POP }
partial_block_end = { PUSH(LINE_SEPARATOR?) ~ "{{" ~ pre_whitespace_omitter? ~ "/" ~ partial_identifier ~
pro_whitespace_omitter? ~ "}}" ~ POP }
partial_block = _{ partial_block_start ~ template ~ partial_block_end }

raw_block_start = { "{{{{" ~ pre_whitespace_omitter? ~ exp_line ~
pro_whitespace_omitter? ~ "}}}}" }
raw_block_end = { "{{{{" ~ pre_whitespace_omitter? ~ "/" ~ identifier ~
pro_whitespace_omitter? ~ "}}}}" }
raw_block_start = { PUSH(LINE_SEPARATOR?) ~ "{{{{" ~ pre_whitespace_omitter? ~ exp_line ~
pro_whitespace_omitter? ~ "}}}}" ~ POP }
raw_block_end = { PUSH(LINE_SEPARATOR?) ~ "{{{{" ~ pre_whitespace_omitter? ~ "/" ~ identifier ~
pro_whitespace_omitter? ~ "}}}}" ~ POP }
raw_block = _{ raw_block_start ~ raw_block_text ~ raw_block_end }

hbs_comment = { "{{!--" ~ (!"--}}" ~ ANY)* ~ "--}}" }
hbs_comment_compact = { "{{!" ~ (!"}}" ~ ANY)* ~ "}}" }
hbs_comment = { PUSH(LINE_SEPARATOR?) ~ "{{!--" ~ (!"--}}" ~ ANY)* ~ "--}}" ~ POP }
hbs_comment_compact = { PUSH(LINE_SEPARATOR?) ~ "{{!" ~ (!"}}" ~ ANY)* ~ "}}" ~ POP }

template = { (
raw_text |
Expand Down

0 comments on commit b3f6c38

Please sign in to comment.