Module:Citation/CS1/Utilities: Difference between revisions
Jump to navigation
Jump to search
Content deleted Content added
m 1 revision imported |
Infobox>Trappist the monk sync from sandbox; |
||
Line 334: | Line 334: | ||
local wl_type = 2; -- assume that str is a complex wikilink [[L|D]] |
local wl_type = 2; -- assume that str is a complex wikilink [[L|D]] |
||
if not str:match ('^%[%[[^%]]+%]%]$') then -- is str some sort of a wikilink (must have some sort of content) |
|||
return 0, str, ''; -- not a wililink; return wl_type as 0, str as D, and empty string as L |
|||
⚫ | |||
⚫ | |||
L, D = str:match ('^%[%[([^|]+)|([^%]]+)%]%]$'); -- get L and D from [[L|D]] |
L, D = str:match ('^%[%[([^|]+)|([^%]]+)%]%]$'); -- get L and D from [[L|D]] |
||
if not is_set (D) then -- if no separate |
if not is_set (D) then -- if no separate display |
||
D = str:match ('^%[%[([^%]]*)|*%]%]$'); -- get D from [[D]] |
D = str:match ('^%[%[([^%]]*)|*%]%]$'); -- get D from [[D]] or [[D|]] |
||
wl_type = 1; |
wl_type = 1; |
||
⚫ | |||
⚫ | |||
if not is_set (D) then -- no wikilink markup |
|||
D = str; -- return the string as D |
|||
wl_type = 0; -- but say that it is not a wikilink |
|||
end |
end |
||
D = mw.text.trim (D, '%s|'); -- trim white space and pipe characters |
D = mw.text.trim (D, '%s|'); -- trim white space and pipe characters |
||
-- L = L and mw.text.trim (L, '%s|'); |
|||
return wl_type, D, L or ''; |
return wl_type, D, L or ''; |
||
end |
end |