tajmone/hugo-book

Hugo Syntax Mishandling PreProcessor Directives

tajmone opened this issue · 0 comments

  • Fix Hugo syntax handling of preprocessor directives.

Currently, the Highlight syntax is set to capture any token starting with # as a preprocessor directive (up to the end of the line).

This interferes with the use of # token used to find out the number of properties, as in:

<object>.#<property>

An example of how this disrupts highlighting can be found in §10.2. Characters:

print capital object.pronoun; " opened "; object.pronoun #3; " box. "

Where from #3; onward the rest of the line is treated as preprocessor directive, and " box. " as a preprocessor string.

This can be fixed by using a dummy keyword group to capture all preprocessor directives by RegEx pattern, and then use OnStateChange() function to enforce them as preprocessor directive. Doing so, it will allow to also define # as an operator.