Module:Template documentation: Difference between revisions

m
no edit summary
(Created page with "local p = {} -- p stands for package local ruler = '<hr style="background-color:#b3b7ff; clear:both; height:.7ex; margin:1em 0;" />' --local template = mw.site.namespaces....")
 
mNo edit summary
 
(3 intermediate revisions by the same user not shown)
Line 13:
local ns = frame.args.ns or mw.site.namespaces.Template.name
local vorlage = frame.args.vorlage or mw.title.getCurrentTitle().rootTexttext
local template = ns .. ':' -- namespace of including page with colon
local doc = frame.args.doc or 'doc' --- change name of documentation subpage if wanted
local preload = frame.args.preload or 'Template:DocumentationTemplate documentation/preload-doc'
local cat = frame.args.cat or frame.args.kat or frame.args.kategorie or 'Templates'
local nocat = frame.args.nocat or frame.args.nokat or frame.args.keinekat or frame.args.ns -- do not categorize
Line 32:
local verborgen = (hidden and '<div>The template <span style="font-family:&quot;Consolas&quot;, monospace; background-color:yellow;padding:0 0.5em">' .. vorlage .. '</span> is hidden and visible only in embedding pages.</div>' ) or ''
 
local duhast = 'The template documentation has been included by the command <code>{{#invoke:Template documentation|doc|...}}</code> using subpage <code>' .. dok .. '</code>. The documentation of [[ModuleTemplate:Template documentation|Module Template documentation]] contains more information about using the module and its paramters.'
local diedokumentationsunterseite = '<div class="messagebox" style="margin-top:1em; clear: both; border: 2px dotted #666666; padding: 0.6em; background-color: #ccffff; text-align: center; ">The subpage for template documentation <code>{{[[' .. _doc .. '|' .. dok..']]}}</code> does not exist.</div>'
Line 101:
 
local frame = mw.getCurrentFrame()
local vorlage = frame.args.vorlage or mw.title.getCurrentTitle().rootTexttext
local doc = frame.args.doc or 'doc' --- rename documentation subpage
Line 121:
result = divspan .. result .. '</span></div>\n\n'
local small = "''<small>This [[ModuleTemplate:Template_documentation|template documentation]] is included from [[" .. _doc .. "]]</small>''</div>"
return result .. small
 
Line 134:
if myns ~= 10 then return end -- if not template namespace do nothing
local _vorlage = frame.args.vorlage or mw.title.getCurrentTitle().rootTextbaseText
local ns = frame.args.ns or mw.site.namespaces.Template.name
local vorlage = ns .. ':' .. _vorlage
Line 140:
local _dok = vorlage .. '/' .. dok
 
local rohhtml = '<table style="border-style:solid; margin-bottom:2px; margin-top:2px; border-color:MediumSlateBlue"><tr><td>[[File:Info-Icon.png|30px]]</td><td style="width: 100%;">This is the [[ModuleTemplate:Template_documentation|documention subpage]] ot the [[' .. vorlage .. '|<b>template ' .. _vorlage .. '</b>]]</td></tr></table>'
 
local divspan = '<div style="margin-bottom: 0.5em;border: 2px dotted #666666; padding: 0.5em;display:inline-block"><span class="mw-editsection plainlinks" style="padding:0em 1em 0em 0em;" >'
Line 167:
-- parameters with default values
local count = frame.args.count or 0
local vorlage = frame.args.vorlage or mw.title.getCurrentTitle().rootTexttext
local ns = frame.args.ns or mw.site.namespaces.Template.name
local erzeugt = frame.args.text or "misses a description"
Line 186 ⟶ 187:
local ergibt_expandiert = div_inlineblock .. 'unfolds as wikitext:' .. div_dotted
 
if vorlage:match('%a+$') == 'doc' then vorlage = vorlage:match('(.+)%/%a+$') end -- when docu sub then remove doc
-- zusammengesetzte Texte
Line 205 ⟶ 207:
ShowMe = frame:preprocess('\n==Wikitext==\n') .. p.wrap(p.Inhalt(vorlage,ns)) -- Vorlageninhalt anzeigen
--if 1 then return vorlage .. mw.title.getCurrentTitle().baseText .. mw.title.getCurrentTitle().text end
if p.gibts(rubrik) then vorlagenliste = '<div>' .. frame:expandTemplate{ title = rubrik, args = { } } .. '</div>' end
Line 371 ⟶ 374:
local space = namespace or 'template'
local titel = mw.title.new(space .. ":" .. name)
if titel == nil then return false end
 
if titel.exists then return titel end
return false
Line 392 ⟶ 395:
-- ns: Namespace (default: Template)
local space = ns or mw.site.namespaces.Template.name
local text = titel or mw.title.getCurrentTitle().rootTextbaseText
local wseite = mw.title.new(titel, space) -- Wikiseite als title-Objekt
if wseite.exists then
127

edits