Module:PageSummary:修订间差异
武外梗百科 爱国好学自强图新的百科全书
更多操作
无编辑摘要 |
无编辑摘要 |
||
| 第90行: | 第90行: | ||
-- 4. 渲染 HTML | -- 4. 渲染 HTML | ||
local res = mw.html.create('div'):css({['display'] = 'flow-root', ['line-height'] = '1.5'}) | local res = mw.html.create('div'):css({ | ||
['display'] = 'flow-root', | |||
['line-height'] = '1.5', | |||
['margin-bottom'] = '1em' -- 也可以通过这里控制整个组件下方的间距 | |||
}) | |||
-- | -- 标题 | ||
res:tag('div') | res:tag('div') | ||
:css({['font-size'] = '1.15em', ['font-weight'] = 'bold', ['margin-bottom'] = '4px'}) | :css({['font-size'] = '1.15em', ['font-weight'] = 'bold', ['margin-bottom'] = '4px'}) | ||
:wikitext('[[' .. pageName .. ']]') | :wikitext('[[' .. pageName .. ']]') | ||
-- | -- 右侧缩略图 | ||
if firstImage then | if firstImage then | ||
res:wikitext('[[File:' .. firstImage .. '|100px|right|link=' .. pageName .. ']]') | res:wikitext('[[File:' .. firstImage .. '|100px|right|link=' .. pageName .. ']]') | ||
end | end | ||
-- | -- 摘要正文:在末尾增加空行 | ||
res:wikitext(summary) | -- 方法:在 summary 字符串后直接加上 <br /> 或 \n\n | ||
res:tag('div') | |||
:wikitext(summary .. '<br /><br />') | |||
return tostring(res) | return tostring(res) | ||