Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#13345 closed defect (fixed)

doc parser breaks if module has "function" in any of the deps

Reported by: dante Owned by: dante
Priority: high Milestone: 1.7
Component: General Version: 1.7.0b1
Keywords: mxpxpod Cc:
Blocked By: Blocking:

Description

The regexp which matches deps and unwraps to AMD format is brittle, and breaks when it encounters the word "function".

$text = preg_replace_callback('/(define\((.*?)function(.*?)\{(.*)\}\);)/s', "_amd_pseudodoc_fix", $text, 1);

will accidentally stop on the first occurance of "function" in the list of deps:

define(["dojo", "dojox/lang/functional"], function(dojo, df){ 

});

becomes

;(function_al

in the unwrapp_fix callback. Need to fix regexp to match only the stuff in []'s.

Change History (4)

comment:1 Changed 8 years ago by dante

(In [25678]) refs #13345 - adding a test showing how this is broken, and attempting to fix

comment:2 Changed 8 years ago by dante

(In [25679]) refs #13345 - whitespace from last ci

comment:3 Changed 8 years ago by dante

Resolution: fixed
Status: newclosed

(In [25688]) fixes #13345 - thanks snover for a quickfix and some regexp foo!

comment:4 Changed 8 years ago by dante

(In [25696]) refs #13345 - better regexp from snover

Note: See TracTickets for help on using tickets.