Moodle

Wrong words (eg. "++") are matched as CamelCase in spite of "Disable CamelCase Linking"

Details

  • Type: Bug Bug
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: 1.8
  • Fix Version/s: None
  • Component/s: Wiki (1.x)
  • Labels:
    None
  • Environment:
    All platform

Description

I've been in the face of two strange phenomenons under using ewiki on Moodle1.8. Under checking "Disable CamelCase Linking" on ewiki (Moodle1.8, 1.7, ...), Camel case words (eg. UsingMoodle, WikiModule...) does not match as Camel case. On the other hand, unexpected words (eg. a+, a][, ...) will match as Camel case.

The cause of these problems is on following code, in mod/wiki/ewiki/ewiki.php

if ($moodle_disable_camel_case) { define("EWIKI_CHARS_L", ""); define("EWIKI_CHARS_U", ""); } else { define("EWIKI_CHARS_L", "a-z_??$\337-\377"); define("EWIKI_CHARS_U", "A-Z0-9\300-\336"); }

Please change this block as follows,

if ($moodle_disable_camel_case) { define("EWIKI_CHARS_L", "\t"); define("EWIKI_CHARS_U", "\r"); } else { define("EWIKI_CHARS_L", "a-z_??$\337-\377"); define("EWIKI_CHARS_U", "A-Z0-9\300-\336"); }

EWIKI_CHARS_L is Tab code, EWIKI_CHARS_U is Carriage return code.
Tab & CR are not so important. But it's dangerous that EWIKI_CHARS_L and EWIKI_CHARS_U are blank.

Please see also http://moodle.org/mod/forum/discuss.php?d=85554 .

Activity

Hide
Tatsuya Shirai added a comment -

Following block is not need. This block affects Wiki contents. Very dangerous.
Please comment out.

mod/wiki/ewiki/ewiki.php?function ewiki_format()?Line 1952,

      • text style triggers
        foreach ($wm_style as $find=>$replace)
        Unknown macro: { $find_len = strlen($find); $loop = 20; while(($loop--) && (($l = strpos($line, $find)) !== false) && ($r = strpos($line, $find, $l + $find_len))) { $line = substr($line, 0, $l) . $replace[0] . substr($line, $l + strlen($find), $r - $l - $find_len) . $replace[1] . substr($line, $r + $find_len); } }

Example) '==' disapears.

Show
Tatsuya Shirai added a comment - Following block is not need. This block affects Wiki contents. Very dangerous. Please comment out. mod/wiki/ewiki/ewiki.php?function ewiki_format()?Line 1952,
      • text style triggers foreach ($wm_style as $find=>$replace)
        Unknown macro: { $find_len = strlen($find); $loop = 20; while(($loop--) && (($l = strpos($line, $find)) !== false) && ($r = strpos($line, $find, $l + $find_len))) { $line = substr($line, 0, $l) . $replace[0] . substr($line, $l + strlen($find), $r - $l - $find_len) . $replace[1] . substr($line, $r + $find_len); } }
Example) '==' disapears.

People

Vote (1)
Watch (2)

Dates

  • Created:
    Updated: