Module:Lang: Difference between revisions

Jump to navigation Jump to search
Content added Content deleted
No edit summary
No edit summary
Line 434: Line 434:
if not is_set (args.text) then
if not is_set (args.text) then
return make_error_msg ('{{lang-xx}}: no text', args.no_cat);
return make_error_msg ('{{lang-xx}}: no text', args.no_cat);
end

----------
if args.text:find ("\'\'\'\'\'[\']+") then
return make_error_msg ('{{lang-xx}}: text has malformed markup', args.no_cat);
end
end


Line 440: Line 445:
end
end


if args.text:match ("^\'[^\']+") then -- first character is single \' which may interfere with italic markup; convert to entity
if args.text:find ("\'\'\'\'") then -- four apostrophes
return make_error_msg ('{{lang-xx}}: text has malformed markup', args.no_cat);
args.text:gsub ("^\'", ''')
end
end


if args.text:sub(1,1) == "'" then args.text = "<span></span>" .. args.text; end
if args.text:match ("[^\']\'$") then -- last character is single \' which may interfere with italic markup; convert to entity
if args.text:sub(-1,-1) == "'" then args.text = args.text .. "<span></span>"; end
args.text:gsub ("\'$", '&#39;')
----------
end


args.code = format_ietf_tag (code, script, region, variant); -- format to recommended subtag styles
args.code = format_ietf_tag (code, script, region, variant); -- format to recommended subtag styles