Inline image & aliases (and index corrected accordingly)

This commit is contained in:
Maximilien Rigaut 2022-06-16 02:26:13 +02:00
parent 237a417396
commit c2a44f40c5
No known key found for this signature in database
GPG Key ID: 4F14B23709ADA5B1
2 changed files with 5 additions and 6 deletions

View File

@ -13,9 +13,9 @@ header>>{{blog-header py-3}}
bootstraparse is a tool that allows you to bootstrap your own project.
In a very small number of steps, you can create a new project with the
following features:
- Imports, with the <code>: :< filename > </code>syntax you can import another file and have it's contents dumped into your file.
- Imports, with the <code> ::&lt; filename > </code>syntax you can import another file and have it's contents dumped into your file.
- Markup, a subset of markdown is already supported and the rest is incomming !
- Aliases : With the <code> @[alias_name] </code> syntax you can create an alias for a string of text, with replacement capabilities.
- Aliases : With the <code> @&#91;alias_name&#93; </code> syntax you can create an alias for a string of text, with replacement capabilities.
- Images: With the <code> @&#123;imagename&#125; </code> syntax you can specify an image template to import, with replacement capabilities.
And much much more !

View File

@ -557,10 +557,9 @@ alias = alias_element + pp.Opt(optional)
# Syntax elements
line_to_replace = pp.OneOrMore(
pp.SkipTo(image ^ alias)('text').add_parse_action(of_type(TextToken))
^ image.add_parse_action(of_type(ImageToken))
^ alias.add_parse_action(of_type(AliasToken))
) ^ pp.rest_of_line('text').add_parse_action(of_type(TextToken))
pp.SkipTo(image)('text').add_parse_action(of_type(TextToken)) + image.add_parse_action(of_type(ImageToken)) |
pp.SkipTo(alias)('text').add_parse_action(of_type(TextToken)) + alias.add_parse_action(of_type(AliasToken))
) | pp.rest_of_line('text').add_parse_action(of_type(TextToken))
##############################################################################