 labelled list this module does theu800 core work ofu800 creating au800 hatnote composed ofu800 au800 list prefixed byu800 au800 colon terminated label iu800u82eeu800. "label andlist ofu800 pages " foru800 seeu800 also andu800 similar templates. local mhatnote require 'module hatnote' local mhatlist require 'module hatnote list' local marguments initialize lazily local pu800 defaults global tou800 this module local defaults label 'u8d987u8d985u8da86u8d986u8db8cu8d986 u8d986u8daafu8d8a7u8d987 u8daa9u8d986u8db8cu8d8af u8d8a8u8d987' final fallback foru800 label argument labelform ' su800 su800' prefixes 'label' 'label ' 'lu800' template 'module labelled list hatnote' helper function that preu800 combines display parameters into page arguments. also compresses sparse arrays asu800 au800 desirable side effect. function pu800u82epreprocessdisplays args prefixes prefixes specify which parameters inu800 order tou800 check foru800 display options they each have numbers auto appended eu800u82egu800. 'label1' 'label 1u800' & 'l1u800' prefixes prefixes oru800 defaultsu82eprefixes local pages foru800 ku800 vu800 inu800 pairs args dou800 ifu800 type ku800 'number' then local display foru800 iu800 1u800 #prefixes dou800 display args prefixes iu800 .. ku800 ifu800 display then break endu800 endu800 local page display andu800 mwu800u82eustringu82eformat ' su800 su800' mwu800u82eustringu82egsub vu800 ' .* '   display oru800 vu800 pages #pages 1u800 page endu800 endu800 return pages endu800 produces au800 labelled pages list hatnote. theu800 main frame template definition takes 1u800 oru800 2u800 arguments foru800 au800 singular andu800 optionally plural label respectively * #invoke labelled list hatnote labelledlist singular label plural label theu800 resulting template takes pagename & label parameters normally. function pu800u82elabelledlist frame marguments require 'module arguments local labels frameu82eargs 1u800 oru800 defaultsu82elabel labels 2u800 frameu82eargs 2u800 oru800 labels 1u800 labels 3u800 frameu82eargs 3u800 nou800 defaulting labels 4u800 frameu82eargs 4u800 nou800 defaulting local template frame getparent gettitle local args margumentsu82egetargs frame parentonly true local pages pu800u82epreprocessdisplays args local options extraclasses frameu82eargsu82eextraclasses category argsu82ecategory selfref frameu82eargsu82eselfref oru800 argsu82eselfref template template return pu800u82e_labelledlist pages labels options endu800 function pu800u82e_labelledlist pages labels options labels labels oru800 ifu800 #pages 0u800 then return mhatnoteu82emakewikitexterror 'u8d986u8d8a7u8d985 u8d8b5u8d981u8d8adu8d987 u8d985u8d8b4u8d8aeu8d8b5 u8d986u8d8b4u8d8afu8d987u8e2808cu8d8a7u8d8b3u8d8aa' optionsu82etemplate oru800 defaultsu82etemplate .. '#u8d8aeu8d8b7u8d8a7u8d987u8d8a7' optionsu82ecategory endu800 label #pages 1u800 andu800 labels 1u800 oru800 labels 2u800 oru800 defaultsu82elabel foru800 ku800 vu800 inu800 pairs pages dou800 ifu800 mhatnoteu82efindnamespaceid vu800 0u800 then label #pages 1u800 andu800 labels 3u800 oru800 labels 1u800 oru800 defaultsu82elabel oru800 labels 4u800 oru800 labels 2u800 oru800 defaultsu82elabel oru800 defaultsu82elabel endu800 endu800 local text mwu800u82eustringu82eformat optionsu82elabelform oru800 defaultsu82elabelform label mhatlistu82eandlist pages true local hnoptions extraclasses optionsu82eextraclasses selfref optionsu82eselfref return mhatnoteu82e_hatnote text hnoptions endu800 return pu800 