diff --git a/Makefile b/Makefile index 1093888..62cdf94 100644 --- a/Makefile +++ b/Makefile @@ -53,7 +53,8 @@ dist: examples: PYTHONPATH = . examples: PYTHONPATH=. - sed --regexp-extended 's/(\.\. )envvar(::)/\1note\2/;' examples/fold-markers-debops.yml examples/main.yml | bin/yaml2rst - examples/main.rst --strip-regex '\s*(:?\[{3}|\]{3})\d?$$' + sed --regexp-extended 's/(\.\. )envvar(::)/\1note\2/;' examples/fold-markers-debops.yml examples/main.yml \ + | bin/yaml2rst - examples/main.rst --strip-regex '\s*(:?\[{3}|\]{3})\d?$$' --yaml-strip-regex '^\s{65,66}#\s\]{3}\d?$$' ## --no-generator does not do the trick on Debian Jessie. rst2html --stylesheet=examples/demo.css examples/main.rst | grep --invert-match --fixed-strings ' examples/main.html rst2html --stylesheet=examples/demo.css tests/patternsTest.rst > tests/patternsTest.html diff --git a/bin/yaml2rst b/bin/yaml2rst index 16344fb..0a14af0 100755 --- a/bin/yaml2rst +++ b/bin/yaml2rst @@ -32,7 +32,7 @@ import argparse import sys -def main(infilename, outfilename, strip_regex): +def main(infilename, outfilename, strip_regex, yaml_strip_regex): if infilename == '-': infh = sys.stdin else: @@ -41,7 +41,7 @@ def main(infilename, outfilename, strip_regex): outfh = sys.stdout else: outfh = open(outfilename, "w") - for l in yaml2rst.convert(infh.readlines(), strip_regex): + for l in yaml2rst.convert(infh.readlines(), strip_regex, yaml_strip_regex): print(l.rstrip(), file=outfh) @@ -55,5 +55,8 @@ parser.add_argument('--strip-regex', metavar='regex', " Can be used to remove fold markers from headings for example." " Example to strip out [[[,]]] fold markers: '\s*(:?\[{3}|\]{3})\d?$'." " Check the README for more details.") +parser.add_argument('--yaml-strip-regex', metavar='regex', + help="Same usage as --strip-regex except that this regex substitution" + "is preformed on the YAMl part of the file as opposed RST part.") args = parser.parse_args() main(**vars(args)) diff --git a/examples/main.html b/examples/main.html index 08fbea1..3000800 100644 --- a/examples/main.html +++ b/examples/main.html @@ -74,8 +74,6 @@
Some text describing this boolean.
example__enabled: True - - # ]]]
Note
@@ -84,8 +82,6 @@List of additional APT packages which will be installed by the role.
example__packages: [] - # ]]] - # ]]]
Some text describing this list.
example__periodic: [] - # ]]] - # ]]] - # ]]]