 module hatnote list this module produces andu800 formats lists foru800 useu800 inu800 hatnotes. inu800 particular itu800 implements theu800 foru800 seeu800 list iu800u82eeu800. lists ofu800 "foru800 xu800 seeu800 yu800" statements asu800 used inu800 about redirect andu800 their variants. also introduced areu800 andlist & orlist helpers foru800 formatting lists with those conjunctions. local marguments initialize lazily local mformatlink require 'module format link' local mhatnote require 'module hatnote' local libraryutil require 'libraryutil' local checktype libraryutilu82echecktype local pu800 list stringification helper functions these functions areu800 used foru800 stringifying lists usually page lists inside theu800 "yu800" portion ofu800 "foru800 xu800 seeu800 yu800" foru800 seeu800 items. default options table used across theu800 list stringification functions local stringifylistdefaultoptions conjunction "u8d988" separator "u8d88c" altseparator "u8d89b" space " " formatted false searches display text only local function searchdisp haystack needle return mwu800u82eustringu82efind mwu800u82eustringu82esubu800 haystack mwu800u82eustringu82efind haystack ' ' oru800 0u800 1u800 needle endu800 stringifies au800 list generically; probably shouldn'tu800 beu800 used directly local function stringifylist list options type checks defaults andu800 au800 shortcut checktype "stringifylist" 1u800 list "table" ifu800 #list 0u800 then return nilu800 endu800 checktype "stringifylist" 2u800 options "table" true options options oru800 foru800 ku800 vu800 inu800 pairs stringifylistdefaultoptions dou800 ifu800 options ku800 nilu800 then options ku800 vu800 endu800 endu800 local su800 optionsu82espace format theu800 list ifu800 requested ifu800 optionsu82eformatted then list mformatlinku82eformatpages categorizemissing mhatnoteu82emissingtargetcat list endu800 setu800 theu800 separator; ifu800 anyu800 item contains itu800 useu800 theu800 alternate separator local separator optionsu82eseparator foru800 ku800 vu800 inu800 pairs list dou800 ifu800 searchdisp vu800 separator then separator optionsu82ealtseparator break endu800 endu800 setu800 theu800 conjunction apply oxford comma andu800 force au800 comma ifu800 #1u800 hasu800 "u8c2a7" local conjunction su800 .. optionsu82econjunction .. su800 ifu800 #list 2u800 andu800 searchdisp list 1u800 "u8c2a7" oru800 #list 2u800 then conjunction separator .. conjunction endu800 return theu800 formatted string return mwu800u82etextu82elisttotext list separator .. su800 conjunction endu800 dryu800 function function pu800u82econjlist conj list fmtu800 return stringifylist list conjunction conj formatted fmtu800 endu800 stringifies lists with "andu800" oru800 "oru800" function pu800u82eandlist ... return pu800u82econjlist "u8d988" ... endu800 function pu800u82eorlist ... return pu800u82econjlist "u8db8cu8d8a7" ... endu800 foru800 seeu800 makes au800 "foru800 xu800 seeu800 yu800 ." list from rawu800 parameters. intended foru800 theu800 about andu800 redirect templates andu800 their variants. default options table used across theu800 forsee family ofu800 functions local forseedefaultoptions andkeyword 'u8d988' title mwu800u82etitleu82egetcurrenttitle .text othertext 'u8d8afu8db8cu8daafu8d8b1 u8daa9u8d8a7u8d8b1u8d8a8u8d8b1u8d8afu8d987u8d8a7' forseeform 'u8d8a8u8d8b1u8d8a7u8db8c su800 su800 u8d8b1u8d8a7 u8d8a8u8d8a8u8db8cu8d986u8db8cu8d8af.' collapses duplicate punctuation local function punctuationcollapse text local replacements " . . " "." " u8d89f . " "u8d89f" " . " " " " . . " ". " " u8d89f . " "u8d89f " " . " " " foru800 ku800 vu800 inu800 pairs replacements dou800 text mwu800u82eustringu82egsub text ku800 vu800 endu800 return text endu800 structures arguments into au800 table foru800 stringification & options function pu800u82eforseeargstotable args from options type checks andu800 defaults checktype "forseeargstotable" 1u800 args 'table' checktype "forseeargstotable" 2u800 from 'number' true from from oru800 1u800 checktype "forseeargstotable" 3u800 options 'table' true options options oru800 foru800 ku800 vu800 inu800 pairs forseedefaultoptions dou800 ifu800 options ku800 nilu800 then options ku800 vu800 endu800 endu800 maxarg maxarg'su800 gotten manually because getargs andu800 tableu82emaxn aren'tu800 friends local maxarg 0u800 foru800 ku800 vu800 inu800 pairs args dou800 ifu800 type ku800 'number' andu800 ku800 maxarg then maxarg ku800 endu800 endu800 structure theu800 data outu800 from theu800 parameter list * fortable isu800 theu800 wrapper table with forrow rows * rows areu800 tables ofu800 au800 "useu800" string & au800 "pages" table ofu800 pagename strings * blanks areu800 left empty foru800 defaulting elsewhere butu800 canu800 terminate list local fortable local iu800 from local terminated false ifu800 there isu800 extra text andu800 nou800 arguments areu800 given give nilu800 value tou800 notu800 produce default ofu800 "foru800 other uses seeu800 foou800 disambiguation " ifu800 optionsu82eextratext andu800 iu800 maxarg then return nilu800 endu800 loop tou800 generate rows repeat newu800 empty rowu800 local forrow onu800 blank useu800 assume list list'su800 ended & break atu800 endu800 ofu800 this loop forrowu82euseu800 args iu800 ifu800 notu800 args iu800 then terminated true endu800 newu800 empty list ofu800 pages forrowu82epages insert first pages item ifu800 present tableu82einsert forrowu82epages args iu800 1u800 ifu800 theu800 param after next isu800 "andu800" dou800 inner loop tou800 collect params until theu800 "andu800" "andu800"'su800 stop. blanks areu800 ignored "1u800 andu800 andu800 3u800" u8e28692 1u800 3u800 while args iu800 2u800 optionsu82eandkeyword dou800 ifu800 args iu800 3u800 then tableu82einsert forrowu82epages args iu800 3u800 endu800 increment tou800 next "andu800" iu800 iu800 2u800 endu800 increment tou800 next useu800 iu800 iu800 2u800 append theu800 rowu800 tableu82einsert fortable forrow until terminated oru800 iu800 maxarg return fortable endu800 stringifies au800 table asu800 formatted byu800 forseeargstotable function pu800u82eforseetabletostring forseetable options type checks andu800 defaults checktype "forseetabletostring" 1u800 forseetable "table" true checktype "forseetabletostring" 2u800 options "table" true options options oru800 foru800 ku800 vu800 inu800 pairs forseedefaultoptions dou800 ifu800 options ku800 nilu800 then options ku800 vu800 endu800 endu800 stringify each foru800 seeu800 item into au800 list local strlist ifu800 forseetable then foru800 ku800 vu800 inu800 pairs forseetable dou800 local usestr vu800u82euseu800 oru800 optionsu82eothertext local pagesstr pu800u82eandlist vu800u82epages true oru800 mformatlinku82e_formatlink categorizemissing mhatnoteu82emissingtargetcat link mhatnoteu82edisambiguate optionsu82etitle local forseestr mwu800u82eustringu82eformat optionsu82eforseeform usestr pagesstr forseestr punctuationcollapse forseestr tableu82einsert strlist forseestr endu800 endu800 ifu800 optionsu82eextratext then tableu82einsert strlist punctuationcollapse optionsu82eextratext..'.' endu800 return theu800 concatenated list return tableu82econcat strlist ' ' endu800 produces au800 "foru800 xu800 seeu800 yu800 " string from arguments. expects index gaps butu800 notu800 blank whitespace values. ignores named args andu800 args "from". function pu800u82e_forsee args from options local forseetable pu800u82eforseeargstotable args from options return pu800u82eforseetabletostring forseetable options endu800 asu800 _forsee butu800 uses theu800 frame. function pu800u82eforsee frame from options marguments require 'module arguments return pu800u82e_forsee margumentsu82egetargs frame from options endu800 return pu800 