Module:Parent: Difference between revisions

From StrategyWiki, the video game walkthrough and strategy guide wiki
Also catch anchor ids that are embedded in HTML tags
(Add "parent" module with an ifSection utility and alphabetTOC replacement)
 
(Also catch anchor ids that are embedded in HTML tags)
Line 7: Line 7:
     local names = {}
     local names = {}
     for level, name in string.gmatch( content, "\n(=+)%s*([^\n][^\n]-)%s*%1\n" ) do
     for level, name in string.gmatch( content, "\n(=+)%s*([^\n][^\n]-)%s*%1\n" ) do
        table.insert( names, name )
    end
    -- Also match HTML tags with anchor ids, e.g. <span id="A">
    -- that may or may not be self closing
    for _, name in string.gmatch( content, "<%w+ .-id=(['\"])([^%1][^%1]-)%1.-/?>" ) do
         table.insert( names, name )
         table.insert( names, name )
     end
     end