 module hatnote this module produces hatnote links andu800 links tou800 related articles. itu800 implements theu800 hatnote andu800 format link meta templates andu800 includes helper functions foru800 other luau800 hatnote modules. local libraryutil require 'libraryutil' local checktype libraryutilu82echecktype local checktypefornamedarg libraryutilu82echecktypefornamedarg local marguments lazily initialise module arguments local yesno lazily initialise module yesno local formatlink lazily initialise module format link ._formatlink local pu800 helper functions local curns mwu800u82etitleu82egetcurrenttitle .namespace pu800u82emissingtargetcat default missing target category exported foru800 useu800 inu800 related modules curns 0u800 oru800 curns 14u800 andu800 'u8d985u8d982u8d8a7u8d984u8d987u8e2808cu8d987u8d8a7u8db8c u8d8afu8d8a7u8d8b1u8d8a7u8db8c u8d8a7u8d984u8daafu8d988u8d987u8d8a7u8db8c u8d8b3u8d8b1u8d986u8d988u8db8cu8d8b3 u8d8a8u8d8a7 u8d8b5u8d981u8d8adu8d987 u8d987u8d8afu8d981 u8d986u8d8a7u8d985u8d988u8d8acu8d988u8d8af' oru800 nilu800 local function getargs frame fetches theu800 arguments from theu800 parent frame. whitespace isu800 trimmed andu800 blanks areu800 removed. marguments require 'module arguments return margumentsu82egetargs frame parentonly true endu800 local function removeinitialcolon su800 removes theu800 initial colon from au800 string ifu800 present. return mwu800u82eustringu82ematch su800 ' .* ' endu800 function pu800u82efindnamespaceid link removecolon finds theu800 namespace idu800 namespace number ofu800 au800 link oru800 au800 pagename. this function will notu800 work ifu800 theu800 link isu800 enclosed inu800 double brackets. colons areu800 trimmed from theu800 start ofu800 theu800 link byu800 default. tou800 skip colon trimming setu800 theu800 removecolon parameter tou800 false. checktype 'findnamespaceid' 1u800 link 'string' checktype 'findnamespaceid' 2u800 removecolon 'boolean' true ifu800 removecolon false then link removeinitialcolon link endu800 local namespace mwu800u82eustringu82ematch link ' . ' ifu800 namespace then local nstable mwu800u82esiteu82enamespaces namespace ifu800 nstable then return nstableu82eidu800 endu800 endu800 return 0u800 endu800 function pu800u82emakewikitexterror msgu800 helplink addtrackingcategory title formats anu800 error message tou800 beu800 returned tou800 wikitext. ifu800 addtrackingcategory isu800 notu800 false after being returned from module yesno andu800 ifu800 weu800 areu800 notu800 onu800 au800 talk page au800 tracking category isu800 added. checktype 'makewikitexterror' 1u800 msgu800 'string' checktype 'makewikitexterror' 2u800 helplink 'string' true yesno require 'module yesno' title title oru800 mwu800u82etitleu82egetcurrenttitle make theu800 help link text. local helptext ifu800 helplink then helptext ' ' .. helplink .. ' u8d8b1u8d8a7u8d987u8d986u8d985u8d8a7 ' else helptext   endu800 make theu800 category text. local category ifu800 notu800 titleu82eistalkpage donu800'tu800 categorise talk pages andu800 titleu82enamespace 2u800 donu800'tu800 categorise userspace andu800 yesno addtrackingcategory false allow opting outu800 then category 'u8d8a7u8d984u8daafu8d988 u8d8b3u8d8b1u8d986u8d988u8db8cu8d8b3 u8d987u8d985u8d8b1u8d8a7u8d987 u8d8aeu8d8b7u8d8a7' category mwu800u82eustringu82eformat ' su800 su800 ' mwu800u82esiteu82enamespaces 14u800 .name category else category   endu800 return mwu800u82eustringu82eformat ' u8d8aeu8d8b7u8d8a7 su800 su800. su800' msgu800 helptext category endu800 function pu800u82edisambiguate page disambiguator formats au800 page title with au800 disambiguation parenthetical iu800u82eeu800. "example" u8e28692 "example disambiguation ". checktype 'disambiguate' 1u800 page 'string' checktype 'disambiguate' 2u800 disambiguator 'string' true disambiguator disambiguator oru800 'u8d8a7u8d8a8u8d987u8d8a7u8d985u8e2808cu8d8b2u8d8afu8d8a7u8db8cu8db8c' return mwu800u82eustringu82eformat ' su800 su800 ' page disambiguator endu800 hatnote produces standard hatnote text. implements theu800 hatnote template. function pu800u82ehatnote frame local args getargs frame local su800 args 1u800 ifu800 notu800 su800 then return pu800u82emakewikitexterror 'u8d985u8d8aau8d986u8db8c u8d8aau8d8b9u8d8b1u8db8cu8d981 u8d986u8d8b4u8d8afu8d987u8e2808cu8d8a2u8d8b3u8d8aa' 'u8d8a7u8d984u8daafu8d988 u8d8b3u8d8b1u8d986u8d988u8db8cu8d8b3#u8d8aeu8d8b7u8d8a7u8d987u8d8a7' argsu82ecategory oru800 args 'u8d8b1u8d8afu8d987' endu800 return pu800u82e_hatnote su800 extraclasses argsu82eextraclasses oru800 args 'u8daa9u8d984u8d8a7u8d8b3u8e2808cu8d987u8d8a7u8db8c u8d8a8u8db8cu8d8b4u8d8aau8d8b1' selfref argsu82eselfref oru800 args 'u8d8aeu8d988u8d8afu8d8a7u8d8b1u8d8acu8d8a7u8d8b9' endu800 function pu800u82e_hatnote su800 options checktype '_hatnote' 1u800 su800 'string' checktype '_hatnote' 2u800 options 'table' true options options oru800 local inline optionsu82einline local hatnote mwu800u82ehtmlu82ecreate inline 1u800 andu800 'span' oru800 'divu800' local extraclasses ifu800 type optionsu82eextraclasses 'string' then extraclasses optionsu82eextraclasses endu800 hatnote attr 'role' 'note' addclass inline 1u800 andu800 'hatnote inline' oru800 'hatnote' addclass 'navigation notu800 searchable' addclass extraclasses addclass optionsu82eselfref andu800 'selfref' wikitext su800 return mwu800u82egetcurrentframe extensiontag name 'templatestyles args srcu800 'u8d9beu8d988u8d8afu8d985u8d8a7u8d986 hatnote stylesu82ecssu800 .. tostring hatnote endu800 return pu800 