|
|
| Line 1: |
Line 1: |
| -- Module:ReportTOC | | -- Module:ReportTOC - DEBUG VERSION |
| local p = {} | | local p = {} |
|
| |
| function p.renderChapter(frame, chNum)
| |
| local title = frame.args['ch' .. chNum .. 'title']
| |
| if not title or title == '' then
| |
| return ''
| |
| end
| |
|
| |
| local subtitle = frame.args['ch' .. chNum .. 'subtitle'] or ''
| |
| local url = frame.args['ch' .. chNum .. 'url'] or ''
| |
|
| |
| local subtitleHtml = ''
| |
| if subtitle ~= '' then
| |
| subtitleHtml = '<span class="rtoc-entry-subtitle">' .. subtitle .. '</span>'
| |
| end
| |
|
| |
| return '<div class="rtoc-entry"><div class="rtoc-entry-text"><span class="rtoc-entry-title">' .. title .. '</span>' .. subtitleHtml .. '</div><span class="rtoc-read">[[' .. url .. '|Read]]</span></div>'
| |
| end
| |
|
| |
|
| function p.main(frame) | | function p.main(frame) |
| local html = '<onlyinclude><div class="rtoc-box"><div class="rtoc-header">Contents</div>'
| |
|
| |
| -- Front Matter
| |
| html = html .. '<div class="s-fm"><div class="rtoc-section-title">Front Matter</div><div class="rtoc-oos">Content in this section is out of scope</div></div>'
| |
|
| |
| -- SPM
| |
| local spmTitle = frame.args['spmtitle'] | | local spmTitle = frame.args['spmtitle'] |
| if spmTitle and spmTitle ~= '' then | | return "SPM Title: " .. (spmTitle or "NOT FOUND") |
| local spmSubtitle = frame.args['spmsubtitle'] or ''
| |
| local spmUrl = frame.args['spmurl'] or ''
| |
| local spmSubtitleHtml = ''
| |
| if spmSubtitle ~= '' then
| |
| spmSubtitleHtml = '<span class="rtoc-entry-subtitle">' .. spmSubtitle .. '</span>'
| |
| end
| |
| html = html .. '<div class="s-spm"><div class="rtoc-section-title">SPM</div><div class="rtoc-entry"><div class="rtoc-entry-text"><span class="rtoc-entry-title">' .. spmTitle .. '</span>' .. spmSubtitleHtml .. '</div><span class="rtoc-read">[[' .. spmUrl .. '|Read]]</span></div></div>'
| |
| end
| |
|
| |
| -- TS
| |
| local tsTitle = frame.args['tstitle']
| |
| if tsTitle and tsTitle ~= '' then
| |
| local tsSubtitle = frame.args['tssubtitle'] or ''
| |
| local tsUrl = frame.args['tsurl'] or ''
| |
| local tsSubtitleHtml = ''
| |
| if tsSubtitle ~= '' then
| |
| tsSubtitleHtml = '<span class="rtoc-entry-subtitle">' .. tsSubtitle .. '</span>'
| |
| end
| |
| html = html .. '<div class="s-ts"><div class="rtoc-section-title">TS</div><div class="rtoc-entry"><div class="rtoc-entry-text"><span class="rtoc-entry-title">' .. tsTitle .. '</span>' .. tsSubtitleHtml .. '</div><span class="rtoc-read">[[' .. tsUrl .. '|Read]]</span></div></div>'
| |
| end
| |
|
| |
| -- Chapters
| |
| local chapters = ''
| |
| for i = 1, 25 do
| |
| chapters = chapters .. p.renderChapter(frame, i)
| |
| end
| |
| if chapters ~= '' then
| |
| html = html .. '<div class="s-ch"><div class="rtoc-section-title">Chapters</div>' .. chapters .. '</div>'
| |
| end
| |
|
| |
| -- Annexes
| |
| html = html .. '<div class="s-an"><div class="rtoc-section-title">Annexes</div><div class="rtoc-oos">Content in this section is out of scope</div></div>'
| |
|
| |
| html = html .. '</div></onlyinclude>'
| |
|
| |
| return html
| |
| end | | end |
|
| |
|
| return p | | return p |
Documentation for this module may be created at Module:ReportTOC/doc
-- Module:ReportTOC - DEBUG VERSION
local p = {}
function p.main(frame)
local spmTitle = frame.args['spmtitle']
return "SPM Title: " .. (spmTitle or "NOT FOUND")
end
return p