diff options
| author | Philipp A | 2018-11-24 19:19:34 +0100 | 
|---|---|---|
| committer | Philipp A | 2018-11-24 19:20:18 +0100 | 
| commit | 70667b529fcf24815819636b9a105d17ae38e796 (patch) | |
| tree | c2b75bf983f0a5ce64fc128cd2f5c029fca0cfeb | |
| parent | 45dd5c8807b6ed1aff41692b69750b43603e4fd1 (diff) | |
| download | rust-rst-70667b529fcf24815819636b9a105d17ae38e796.tar.bz2 | |
Implemented substitution_def
| -rw-r--r-- | src/rst.pest | 11 | 
1 files changed, 6 insertions, 5 deletions
| diff --git a/src/rst.pest b/src/rst.pest index e09cfa0..562eac6 100644 --- a/src/rst.pest +++ b/src/rst.pest @@ -14,7 +14,7 @@ block    = _{ PEEK[..] ~ hanging_block }  // This is d  hanging_block = _{      substitution_def -    | image +    | image_directive      | admonition      | admonition_gen      | target @@ -38,9 +38,9 @@ hanging_block = _{  // | plain  } -substitution_def  =  { ".." ~ PUSH(" "+) ~ "|" ~ substitution_name ~ "|" ~ " "+ ~ line ~ inline_directive ~ DROP } +substitution_def  =  { ".." ~ PUSH(" "+) ~ "|" ~ substitution_name ~ "|" ~ " "+ ~ inline_dirblock ~ DROP }  substitution_name =  { !" " ~ (!(" "|"|") ~ ANY)+ ~ (" "+ ~ (!(" "|"|") ~ ANY)+)* } -inline_directive  =  { PEEK[..-1] ~ PUSH("  " ~ POP) ~ hanging_block ~ block* } // TODO +inline_dirblock   = _{ image }  // TODO: | replace  // Directives: http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#directives  // .. name:: arguments ~ :options: ~ blank_line+ ~ content @@ -50,13 +50,14 @@ common_option = { "class" | "name" }  // Image. A block type -image           =  { ".." ~ PUSH(" "+) ~ ^"image::" ~ line ~ blank_line+ ~ image_opt_block? ~ DROP } +image_directive = _{ ".." ~ PUSH(" "+) ~ image ~ DROP } +image           =  { ^"image::" ~ line ~ image_opt_block? }  image_opt_block = _{ PEEK[..-1] ~ PUSH("  " ~ POP) ~ ":" ~ image_option ~ ":" ~ line } //TODO: merge with other directives?  image_option    =  { common_option | "alt" | "height" | "width" | "scale" | "align" | "target" }  // Admonition. A block type. The generic one has a title -admonition         =  { ".." ~ PUSH(" "+) ~ ^"admonition::"          ~               line  ~ blank_line* ~ admonition_content? ~ DROP } +admonition         =  { ".." ~ PUSH(" "+) ~ ^"admonition::"         ~               line  ~ blank_line* ~ admonition_content? ~ DROP }  admonition_gen     =  { ".." ~ PUSH(" "+) ~  admonition_type ~ "::" ~ (blank_line | line) ~ blank_line* ~ admonition_content? ~ DROP }  admonition_type    =  { ^"attention" | ^"caution" | ^"danger" | ^"error" | ^"hint" | ^"important" | ^"note" | ^"tip" | ^"warning" }  admonition_content = _{ PEEK[..-1] ~ PUSH("  " ~ POP) ~ hanging_block ~ block* } //TODO: merge with other directives? | 
