Skip to content

%%-references pre-processing

When writing documentation, it frequently occurs that I make some mistakes that might be resolved by some (pre)processing of %%-references. Also, it frequently occurs that I have the same text before and after the | separator.

To make it much easier for authors, I suggest we do the following:

  1. Assume we have text as the entire text between %%-markers (so excluding such markers)
  2. if text contains the |-character, then showText is the part before, and refText is the part behind that character.
  3. else, showText = text and refText = text.
  4. make refText all lowercase, and replace every space(s), i.e. /\s+/g-sequences, with a single -`-character.
  5. if the file to which the resulting reftext refers does not exist, it would be nice to have this condition logged (and presented at the end of processing), preferably with the filename, line and columnnumbers of the %%-structure that caused the event.

I have tried to do this (except for point 4) myself, but I keep getting Unhandled promise rejection errors, and also (but less frequently) ReferenceError: useBaseUrl is not defined errors.

Edited by Rieks Joosten