« Module:ZoteroItem » : différence entre les versions
Aucun résumé des modifications |
Aucun résumé des modifications |
||
| Ligne 232 : | Ligne 232 : | ||
local noteHtml = item.data.note or "" | local noteHtml = item.data.note or "" | ||
local url = (item.links and item.links.alternate and item.links.alternate.href) or "" | local url = (item.links and item.links.alternate and item.links.alternate.href) or "" | ||
-- Nettoyage : ne garder que <p> et <h1> (supprime tout le reste) | |||
noteHtml = mw.ustring.gsub(noteHtml, "</?(%w+)[^>]*>", function(tag) | |||
if tag == "p" or tag == "h1" then | |||
return "<" .. tag .. ">" | |||
elseif tag == "/p" or tag == "/h1" then | |||
return "</" .. tag:sub(2) .. ">" | |||
else | |||
return "" | |||
end | |||
end) | |||
if noteHtml ~= "" then | if noteHtml ~= "" then | ||
table.insert(output, | table.insert(output, noteHtml) | ||
end | end | ||
if url ~= "" then | if url ~= "" then | ||
table.insert(output, | table.insert(output, url) | ||
end | end | ||
end | end | ||