Index: trunk/extensions/Gadgets/Gadgets.php |
— | — | @@ -53,6 +53,8 @@ |
54 | 54 | } |
55 | 55 | |
56 | 56 | function wfLoadGadgetsStructured() { |
| 57 | + global $wgContLang, $wgCapitalLinks; |
| 58 | + |
57 | 59 | static $gadgets = NULL; |
58 | 60 | |
59 | 61 | if ( $gadgets !== NULL ) return $gadgets; |
— | — | @@ -74,8 +76,13 @@ |
75 | 77 | if ( preg_match( '/^==+ *([^*:\s|]+?)\s*==+\s*$/', $line, $m ) ) { |
76 | 78 | $section = $m[1]; |
77 | 79 | } |
78 | | - else if ( preg_match( '/^\*+ *(\w[-\w\d]*)((\|[^|]*)+)\s*$/', $line, $m ) ) { |
79 | | - $name = $m[1]; |
| 80 | + else if ( preg_match( '/^\*+ *([a-zA-Z](?:[-_:.\w\d ]*[a-zA-Z0-9])?)\s*((\|[^|]*)+)\s*$/', $line, $m ) ) { |
| 81 | + //NOTE: the gadget name is used as part of the name of a form field, |
| 82 | + // and must follow the rules defined in http://www.w3.org/TR/html4/types.html#type-cdata |
| 83 | + // Also, title-normalization applies. |
| 84 | + $name = str_replace(' ', '_', $m[1]); |
| 85 | + if ( $wgCapitalLinks ) $name = $wgContLang->ucfirst( $name ); |
| 86 | + |
80 | 87 | $code = preg_split( '/\s*\|\s*/', $m[2], -1, PREG_SPLIT_NO_EMPTY ); |
81 | 88 | |
82 | 89 | if ( $code ) { |
Index: trunk/extensions/Gadgets/README |
— | — | @@ -40,7 +40,9 @@ |
41 | 41 | and references a system message (MediaWiki:Mygadget in the example) |
42 | 42 | that contains a short descriptiopn of the gadget, using wiki syntax. |
43 | 43 | Note that the internal name must start with a ASCII letter, and must |
44 | | -contain only ASCII letter and numbers. |
| 44 | +contain only ASCII letter and numbers, hyphens ("-"), underscores ("_"), |
| 45 | +colons (":"), and periods (".") (spaces are also allowed but converted to |
| 46 | +underscored ("_"), like for page titles). |
45 | 47 | |
46 | 48 | The remaining fields on the line refer to the JavaScript or CSS code that |
47 | 49 | makes up the gadget, contained in system messages (MediaWiki:Mygadget.js |