dokuwiki-plugin-data icon indicating copy to clipboard operation
dokuwiki-plugin-data copied to clipboard

Bug: "#" is always interpreted as comment prefix, even when it should be an HTML hash

Open hh-lohmann opened this issue 11 years ago • 4 comments

For URLs (wiki internal as well as http(s)) a "#" meant as an HTML hash (pointing to a section) is interpreted as "#" introducing a field comment and cutting the field content at that point (obviously meant as splitting content and comment) - this has very strong impact on fields of type "_wiki" where "... [[...#...]] ..." is used: anything up from the "#" is lost.

hh-lohmann avatar Feb 06 '14 13:02 hh-lohmann

The plugin:data wiki page helps solving this issue: https://www.dokuwiki.org/plugin:data#data_entry_input

Quote: "You may use the # character to add comments to the block. Those will be ignored and will neither be displayed nor saved. If you need to enter # as data, escape it with a backslash (#). If you need a backslash, escape it as well ()."

Klap-in avatar Mar 21 '14 11:03 Klap-in

Sorry, escaping hash signs in URIs means spoiling the URIs, as far as I can see it - maybe you didn't get the point here, if I'll find time I'll see in a fork how simple it should be to identify hash signs - as opposed to lattices as arbitrary literal signs for which your answer is appropriate.

hh-lohmann avatar Mar 22 '14 09:03 hh-lohmann

Your point about the hash in the url I can understand.

  • An idea is to ignore # without escaping when it is in urls that is in words starting with http(s)://...
  • Or maybe to say that # needs to be prefixed with a space... (no idea how good backward compatibility is)

Please be aware that a hash should be available to comment out a whole entry line. Example implementations welcome!

Klap-in avatar Mar 22 '14 13:03 Klap-in

A regexp is welcome... Matching an url is not possible in the lookbehind, because in lookbehinds are only patterns of fixed length allowed. So I guess it needs a different approach.

Klap-in avatar Dec 10 '14 00:12 Klap-in