Content deleted Content added
allow err to read i18n |
Sophivorus (talk | contribs) Restore previous code for further testing |
||
Line 494:
text = mw.ustring.gsub(text, "^.-<[Oo][Nn][Ll][Yy][Ii][Nn][Cc][Ll][Uu][Dd][Ee]>", "") -- remove text before first onlyinclude section
text = mw.ustring.gsub(text, "</[Oo][Nn][Ll][Yy][Ii][Nn][Cc][Ll][Uu][Dd][Ee]>.*", "") -- remove text after last onlyinclude section
local escapedFragment = mw.ustring.gsub( options.fragment, "[%^%$%(%)%%%.%[%]%*%+%-%?]", "%%%0" )
local fragments = ""
local fragment = ""
local position = 1
while position < mw.ustring.len( text ) do
fragment, position = mw.ustring.match(text, "<%s*[Ss]ection%s+begin%s*=%s*[\"\']?%s*" .. escapedFragment .. "%s*[\"\']?%s*/>(.-)<%s*[Ss]ection%s+end=%s*[\"\']?%s*" .. escapedFragment .. "%s*[\"\']?%s*/>()", position )
if fragment and position then
fragments = fragments .. fragment
else
position = mw.ustring.len( text )
end
end
text = fragments
end
if not is(options.keepSubsections) then
Line 583 ⟶ 598:
pageName = pn or pageName
text, normalisedPageName = getContent(pageName)
▲ if is(options.fragment) then
▲ end
if not normalisedPageName then
return err("No title for page name " .. pageName)
|