我正在使用mediawiki管理一些数据,我想知道是否有可能从现有的wiki数据中生成标准化页面,而不必创建大量非常相似的页面。在理想的情况下,我会有一个由CGI动态填充的数据库后端和页面模板,我想知道是否可以强制mediawiki模板系统来填充这个角色。
这就是我想做的:
数据页
name: banana
colour: yellow
tastiness: extremely high
extra: some more stuff, potentially with complicated wiki formatting
links: www.banana.com; www.iheartbananas.org
image: banana.jpg
name: apple
colour: red, green
tastiness: variable
extra: some more stuff
links: www.apple-fruit.com
然后为数据库中的每个项目生成一个标准化页面:
<name> Info
It is generally <colour>
Its tastiness rating is <tastiness>
Read more about <name> at <links>
<image>
使用mediawiki模板可以做到这一点吗?
使用模板是可能的,尽管这不一定是一个好的解决方案。您需要为每个项目创建一个数据模板,类似于以下内容(例如Template:FruitData/banana
):
{{ {{{template}}}
| name = banana
| colour = yellow
| tastiness = extremely high
| extra = some more stuff, potentially with complicated wiki formatting
| link = www.banana.com
| image = banana.jpg
}}
以及显示模板(比如Template:StandardFruitDisplay
):
[[File:{{{image}}}|thumb|right]]
The {{{name}}} is a {{{colour}}} fruit with {{{tastiness}}} taste. {{extra|}}} See [http://{{{link}}} {{{{link}}}].
然后在实际页面上显示如下:{{ Template:FruitData/banana | template = StandardFruitDisplay }}
但您最好使用一些以数据为中心的扩展(除非您的目标是极度灵活或用户控制)。