UDL Similar Delimiters
-
In the UDL configurator, I’m trying to set up delimiters for
[[ ]]
and[[ ]]:
The first one indicates a “section link” in my syntax, and the second one is called a “section”. So I need both in this syntax.The problem is that no matter which delimiter slot I use, they never seem work together. The first one always takes precedence (and of course, I can’t use the second one by itself or it will look for the first [[ and the last ]]: colouring everything in between.
How do I have both?
https://stackoverflow.com/questions/65010534/how-to-have-two-similar-delimiters
-
I’ve also tried this delimiter:
Open: [
Close: ]:((EOL))but that doesnt’ detect the EOL at all. I have to leave out the ]: for it to work and it colours ehte entire document after the ] despite the EOL there.
I think the UDL is completely ignoring the :
-
There are, unfortunately, some things that the UDL cannot handle. In theory, you could submit an issue to request an improvement to the UDL. However, there are many open issues on the UDL feature, and none of them gain any traction, so I don’t know that I’d recommend that.
As a workaround, you can add extra highlighting to a builtin lexer or to a User Defined Language (UDL) using regexes via the script
EnhanceAnyLexer.py
that @Ekopalypse shares in his github repo. So with two regexes something like\[\[.*\]\]\:
for the
[[ .... ]]:
version and\[\[.*\]\](?!:)
for the
[[ ... ]]
without the colon (and using\R
inside the regexes if you require newlines at certain points), you might be able to get what you want.If those EnhaceAnyLexer regexes don’t work for you, show us some sample text (use the
</>
button to make sure the forum doesn’t mangle the text; see the preview to make sure); and show us the exact format of the regex you used in the EnhaceAnyLexer script, and we might be able to help you figure out what’s going wrong. -
Sorry, each of those
[
needs a\
prefix – I always forget the forum preview lies for\\[
-
Thank you, PeterJones. I’m not so sure about that python script, though. If I ever wanted to share my UDL, the other user’s couldn’t use my udl.xml without special configuration.
I do wish the UDL could get some updates. UDL is a very attractive feature in np++, but it’s one of it’s weak points in that it is a bit lacking in the power to handle many situations. I always end up having to “settle for less” with the colouring I really want.
-
Sorry. I cannot force the developers to update UDL. There are plenty of issues requesting updates – and you can feel free to add more – but there seems to be a lack of interest in working on that component. (My thought has been for years now that the developer has an idea that he’ll write a new/better UDL system “some day”, but that he keeps getting distracted with general maintenance and other, easier-to-implement features.)
In theory, someone who had the skills could write a custom plugin-based lexer, similar to the GEDCOM Lexer available in Plugins Admin, which could handle your specific needs. Or, even better, someone could write a plugin-based lexer to basically replace the UDL system, but with more powerful syntax (full regex and full unicode support in every field).
I don’t have enough of the right skills, or the time, to devote to something that major, unfortunately.