Module:Lang: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 204:
table.insert (out, '</span>');
-- if (0 == namespace) and not is_set (nocat) then -- only categorize in article space
table.insert (out, '[[Category:lang and lang-xx template errors]]');
-- end
 
return table.concat (out);
Line 304:
local title;
local tout = {};
local title_table = lang_data.translit_title_table; -- table of transliteration standards and the language codes and scripts that apply to those standards
table.insert (tout, "''<span title=\"");
Line 344:
 
--[[--------------------------< V A L I D A T E _ T E X T >---------------------------------------------------
 
This function checks the content of args.text and returns empty string if nothing is amiss else it returns an
error message. The tests are for empty or missing text and for improper or disallowed use of apostrophe markup.
 
Italic rendering is controlled by the |italic= template parameter so italic markup should never appear in args.text
either as ''itself''' or as '''''bold italic'''''.
 
Also protects single leading and trailing single quote marks from being converted to bold by the addition of
adjacent italic markup.
 
]]
Line 352 ⟶ 361:
end
 
if args.text:find ("\'\'\'\'\'[\']+") then -- because we're looking, look for 6+ appostrophes
return make_error_msg (table.concat ({'{{', template, '}}: text has malformed markup'}), args.nocat);
end
 
if args.text:match ("%f[\']\'\'[^\']+\'\'%f[^\']") or args.text:match ("\'\'\'\'\'[^\']+\'\'\'\'\'") then -- italic but not bold, or bold italic
return make_error_msg (table.concat ({'{{', template, '}}: text has italic markup'}), args.nocat);
end
 
if args.text:find ("\'\'\'\'") then -- fourbecause we're looking, look for 4 apostrophes
return make_error_msg (table.concat ({'{{', template, '}}: text has malformed markup'}), args.nocat);
end
 
if 'yes' == args.italic then -- protect single quote marks from being converted to bold markup
ifargs.text = args.text:subgsub (1"^\'[^\']+", "<span></span>%1"); -- ==leading "'"single quote thenmark
args.text = args.text:gsub ("[^\']+\'$", "%1<span></span>"); -- ..trailing args.text;single quote mark
end
 
if args.text:sub(-1,-1) == "'" then
args.text = args.text .. "<span></span>";
end
end
end
Anonymous user