Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
ClimateKG
Search
Search
English
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Module:ReportTOC
Module
Discussion
English
Read
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit source
View history
General
What links here
Related changes
Page information
In other projects
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
-- Module:ReportTOC -- Handles rendering of report table of contents with chapters loop 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.renderSection(frame, sectionKey, sectionLabel, maxChapters) -- For SPM and TS, single entries if sectionKey == 'spm' or sectionKey == 'ts' then local title = frame.args[sectionKey .. 'title'] if not title or title == '' then return '' end local subtitle = frame.args[sectionKey .. 'subtitle'] or '' local url = frame.args[sectionKey .. 'url'] or '' local subtitleHtml = '' if subtitle ~= '' then subtitleHtml = '<span class="rtoc-entry-subtitle">' .. subtitle .. '</span>' end return '<div class="s-' .. sectionKey .. '">' .. '<div class="rtoc-section-title">' .. sectionLabel .. '</div>' .. '<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>' .. '</div>' end -- For chapters, loop through all if sectionKey == 'ch' then local chapters = '' for i = 1, maxChapters do chapters = chapters .. p.renderChapter(frame, i) end if chapters == '' then return '' end return '<div class="s-ch">' .. '<div class="rtoc-section-title">' .. sectionLabel .. '</div>' .. chapters .. '</div>' end return '' end function p.main(frame) local html = '<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 html = html .. p.renderSection(frame, 'spm', 'SPM', 0) -- TS html = html .. p.renderSection(frame, 'ts', 'TS', 0) -- Chapters (up to 25) html = html .. p.renderSection(frame, 'ch', 'Chapters', 25) -- 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>' return html end return p
Summary:
Please note that all contributions to ClimateKG may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
ClimateKG:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Page included on this page:
Module:ReportTOC/doc
(
edit
)
Search
Search
Editing
Module:ReportTOC
Add languages
Add topic