跳转到内容
打开/关闭搜索
搜索
打开/关闭菜单
116
条目
154
文件
3
用户
730
编辑
Unimage Wiki
游戏内
武器
装备
剧情书
特殊道具
食物
特殊页面
实体
大型头目
强化头目
NPC
敌对生物
游戏流程
流程梗概
攻略
游戏难度
地区
进度
世界观
剧情资料
人物
大时间轴
创作历程
打开/关闭外观设置菜单
无法加载偏好设置。请检查您的网络连接并重试。
重试
打开/关闭个人菜单
未登录
未登录用户的IP地址会在进行任意编辑后公开展示。
user-interface-preferences
个人工具
讨论
贡献
创建账号
登录
编辑“︁
模块:Dev/Dialogue
”︁
来自Unimage Wiki
查看
阅读
编辑源代码
查看历史
associated-pages
模块
讨论
更多操作
更多
工具
链入页面
相关更改
页面信息
警告:
您没有登录。如果您进行任何编辑,您的IP地址会公开展示。如果您
登录
或
创建账号
,您的编辑会以您的用户名署名,此外还有其他益处。
反垃圾检查。
不要
加入这个!
-- 来源:https://dev.fandom.com/wiki/Module%3ADialogue -- 许可:CC BY-SA,作者与修订记录见来源页面 --| Creates dialogue definition lists --- For whatever reason, refuses to make blockquotes --- <nowiki> local Dialogue = {} ---- -- Libraries and Globals ---- -- Parses invocation and template parameters, trims whitespace, and removes blanks. local getArgs = require('Module:Dev/Arguments').getArgs ---- -- Local Functions ---- local function makeInvokeFunc(funcName) return function (frame) local args = getArgs(frame, {removeBlanks = false}) return Dialogue[funcName](args) end end ---- -- Public Functions ---- --% Formats dialogue between multiple speakers --- Intended to replace {{Dialogue}}. --- Syntax compliant with [[wikipedia:Template:Dialogue]] --- with portability and citation modifications --@ frame (table) Invokes the frame from {{Dialogue}}. See [[Template:Dialogue/doc]]. --: (string) HTML <dl /> Dialogue.main = makeInvokeFunc('dialogue') --% & crafts the Dialogue definition list --@ args (table) Arguments passed from Module function call <code>[.main]</code> or other Lua Modules function Dialogue.dialogue (args) local block = mw.html.create('dl'):addClass('dialogue-wrapper') for i,v in ipairs(args) do local next_param = i + 1 local mood_line = next_param / 2 if i == 1 then if v == 'action' then block:tag('dd') :tag('small'):attr('data-dialogue','action') :tag('u') :wikitext('['..args[next_param]..']') :done():done():done() else local speaker = (args[i] and args[args[i]]) and args[args[i]] or ( type(args[i]) == 'string' and mw.text.trim(args[i]):len() > 0 ) and args[i] or nil speaker = speaker and string.format("'''%s'''", speaker) local mood = args['mood'..mood_line] or nil mood = mood and string.format(" ''(%s)''", mood) if speaker or mood then block:tag('dt') :wikitext( ('%s%s'):format( speaker or '', mood or '') ):done() end if args[next_param] then block:tag('dd'):tag('q') :wikitext(args[next_param]) :done():done() else block:tag('dd'):wikitext('...'):done() end end elseif math.fmod(i, 2) == 1 then if v == 'action' then block:tag('dd') :tag('small') :attr('data-dialogue','action') :tag('u') :wikitext('['..args[next_param]..']') :done():done():done() else local speaker = (args[i] and args[args[i]]) and args[args[i]] or ( type(args[i]) == 'string' and mw.text.trim(args[i]):len() > 0 ) and args[i] or nil speaker = speaker and string.format("'''%s'''", speaker) local mood = args['mood'..mood_line] or nil mood = mood and string.format(" ''(%s)''", mood) if speaker or mood then block:tag('dt') :wikitext( ('%s%s'):format( speaker or '', mood or '') ) :done() end if args[next_param] ~= '' then block:tag('dd'):tag('q') :wikitext(args[next_param]) :done():done() else block:tag('dd'):wikitext('...'):done() end end end end block:done() if args['cite'] then block:tag('cite'):wikitext(string.format("— %s", args['cite'])):done() end return tostring(block) end ---- -- Output ---- return Dialogue
摘要:
请注意,所有对Unimage Wiki的贡献均可能会被其他贡献者编辑、修改或删除。如果您不希望您的文字作品被随意编辑,请不要在此提交。
您同时也向我们承诺,您提交的内容为您自己所创作,或是复制自公共领域或类似自由来源(详情请见
Unimage Wiki:著作权
)。
未经许可,请勿提交受著作权保护的作品!
取消
编辑帮助
(在新窗口中打开)
该页面使用的模板:
模块:Dev/Dialogue/doc
(
编辑
)
编辑“︁
模块:Dev/Dialogue
”︁
来自Unimage Wiki