Content deleted Content added
No edit summary |
No edit summary |
||
Line 22:
local prefix_patterns_t = { -- sequence of prefix patterns
'^\127[^\127]*UNIQ%-%-%a+%-%x+%-QINU[^\127]*\127', -- stripmarker
'^([%*;:#]+)', -- various list markup
'^(\'\'\'*)', -- bold / italic markup
Line 35:
local prefixes_t = {}; -- list, bold/italic, and html-like markup, & whitespace saved here
for _, pattern in ipairs (prefix_patterns_t) do -- spin through <prefix_patterns_t>
if s:match (pattern) then -- when there is a match
Line 48 ⟶ 47:
end
local prefix_removed; -- flag; boolean true as long as prefix_strip() finds and removes a prefix
repeat -- one by one remove list, bold/italic, html-like markup, whitespace, etc from start of <s>
s, prefix_removed = prefix_strip (s);
until (not prefix_removed); -- until <prefix_removed> is nil
s1 = table.concat (prefixes_t); -- recreate the prefix string for later reattachment
local first_text = mw.ustring.match (s, '^%[%[[^%]]+%]%]'); -- extract wikilink at start of string if present; TODO: this can be string.match()?
Line 100 ⟶ 84:
return s1 .. s; -- reattach prefix string (if present) and done
end
p.title = function (frame )
|