dokufreaks / plugin-comment

http://dokuwiki.org/plugin:comment
GNU General Public License v2.0
9 stars 3 forks source link

Comment inside enumeration doesn't work #8

Open ullenboom opened 11 years ago

ullenboom commented 11 years ago
  * [[:Start]]
/* * Community */

->

Community */

so the line plus */ stays. I can fix this by inserting an empty line although its just a fix for a parser imperfection.

  * [[:Start]]

/* * Community */
DomoViridi commented 10 years ago

The current regular expression used to find the comments is broken. It reads:

"^/\*.*?\*|\s+/\*.*?\*/"

This matches either:

Notice that the first case ends the match in *, not in */. This is what happens in your example, where the match ends with the lone * and the Community */ part is left over. When you add an empty line before the comment string, the second case comes into action which (more correctly) matches <whitespace> '/*' <any characters> '*/'

In commit 52986720be61f1387ae8cd4edbba2ddbcbb74ded editor Michael Klier simply describes his change as "fixed regex" and does not explain why he exchanged a simple regex, which by the way also includes a match with comments of the style

// One-line comment

with a more complicated one which only allows a comment which either starts at the beginning of a line or is preceded by whitespace. And which is broken :frowning:

lpaulsen93 commented 6 years ago

This could also be fixed by the change suggested in #12. Please test.