Editing Module:GetEcopedia
From Eco - English Wiki
Your changes will be displayed to readers once an authorized user accepts them. (help)
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 34: | Line 34: | ||
local headerSec = "EcopediaHeader" | local headerSec = "EcopediaHeader" | ||
-- make sure page is not nil | -- make sure page is not nil | ||
Line 43: | Line 41: | ||
local p = pageList[page] | local p = pageList[page] | ||
if p ~= nil then | if p ~= nil then | ||
-- create text to be returned | |||
local text = "" | |||
-- main heading | -- main heading | ||
text = text .. "\'\'\'" .. p.displayName .. "\'\'\' | text = text .. "\'\'\'" .. p.displayName .. "\'\'\'\n" | ||
-- loop through sections (i = array position, j= {sectionType, text} ) | -- loop through sections (i = array position, j= {sectionType, text} ) | ||
for i=1, #p. | for i=1, #p.sections do | ||
-- create a local of the current section | -- create a local of the current section | ||
local sec = p. | local sec = p.sections[i] | ||
if (sec[1] == bodySec) then | if (sec[1] == bodySec) then | ||
text = text .. sec[2] .. " | text = text .. sec[2] .. "\n" | ||
end -- if bodySec | end -- if bodySec | ||
if (sec[1] == headerSec) then | if (sec[1] == headerSec) then | ||
text = text .. " | text = text .. "\'\'" .. sec[2] .. "\'\'\n" | ||
end -- if headerSec | end -- if headerSec | ||
Line 63: | Line 64: | ||
end -- if exists in Ecopedia | end -- if exists in Ecopedia | ||
end -- if page not nil | end -- if page not nil | ||
end | end | ||
return p | return p |