Modul:Foundationclass | classDoc <
Version vom 15. Januar 2016, 20:45 Uhr von Oetterer (Diskussion | Beiträge)
This is a documentation subpage for Modul:Foundationclass/classDoc. It contains usage information, categories and other content that is not part of the original modul page. |
This module is rated as beta, and is ready for widespread use. It is still new and should be used with some caution to ensure the results are as expected. |
This module implements template some methods for Module:Foundationclass/classDoc's documentation.
Usage[Quelltext bearbeiten]
# note: contents means the text which should be pasted into an articles textbox to produce a page {{#invoke:Foundationclass/classDoc/classDoc|base}} -- returns the contents of a class module's base page {{#invoke:Foundationclass/classDoc/classDoc|baseDoc}} -- returns the contents of a class module's base page's doc page (aka the documentation of a base page) {{#invoke:Foundationclass/classDoc/classDoc|categorize}} -- returns the categories, suited for the calling page {{#invoke:Foundationclass/classDoc/classDoc|category}} -- returns the contents of a category page {{#invoke:Foundationclass/classDoc/classDoc|class}} -- returns the contents/template text for a class module {{#invoke:Foundationclass/classDoc/classDoc|classDoc}} -- returns the contents of a class module's doc page (aka documentation of a class page) {{#invoke:Foundationclass/classDoc/classDoc|configDoc}} -- returns the contents of a class module's config page's doc page {{#invoke:Foundationclass/classDoc/classDoc|form}} -- returns the contents of a form page {{#invoke:Foundationclass/classDoc/classDoc|gardeningCategory}} -- returns the contents of a gardening category page {{#invoke:Foundationclass/classDoc/classDoc|template}} -- returns the contents of a template page {{#invoke:Foundationclass/classDoc/classDoc|templateDoc}} -- returns the contents of a template page's doc page
These methods can also be called by other modules. When doing so, you can actually define the module name and the class name. They will substitute the placeholders in the documentation text:
local classDoc = require('Modul:Foundationclass/classDoc')
classDoc.base(moduleName)
classDoc.baseDoc(moduleName)
classDoc.category(moduleName)
classDoc.class(moduleName, className)
classDoc.classDoc(moduleName, className)
classDoc.configDoc(moduleName)
classDoc.form(moduleName)
classDoc.gardeningCategory(moduleName)
classDoc.template(moduleName)
classDoc.templateDoc(moduleName)
However, what you want to be doing instead of calling these methods is, generating the content yourself. That you do like this:
-- instead of calling classDoc.class(moduleName, className), you use
local content = mw.message.new('classengine-template-module-class-page'):rawParams(_private[self].pagename, coreData.className):plain()
-- instead of calling classDoc.classDoc(moduleName, className), you use
local content = mw.message.new('classengine-template-module-class-documentation-page'):rawParams(_private[self].pagename, coreData.className, moduleCategory, classCategory):plain()
-- in case of non module pages, you might need to take care of the escaped template, wiki, and parser function calls. this you do with:
local frame = mw.getCurrentFrame()
content = frame:preprocess(content)