zioth / dokuwiki-autolink4

Dokuwiki plugin which automatically turns specified keywords into links to other wiki pages, similar to the default functionality of MediaWiki.
MIT License
0 stars 2 forks source link

Special character at end of search string #8

Open shenzo1 opened 3 years ago

shenzo1 commented 3 years ago

I have encountered what seems to be a parsing issue with a special character at the end of a search string. Example: [Dd]okū is not autolinked correctly, whereas if I do [Dd]okūs or [Dd]okū word, it does. But Dokū and dokū both work correctly, so that is what I do now instead. Would you have any idea on what is going on?

zioth commented 3 years ago

Sorry for the long delay. This is probably issue #2 , which is a bug in DokuWiki itself. There's a work-around in that issue.

shenzo1 commented 3 years ago

Thanks for your reply. I have tried that already and still having an issue. To clarify: when I make a rule for [Dd]okū, it does not recognize either dokū or Dokū. When I make a rule for dokū and Dokū separately, it works. Any other idea?

zioth commented 3 years ago

When there aren't any regular expression characters (like "["), the code takes a much simpler and faster path to detect automatic links. There are some oddities with the Doku regular expression parser. This might need another Doku hack similar to the one in issue #2.

I'll keep this issue open, but I'm not sure when I'll have a chance to look into it.

vaniwiki commented 5 months ago

I was going to report on this, but found this older issue first... Will look at that workaround now.

This plugin is really amazing, all your plugins are, and you helped me with a custom solution in the past (purplenumbers and autolink plugins combined) so thanks again for that! Just wanted to say that. :)

Edit: enabling the "inword" option indeed worked for me! Now I'm only looking at decreasing duplicate entries with regex. But I noticed that regex returns all unique instances, not only once even if specified. That means Battlef?i?e?l?d? of Kuruksetra now matches both "Battle of Kuruksetra" and "Battlefield of Kuruksetra", and marks up both as links, not only the first one. Maybe I just don't realise how this works, I'm still learning...

zioth commented 5 months ago

That's a good point. The "once" flag works with specific text, not regular expressions. I've submitted issue #21 for this, and fixed it.

And thank you! I'm glad you like the plugins!

vaniwiki commented 4 months ago

I found this on your plugin's page:

Screenshot 2024-05-17 at 18 28 19

I applied the patch, and now I don't need the inword flag. I think that is better suited to Chinese and such anyways.