Module:Sandbox/Jts1882/Biota infobox
Appearance
From Wikipedia, the free encyclopedia
This is the current revision of this page, as edited by Shonebrooks (talk | contribs) at 15:40, 5 September 2024 (I corrected the spelling of "system." WP:TYPO). The present address (URL) is a permanent link to this version.Revision as of 15:40, 5 September 2024 by Shonebrooks (talk | contribs) (I corrected the spelling of "system." WP:TYPO)
This module started out as a quick module for template {{paraphyletic group }}, but has morphed into a module to emulate the {{taxobox/core }}. Handling for templates that call the core has been added for {{taxobox }}, {{Automatic taxobox }} and {{Speciesbox }}, but is incomplete.
Data subpages
Examples:
- User:Jts1882/sandbox/test/taxobox (paraphyletic group version)
- User:Jts1882/sandbox/test/taxobox/manual (manual taxobox version)
- User:Jts1882/sandbox/test/taxobox/auto (automatic taxobox version)
- User:Jts1882/sandbox/test/taxobox/species (speciesbox version)
- User:Jts1882/sandbox/test/taxobox/infra (subspeciesbox and infraspeciesbox versions)
Usage
[edit ]{{#invoke:Sandbox/Jts1882/Biota_Infobox|function_name}}
Several functions provide different entry points for development purposes:
- main - all the options,
- core - emulates the core but uses other taxobox templates to pass parameters to the core
- automatictaxobox - emulates {{automatic taxobox }} with parameter validation, but still uses the {{Taxobox/core }} template
- TODO add similar entry point for speciesbox, subspeciesbox, infraspeciesbox, etc
The above documentation is transcluded from Module:Sandbox/Jts1882/Biota infobox/doc. (edit | history)
Editors can experiment in this module's sandbox (create | mirror) and testcases (create) pages.
Subpages of this module.
Editors can experiment in this module's sandbox (create | mirror) and testcases (create) pages.
Subpages of this module.
require('strict') -- All Lua modules on Wikipedia must begin by defining a variable that will hold their -- externally accessible functions. They can have any name and may also hold data. localp={}-- exposed variables localg={}-- these are variables with global scope in this module localinfo={}-- contains general purpose information (e.g. header background colour) info.debug=true-- ONLY SET THIS WHILE TESTING --local paramData = require( 'Module:Sandbox/Jts1882/Biota infobox/data' ) -- contains the taxon ranks in order --local autotaxa = require("Module:Sandbox/Jts1882/Biota infobox/Autotaxobox") --local autotaxa = require("Module:Autotaxobox") localparameters=require('Module:Sandbox/Jts1882/Biota infobox/param') localcore=require('Module:Sandbox/Jts1882/Biota infobox/core') -- ######################### PARAMETER HANDLING ############################ localtemplateArgs={}-- contains preprocessed arguments from calling template --TODO use info.args instead of templateArgs? -- ########################### MAIN AND OTHER ENTRY FUNCTIONS ################################## --[[ main function callable in Wikipedia via the #invoke command. creates a taxobox-style infobox handles preliminary parameter handling enulating taxobox and automatic taxobox templates -- the parameters are also checked for content, alias, valid names and valid combinations -- the parameter handling is in subpage Module:Sandbox/Jts1882/Biota Infobox/param these are passed the core function -- the core function emulates the template {{Taxobox/core}) -- the function is found in subpage Module:Sandbox/Jts1882/Biota Infobox/core -- the core them creates the taxobox creates main table and header section (with header, subheader and fossil ranges) adds addition rows for template arguments with following subsidiary functions: p.addImageSection() - images and range maps p.addStatusSection() - conservation status p.addTaxonomySection() - listing of taxonomic heirarchy (manuel or using automatic taxonomy system) p.addTaxonSection() - adds section with taxonomic information (binomial or trinomials; type genus or species; diversity) p.addListSection() - section containing list if subdivisions, synonyms, included or excluded groups --]] p.main=function(frame) --p.getArgs(frame) parameters.getArgs(frame,templateArgs,info)-- gets arguments, checks for value, aliases, and against valid parameter list ifinfo.autothen p.AutomaticTaxoboxOptions(frame)-- this emulates the automatic taxobox templates that feed the core else --[[TODO manual taxobox options: name or use Template:Taxonomy name |genus|species|binomial name colour = p.getTaxoboxColor(frame) ]] end --return p._core(frame) returncore.core(frame,templateArgs,info) end -- this functions emulates Template:automatic taxobox and uses Template:Taxobox/core p.auto=function(frame) --info.auto = frame.args.auto or "automatictaxobox" p.getArgs(frame)-- gets arguments, checks for value, aliases, and against valid parameter list ifinfo.autothen p.AutomaticTaxoboxOptions(frame)-- this emulates the automatic taxobox templates that feed the core end -- additional parameters needed by Template:Taxobox/core templateArgs['edit link']="edit taxonomy" templateArgs['colour']=p.getTaxoboxColor(frame) templateArgs['upright']=templateArgs['image_upright']or1 templateArgs['upright2']=templateArgs['image2_upright']or1 -- use Template:Taxobox/core returntostring(frame:expandTemplate{title='taxobox/core',args=templateArgs}) end --[[ ##################### CORE FUNCTIONS ################################### this core function emulates Template:Taxobox/core it is followed by functions handling the different type of entry MOVED to subpage Module:Sandbox/Jts1882/Biota_Infobox/core ]] -- ################## AUTOMATIC TAXOBOX SYSTEM HANDLING ################################ ------------------------------------------------------------------------------------------------ -- handle specific requirements of different options: auto, speciesbox etc functionp.AutomaticTaxoboxOptions(frame) --TODO replace genus with first word (genus) to strip parenthetic term -- done in speciesbox? templateArgs['display_taxa']=templateArgs['display_parents']or1-- note change of parameter name localextinct="" iftemplateArgs['extinct']then --extinct = "†" extinct=frame:expandTemplate{title='extinct'}-- use template to get tooltip -- speciesbox also checks the genus taxonomy template for extinct parameter end ---------------------variables for SPECIESBOX, SUBSPECIESBOX and INFRASPECIESBOX--------------------- ifinfo.auto=="hybridbox"then --templateArgs['parent'] = templateArgs['parent'] or templateArgs['genus'] or templateArgs['genus1'] localspecies1=templateArgs['species']ortemplateArgs['species1']ortemplateArgs['father']ortemplateArgs['father_species'] localspecies2=templateArgs['species2']ortemplateArgs['mother']ortemplateArgs['mother_species']ortemplateArgs['species'] localgenus1=templateArgs['genus']ortemplateArgs['genus1']ortemplateArgs['father_genus']-- TODO use page localgenus2=templateArgs['genus2']ortemplateArgs['mother_genus']ortemplateArgs['genus'] localspecies3=templateArgs['species3']or"" localgenus3=templateArgs['genus3']ortemplateArgs['genus']or"" localsubspecies1,subspecies2,subspecies3="","","" --if (templateArgs['subspecies1'] and templateArgs['subspecies2']) iftemplateArgs['subspecies1']ortemplateArgs['subspecies2'] or(templateArgs['father_subspecies']andtemplateArgs['mother_subspecies'])then subspecies1=" "..((templateArgs['subspecies1']ortemplateArgs['father_subspecies'])or"") subspecies2=" "..((templateArgs['subspecies2']ortemplateArgs['mother_subspecies'])or"") iftemplateArgs['subspecies3']then subspecies3=" "..templateArgs['subspecies3'] species3=species1 end end locallink1=templateArgs['link1']ortemplateArgs['father_link']or(genus1.." "..species1..subspecies1) locallink2=templateArgs['link2']ortemplateArgs['mother_link']or(genus2.." "..species2..subspecies2) locallink3=templateArgs['link3']or(genus3.." "..species3..subspecies3) ifnottemplateArgs['parent']thentemplateArgs['parent']=genus1end --TODO disambiguate genus pages -- not needed unless using page name --genus1 = frame:expandTemplate{ title = 'Speciesbox/getGenus' , args = {"", genus1 } } -- genus2 = frame:expandTemplate{ title = 'Speciesbox/getGenus' , args = {"", genus2 } } ifnottemplateArgs['genus2']andnottemplateArgs['father_genus']then genus1=string.sub(genus1,1,1).."."-- shorten generic names for intrageneric hybrids genus2=string.sub(genus2,1,1).."." genus3=string.sub(genus3,1,1).."." end -- shorten species name if subspecies of same species ifsubspecies1~=""andnottemplateArgs['species2']then species1=string.sub(species1,1,1).."."-- shorten specific epithet for intraspecific hybrids species2=string.sub(species2,1,1).."." ifsubspecies3~=""thenspecies3=string.sub(species3,1,1).."."end end localmaleSymbol,femaleSymbol="","" iftemplateArgs['father']ortemplateArgs['father_genus']ortemplateArgs['father_species']ortemplateArgs['father_subspecies']thenmaleSymbol="♂"end iftemplateArgs['mother']ortemplateArgs['mother_genus']ortemplateArgs['mother_species']ortemplateArgs['mother_subspecies']thenfemaleSymbol="♀"end templateArgs['hybrid']="'''''[["..link1.."|"..genus1.." "..species1..subspecies1.."]]'''''"..maleSymbol .." ×ばつ " .."'''''[["..link2.."|"..genus2.." "..species2..subspecies2.."]]'''''"..femaleSymbol ifspecies3~=""then templateArgs['hybrid']=templateArgs['hybrid'].." ×ばつ " .."'''''[["..link3.."|"..genus3.." "..species3..subspecies3.."]]'''''" end --templateArgs['hybrid species'] = templateArgs['hybrid'] ifsubspecies1~=""andnottemplateArgs['species2']then templateArgs['species']="''[["..templateArgs['genus'].." "..templateArgs['species'].."|" ..genus1.." "..templateArgs['species'].."]]''" elsetemplateArgs['species']=nil end templateArgs['offset']=1 -- ======================= setup for SPECIESBOX ============================= elseifinfo.auto=="speciesbox"then --[[ {{speciesbox}} gets genus and species from taxon, genus+species or page name 1. uses 'taxon' paramter ( given as binomial) if available 2. otherwise uses 'genus' and 'species' parameters 3. uses page name the genus is used for the 'parent' taxon unless the parent is supplied (e.g. for subgenus) else use genus (from taxon or genus parameter or page name) {{Speciesbox}} now using {{Speciesbox/getGenus}} and {Speciesbox/getSpecies}} code doing similar is commented out below TODO use {{{{Speciesbox/name}} --]] localgenus,species="","" genus=frame:expandTemplate{title='Speciesbox/getGenus',args={templateArgs['taxon'],templateArgs['genus']}} species=frame:expandTemplate{title='Speciesbox/getSpecies',args={templateArgs['taxon'],templateArgs['genus']}} iftemplateArgs['taxon']then -- following line disableas using getGenus/getSpecies templates -- genus, species = string.match(templateArgs['taxon'], "(%S+)%s(%S+)") -- %S: All characters not in %s templateArgs['genus']=genus templateArgs['species']=species elseiftemplateArgs['genus']andtemplateArgs['species']then --[[strip off (disambiguator) to handle multi-kingdom genus e.g.| genus = Acanthocarpus (plant) local genusParts =mw.text.split( templateArgs['genus'], " ", true ) -- string.match( s, '^%a*'', 1 ) if genusParts[1] ~= "" then --templateArgs['parent']=templateArgs['genus'] -- set parent (NO, parent should override) genus = genusParts[1] end now handled by getGenus/getSpecies templates --]] templateArgs['taxon']=genus..' '..templateArgs['species'] else -- TODO no valid taxon yet; use page name -- use first word of pagename - handled by {{Speciesbox/getGenus}} end ifnottemplateArgs['parent']ortemplateArgs['parent']==""then templateArgs['parent']=templateArgs['genus']-- set parent to genus if not supplied end --[[if not templateArgs['name'] or templateArgs['name'] == "" then -- if page name not set templateArgs['name'] = "''" .. templateArgs['taxon'] .. "''" end ]] --TODO use {{Speciesbox/name}} templateArgs['name']=frame:expandTemplate{title='Speciesbox/name', args={templateArgs['name'],templateArgs['taxon'], templateArgs['genus'],templateArgs['species'], mw.title.getCurrentTitle().baseText, templateArgs['italic_title'or'yes'] }} -- set binomial : the speciesbox template seems to use genus and species before taxon name -- "| binomial = ''{{Str letter/trim|{{{genus|{{{taxon|<includeonly>{{PAGENAME}}</includeonly><noinclude>Acacia</noinclude>}}}}}}}} {{{species|{{remove first word|{{{taxon|<includeonly>{{PAGENAMEBASE}}</includeonly><noinclude>Acacia aemula</noinclude>}}}}}}}}''" -- documentation suggest taxon, which is followed here templateArgs['binomial']="''"..templateArgs['taxon'].."''" templateArgs['binomial_authority']=templateArgs['authority']ornil -- set species_name e.g. Panthera leo -> P. leo templateArgs['species_name']=extinct.."'''''"..string.sub(templateArgs['genus'],1,1)..'. '..templateArgs['species'].."'''''" templateArgs['species']=templateArgs['species_name'] templateArgs['display_taxa']=templateArgs['display_taxa']-1 templateArgs['offset']=1 iftemplateArgs['subgenus']andtemplateArgs['subgenus']~=""then templateArgs['offset']=templateArgs['offset']+1 templateArgs['subgenus_authority']=templateArgs['parent_authority']or"" end --templateArgs['species_authority'] = templateArgs['authority'] or "" -- don't show species_authority as duplicates binomial authority --[[shift authorities for speciesbox (two steps if subgenus set) if templateArgs['subgenus'] and templateArgs['subgenus'] ~= "" then templateArgs['subgenus_authority'] = templateArgs['parent_authority'] or "" templateArgs['authority'] = templateArgs['grandparent_authority'] or "" templateArgs['parent_authority'] = templateArgs['greatgrandparent_authority'] or "" templateArgs['grandparent_authority'] = templateArgs['greatgreatgrandparent_authority'] or "" templateArgs['greatgrandparent_authority'] = templateArgs['greatgreatgreatgrandparent_authority'] or "" templateArgs['greatgreatgrandparent_authority'] = templateArgs['greatgreatgreatgreatgrandparent_authority'] or "" else -- note: must set to "" if 'parent_authority's don't exist, otherwise the value of 'authority' is unchanged templateArgs['authority'] = templateArgs['parent_authority'] or "" templateArgs['parent_authority'] = templateArgs['grandparent_authority'] or "" templateArgs['grandparent_authority'] = templateArgs['greatgrandparent_authority'] or "" templateArgs['greatgrandparent_authority'] = templateArgs['greatgreatgrandparent_authority'] or "" templateArgs['greatgreatgrandparent_authority'] = templateArgs['greatgreatgreatgrandparent_authority'] or "" end ]] templateArgs['taxon']=nil-- For auto module -- ===================== set-up for SUBSPECIESBOX or INTRASPECIESBOX ================= elseifinfo.auto=="subspeciesbox"orinfo.auto=="infraspeciesbox"then --[[ From template description: "The genus name, species name and subspecies name" [or "genus name, specific epithet and infraspecific epithet"] " must be supplied separately: the combined taxon parameter cannot be used."" "The genus name is then the entry into the taxonomic hierarchy."" The trinomial name is set from these parameters and the parameter ignored. --NOTE no infraspeciebox is currently using trinomial parameter --]] -- Parameter checking. This could be here or moved to parameter checking function iftemplateArgs['genus']andtemplateArgs['species']andtemplateArgs['subspecies']then -- valid parameters for subspecies (may have variety as well) elseiftemplateArgs['genus']andtemplateArgs['species']andtemplateArgs['variety']then -- valid parameters for infraspecies (variety without subspecies) else -- insufficient parameters -- TODO add error message and return end localoffset=2-- authority offset when subpecies OR variety --TODO strip genus of disambiguator (need to check this works) localgenus=mw.text.split(templateArgs['genus']," ",true) ifgenus[1]~=""then templateArgs['genus']=genus[1] end templateArgs['parent']=templateArgs['genus']-- genus must be supplied localfullName=templateArgs['genus']..' '..templateArgs['species'] templateArgs['species_name']="''[["..fullName..'|'..string.sub(templateArgs['genus'],1,1)..'. '..templateArgs['species'].."]]''" -- if subspecies is set (could be with or without variety) localseparator=" "-- subspecies separator (default zoological) iftemplateArgs['subspecies']then-- might not be if variety ifinfo.auto=="infraspeciesbox"thenseparator=" ''<small>subsp.</small>'' "end templateArgs['subspecies_name']=extinct.."'''''"..string.sub(templateArgs['genus'],1,1)..'. '..string.sub(templateArgs['species'],1,1)..'.'..separator..templateArgs['subspecies'].."'''''" fullName=templateArgs['genus']..' '..templateArgs['species']..separator..templateArgs['subspecies'] templateArgs['trinomial']="''"..fullName.."''" --templateArgs['subspecies_authority'] = templateArgs['authority'] -- replicates authoity in trinomial (unwanted?) end iftemplateArgs['variety']ortemplateArgs['varietas']then-- should now be aliased localvSeparator=" ''<small>var.</small>'' " --alias done? templateArgs['variety']= templateArgs['variety'] or templateArgs['varietas'] -- will use variety as parameter TODO alias this templateArgs['variety_name']=extinct.."'''''"..string.sub(templateArgs['genus'],1,1)..'. '..string.sub(templateArgs['species'],1,1)..'.'..vSeparator..templateArgs['variety'].."'''''" templateArgs['trinomial']="''"..templateArgs['genus']..' '..templateArgs['species']..vSeparator..templateArgs['variety'].."''" --templateArgs['variety_authority'] = templateArgs['authority'] -- replicates authority in trinomial iftemplateArgs['subspecies']then-- subspecies needs to linked instead of bold localredirectName=templateArgs['genus']..' '..templateArgs['species'].." subsp. "..templateArgs['subspecies'] localshortName="''"..string.sub(templateArgs['genus'],1,1)..'. '..string.sub(templateArgs['species'],1,1)..'.'..separator..templateArgs['subspecies'].."''" templateArgs['subspecies_name']="[["..redirectName..'|'..shortName.."]]" offset=offset+1-- offset when susbpecies AND variety templateArgs['subspecies_authority']=templateArgs['parent_authority'] end end --TODO what else do subspeciesbix and infraspeciesbox cover?) --[[ code from templates both: |trinomial_authority = {{{authority|{{{trinomial authority|{{{trinomial_authority|}}} }}} }}} infraspeciesbox: |species_authority = {{{parent_authority|{{{parent authority|{{{binomial authority|{{{binomial_authority|}}}}}}}}}}}} subspeciesbox: | species_authority = {{{parent authority|{{{binomial authority|{{{binomial_authority|}}}}}}}}} note: subspeciesbox doesn't recognise patent_authority with underscore monthly reports on subspeciesbox and infraspeciesbox no uses of parent_authority, binomial_authority or trinomial authority no uses of grandparent, greatgrandparent etc authorites ]] templateArgs['trinomial_authority']=templateArgs['authority']ornil ifnottemplateArgs['name']ortemplateArgs['name']==""then-- if page name not set templateArgs['name']=templateArgs['trinomial'] end -- these are used by manual taxobox to complete the taxonomy table templateArgs['species']=templateArgs['species_name'] templateArgs['subspecies']=templateArgs['subspecies_name'] templateArgs['variety']=templateArgs['variety_name'] --QUESTION what happens to parent taxa when subspecies and variety? -- set species and subgenus authorities iftemplateArgs['subgenus']then offset=offset+1 ifoffset==4then-- when subgenus, species, subspecies and variety templateArgs['subgenus_authority']=templateArgs['subgenus_authority']ortemplateArgs['greatgrandparent_authority']or"" templateArgs['species_authority']=templateArgs['grandparent_authority']or"" elseifoffset==3then-- when subgenus, species, (subspecies OR variety) templateArgs['subgenus_authority']=templateArgs['subgenus_authority']ortemplateArgs['grandparent_authority']or"" templateArgs['species_authority']=templateArgs['parent_authority']or"" end else-- only need to set species authority or subspecues (if also variety) ifoffset==3then-- species, subspecies and variety templateArgs['species_authority']=templateArgs['grandparent_authority']or"" templateArgs['subspecies_authority']=templateArgs['parent_authority']or"" elseifoffset==2then-- species, (subspecies or variety) templateArgs['species_authority']=templateArgs['parent_authority']or"" end end templateArgs['display_taxa']=(templateArgs['display_taxa']or1)-2 templateArgs['offset']=offset -- need to set subgenus_authority, species_authority, subspecies_authority and variety_authority --[[shift authorities for subspeciesbox (two steps or three if subgenus set) if templateArgs['subgenus'] and templateArgs['subgenus'] ~= "" then templateArgs['subgenus_authority'] = templateArgs['grandparent_authority'] or "" templateArgs['authority'] = templateArgs['greatgrandparent_authority'] or "" templateArgs['parent_authority'] = templateArgs['greatgreatgrandparent_authority'] or "" templateArgs['grandparent_authority'] = templateArgs['greatgreatgreatgrandparent_authority'] or "" templateArgs['greatgrandparent_authority'] = templateArgs['greatgreatgreatgreatgrandparent_authority'] or "" templateArgs['greatgreatgrandparent_authority'] = templateArgs['greatgreatgreatgreatgreatgrandparent_authority'] or "" else templateArgs['authority'] = templateArgs['grandparent_authority'] or "" templateArgs['parent_authority'] = templateArgs['greatgrandparent_authority'] or "" templateArgs['grandparent_authority'] = templateArgs['greatgreatgrandparent_authority'] or "" templateArgs['greatgrandparent_authority'] = templateArgs['greatgreatgreatgrandparent_authority'] or "" templateArgs['greatgreatgrandparent_authority'] = templateArgs['greatgreatgreatgreatgrandparent_authority'] or "" end ]] -- ========================= setup for AUTOMATIC TAXOBOX ================================ -- CHECK authomatic taxobox pagename overrides taxon (e.g. Tortrix? destructus) for header -- it does but no italics in header for Tortrix? destructus --elseif info.auto == "automatictaxobox" then elseifinfo.auto=="virus"orinfo.auto=="virusbox"then templateArgs['virus']="yes" templateArgs['color_as']="Virus" ifnottemplateArgs['parent']then iftemplateArgs['taxon']then templateArgs['parent']=templateArgs['taxon'] elseiftemplateArgs['species']then templateArgs['parent']=templateArgs['species'] templateArgs['species']=nil else templateArgs['parent']=tostring(mw.title.getCurrentTitle())or"" end else templateArgs['link_parent']="yes"-- if parent given, we want to link it end else -- "the automated taxobox first looks for the taxonomy template that matches the supplied |taxon= parameter " -- "(or, if none is supplied, the article's title, ignoring any parenthetical expressions). " ifnottemplateArgs['taxon']ortemplateArgs['taxon']==""then --templateArgs['taxon'] = templateArgs['name'] or tostring( mw.title.getCurrentTitle()) templateArgs['taxon']=tostring(mw.title.getCurrentTitle())or"" --TODO strip name of parenthetical terms off page title iftemplateArgs['taxon']~=""then --TODO error message and exit end end iftemplateArgs['parent']then templateArgs['link_parent']="yes"-- if parent given, we want to link it else templateArgs['parent']=templateArgs['taxon']-- otherwise set parent end --TODO set name if parameter no supplies --[[ TODO if no taxonomy template, then call setup taxonomy template {{#ifexist:Template:Taxonomy/{{{taxon|<includeonly>{{PAGENAME}} {{Automatic taxobox/floating intro|taxon={{{taxon|{{PAGENAME}}}}} }} ]] end-- end special handling for speciesbox, subspeciesbox, and automatic taxobox -- check taxonomy templates for automatic taxobox system --{{#ifexist:Template:Taxonomy/{{{taxon|<includeonly>{{PAGENAME}}</includeonly><noinclude>Acacia</noinclude>}}} -- |<noinclude><!--do nothing if it exists--></noinclude> -- |{{Automatic taxobox/floating intro|taxon={{{taxon|{{PAGENAME}}}}} }} -->}} end ------------------------------------------------------------------- functionp.templateStyle(frame,src) returnframe:extensionTag('templatestyles','',{src=src}); end ----------------------------------------- functionp.testTables(frame) if1==1thenreturnend-- disable localroot=mw.html.create('table'):addClass('wikitable') localrow=root:tag('tr')-- add row using lua library localcell=row:tag('td') cell:wikitext('row A:') cell=row:tag('td'):wikitext('content A') row=root:tag('tr')-- add row using lua library cell=row:tag('td'):wikitext('row B:') cell=row:tag('td') :wikitext('\n{|\n|-\n|P\n|Q\n|}')--but include a wikitxt table in one cell -- :done() -- row:done() --root=mw.html:allDone() root:wikitext('<tr><td>a</td><td>b</td></tr>')-- add row to root using html root:wikitext('\n|-\n|X\n|Y\n')-- add row to root using wikitext (FAILS) root:wikitext('\r|-\r|I\r|J\r')-- FAIL output |- |X |Y root:wikitext(frame:preprocess('\n|-\n|U\n|V\n'))-- FAIL output |- |U |V root:wikitext('<tr>\n|M\n|N\n</tr>') row=root:tag('tr'):node('<td>c</td><td>d</td>')-- adds row successfully row=root:tag('tr'):node('\n|Xc\n|Xd\n')-- fails to adds row row=root:tag('tr')-- add another row using lua library cell=row:tag('td'):wikitext('row C:') cell=row:tag('td'):wikitext('content C') root:node('\n{|\n|-\n|Xx\n|Yx\n|}\n')-- adds new table after --frame:preprocess returntostring(root) --[[ CONCLUSION: cannot mix wikitext freely in the node structure A complete wikitext table can be included in a cell (e.g. used for automatic taxonomy now) An alternative is to use wikitext for the whole taxobox table ]] end -- --------------------------- TEST AUTO TAXONOMY FUNCTIONS ----------------------------- functionp.test(frame) locala=require("Module:Sandbox/Jts1882/Biota infobox/auto") --local taxonTable = a.loadTaxonomyTable(frame) now done in showTaxonomyTable returna.showTaxonomyTable(frame) end -- All modules end by returning the variable containing its functions to Wikipedia. returnp