<-- back to the mailing list
May user-friendly link names be empty?
Sean Conner sean at conman.org
Tue Nov 9 21:29:03 GMT 2021
It was thus said that the Great codesoap at mailbox.org once stated:
thanks for your response! Unfortunately your answer still leaves me
uncertain. Here you say, that trailing whitespace is illegal, if there
is no link name:
The user friendly link name is optional, however if it is present
then the whitespace after the url is mandatory as well. In other words,
the URL is mandatory, and you either have no link name and no space
after the URL or a link name and mandatory space(s) after the URL.
The regular expression you suggest here, however, allows trailing
whitespace, even if there is no link name:
[ \t]*([^ \t]+)(?:$|[ \t]+([^ \t].*)$)
[ \t]*([^ \t]+)(?:$|[ \t]+([^ \t]?.*?)$)
I believe the latter (option b) would be correct. I would remove the
final "[^ \t]?" and simplify it down to this:
[ \t]*([^ \t]+)(?:$|[ \t]+(.*)$)
Do you have a link to an authoritative source upon which your knowledge
on the matter is based? I wrote my initial mail on the topic, because
I'm looking for an authoritative answer rather than an opinion.
The two sources I know of are the one you already quoted (section 5.4.2 ofgemini://gemini.circumlunar.space/docs/specification.gmi) and a proposed BNFfor the revised specification(https://gitlab.com/gemini-specification/gemini-text/-/issues/7).
Both leave the impression that (where spaces are replaced by '_'):
would not be allowed, but as with the real world, you may have to be a bitlenient with the input (especially if it's user generated). Also note thatas of now, the official spec allows both spaces (0x20) and tabs (0x09) to be"whitespace", whereas the BNF only allowd spaces (0x20).