Module:Excerpt slideshow/sandbox: Difference between revisions

Content deleted Content added
sync with live version of the module
test
Line 133:
mw.log("require('Module:Excerpt').get failed: " .. excerpt) -- probably got a redlink
excerpt = nil
end
if excerpt and excerpt ~= '' and #excerpt > 10 then
-- temporarily take off the '''[[Page title|Read more...]]''' link if present
readmore_start_index, readmore_end_index, readmore_text = mw.ustring.find(excerpt, "(%s*'''%b[]''')$", -350) --- Starting from end should improve efficiency. 350 characters allows for long page titles and/or a long custom label for the link
if readmore_start_index then
excerpt = mw.ustring.sub(excerpt, 1, readmore_start_index-1)
end
end
if excerpt and excerpt ~= '' and #excerpt > 10 then -- check again in case we had a few characters plus Read more...
Line 155 ⟶ 148:
excerpt = gsubWikitextLists(excerpt, '#', 'ol', 'li')
excerpt = mw.text.trim(excerpt)
if readmore_textoptions.more then
-- add back the "Read more..." link if it was present
excerpt = excerpt .. " ('''[[" .. title .. "|" .. options.more .. "]]''')"
if readmore_text then
excerpt = excerpt .. readmore_text
end
local text = '<div style{{=}}text-align:left;>' .. mw.ustring.gsub(excerpt, '%c', '<br>') .. '</div>'