Module:RFC and Module:RFC/sandbox: Difference between pages
(Difference between pages)
imported>Dandorid Add option 'comment' for summary() to display a comment in a {{Block indent}}. |
imported>Dandorid whitespace handling |
||
| Line 14: | Line 14: | ||
--args.plain(false): do not prepend the RFC number with 'RFC'. | --args.plain(false): do not prepend the RFC number with 'RFC'. | ||
--args.title(true): include the title of the RFC. | --args.title(true): include the title of the RFC. | ||
--args.status(true): include the status of the RFC. | --args.status(true): include the status of the RFC (if title=true and inline=false). | ||
--args.notes(false): include the notes of the RFC. | --args.notes(false): include the notes of the RFC (if title=true and inline=false). | ||
--args.comment(''): add a {{Block indent}} with a comment. | --args.comment(''): add a {{Block indent}} with a comment. | ||
--args.inline(false): display the title within a running sentence (if title=true). | |||
--args.punctuation(''): interpunction to use after the qouted title (if inline=true). | |||
-- In 1992, [[Joyce K. Reynolds]] is mentioned in {{Sum RFC|1336|ref=yes|inline=yes|punctuation=,}} along with a brief biography. | |||
-- In 1992, [[Joyce K. Reynolds]] is mentioned, along with a brief biography, in {{Sum RFC|1336|ref=yes|inline=yes|punctuation=.}} | |||
-- In 1992, {{Sum RFC|1336|ref=yes|inline=yes}} mentioned [[Joyce K. Reynolds]], along with a brief biography. | |||
if not frame then frame = mw.getCurrentFrame() end | if not frame then frame = mw.getCurrentFrame() end | ||
local refContent = "" | local refContent = "" | ||
| Line 37: | Line 43: | ||
local titleContent = mw.ustring.match(dbContent, sectionMatch(rfc, 'title')) | local titleContent = mw.ustring.match(dbContent, sectionMatch(rfc, 'title')) | ||
if rfc < 10000 then table.insert(output, ' ') end | local titleTag = 'cite' | ||
if yesno(args.inline or false, false) then | |||
titleTag = 'i' | |||
table.insert(output, ' ') | |||
else | |||
if rfc < 10000 then table.insert(output, ' ') end | |||
if rfc < 1000 then table.insert(output, ' ') end | |||
if rfc < 100 then table.insert(output, ' ') end | |||
if rfc < 10 then table.insert(output, ' ') end | |||
table.insert(output, '– ') | |||
end | |||
local interpunction = ','; -- We continue with the status after the title by default. | |||
if not yesno(args.status or true, true) then | |||
interpunction = '.'; -- If no status is displayed, move the sentence ending period to the title. | |||
end | |||
if yesno(args.inline or false, false) then | |||
interpunction = args.punctuation or '' | |||
end | |||
table.insert(output, string.format( | table.insert(output, string.format( | ||
' | '"%s%s"%s', -- The title is displayed inside double quotes. | ||
frame:extensionTag( | -- The English language rules prescribe that interpunction is positioned inside quoted text. | ||
-- The reference is positioned directly adjacent to the closing double quote. | |||
frame:extensionTag(titleTag, frame:preprocess(titleContent)), | |||
interpunction, | |||
refContent | refContent | ||
)) | )) | ||
if yesno(args.status or true, true) then | if not yesno(args.inline or false, false) then | ||
if yesno(args.status or true, true) then | |||
local statusContent = mw.ustring.match(dbContent, sectionMatch(rfc, 'status')) | |||
table.insert(output, " ''" .. statusContent .. ".''") | |||
-- The status is a sentence by itself (only a few, or even a single word), ended with a period. | |||
end | |||
if yesno(args.notes or false, false) then | |||
local notesContent = mw.ustring.match(dbContent, sectionMatch(rfc, 'notes')) | |||
table.insert(output, ' ' .. frame:preprocess(notesContent)) | |||
-- Notes are assumed to be formatted correctly. | |||
end | |||
end | end | ||
elseif yesno(args.ref or false, false) then | elseif yesno(args.ref or false, false) then | ||