这个Lua代码:
function p.pron_reg(frame)
local cette_page = mw.title.getCurrentTitle()
-- récup des params & valeurs par défaut
local args = frame:getParent().args
local pays = args[1] or '<small>(Région à préciser)</small>'
local text_api = args[2]
local code_lang = args[3] or args["lang"]
local fic_audio = args["audio"]
local title = args["title"] or cette_page.text
-- Génération du wikicode
local txt = pays .. ' : '
if ((text_api) or (fic_audio)) then
if (fic_audio and fic_audio ~= '') then
txt = txt .. 'auscultare « ' .. title
if (text_api) then
txt = txt .. ' ' .. p.lua_pron(text_api,code_lang,'[]')
end
txt = txt .. ' » [[File:' .. fic_audio .. ']]'
else
txt = txt .. p.lua_pron(text_api,code_lang,'[]')
end
else
txt = txt .. '<small>merci de préciser une prononciation phonétique ou un fichier audio (voir la [[Modèle:écouter|notice]])</small>'
end
return txt
end
为IPA和音频发音创建模板。是否有机会将音频播放器移到IPA发音旁边(»之前),就像在图片中一样(link)
答案 0 :(得分:0)
使用Lua代码生成的Wikitext的解析方式与您刚刚输入的wikitext相同,因此这里的问题实际上与Lua没有任何关系。相反,它与您输出的wiki文本生成的HTML有关。要内联显示媒体播放器,您需要在CSS中使用display: inline-block;
。您可以使用以下wiki文本执行此操作,而无需编辑任何Wiki的CSS文件:
<div>Foo <div style="display: inline-block">[[File:Example.ogg]]</div></div>
如果你让你的Lua模块输出类似的东西,那应该可以解决问题。