Module talk:Hexasoft-outils
Description of this module
[edit]This module is a toolbox for taxobox module. It don't have any function callable using {{#invoke}} command.
It gives several general-purpose functions for treating data and all the functions that treat the entries that compound a taxobox.
What it depend on
[edit]This module requires some other modules to work:
- Module:Taxobox-data: externalized data related to taxobox (parameters, classification levels, …)
- Module:Taxobox-briques: generic functions to create infobox elements (titles, sub-title, data table, image…)
List of general-purpose functions
[edit]These functions are often used, so I put them here.
- decoupe_homonymie(nom): this function takes a name (a title) and cut it into two parts: the main title and the homonymy part (the one beetween parenthesis). Returns a table with t[1] the title and t[2] the homonymy. If no homonymy t[1]=nom and t[2]=nil. Note the the space(s) beetween title and homonymy is removed.
- nettoie(nom): cleanup the given string. It removes the trailing and leading spaces that may be present, which is the case for unamed parameters sent to a module. Returns the cleaned string
- formate_ns(regne, rang, nom, html, lien): formats the typography of scientific name nom with respect to the conventions that apply in regnum regne and for the classification level rang. If html is true the typography is generated in HTML (for article title modification) ; if lien is true the corresponding name is returned as a wikilink. This function handles to put name in italic if needed. It also handles the homonymy part of the name (if any) and it handles the presence of hybrid notation × which should not be in italic.
- t_entete_classification(texte): add the start of a classification list. This function should be in "Module:Taxobox-briques and not here.
List of taxobox entries functions
[edit]Note: at this time these functions all have a trailing "2" in their names. This will be removed and exists only because of a large code rewriting (which is now mostly over).
All these functions get a "params" parameter, which is a table containing all the line format elements given. The other parameters are from the main module and gives some constante data, and they will be grouped in a "environnement" table.
- t_debut(params, div_nb, table_nb, regne, article, no_cat):
- t_phylo_inexistant(params, div_nb, table_nb, regne, article, no_cat)
- t_phylo_bandeau(params, div_nb, table_nb, regne, article, no_cat)
- t_uicn(params, div_nb, table_nb, regne, article, no_cat)
- t_cites(params, div_nb, table_nb, regne, article, no_cat)
- t_fin(params, div_nb, table_nb, regne, article, no_cat)
- t_rang(params, div_nb, table_nb, regne, article, no_cat)
- t_taxon(params, div_nb, table_nb, regne, article, no_cat)
- t_position(params, div_nb, table_nb, regne, article, no_cat)
- t_synonymes(params, div_nb, table_nb, regne, article, no_cat)
- t_taxons(params, div_nb, table_nb, regne, article, no_cat)
- t_image(params, div_nb, table_nb, regne, article, no_cat)
- t_repartition(params, div_nb, table_nb, regne, article, no_cat)
- t_legende(params, div_nb, table_nb, regne, article, no_cat)
- t_repartition_legende(params, div_nb, table_nb, article, no_cat)
- t_conflit(params, div_nb, table_nb, regne, ns_article, sans_cat)
Other
[edit]This module also provides a table that handles the syntax of the taxobox: d_syntaxe.
Lines of this table contains:
- as table key access: the keyword of the taxobox syntax that defines the entry. It is the element that triggers using the line.
- as 1st element: an integer that should be 0, 1 or 2. It controls the way errors are treated when parsing/treating this line. 0 means ignore errors (this one is in fact not implemented: it is mostly impossible to ignore the error). 1 means drop the entry in case of error, generates an error description and continue with the rest of the lines. 2 means that an error is fatal and taxobox generation should be stopped here.
- as 2nd element: the format description of the line (which is a table). Line formats are defined in "Module:Taxobox-data"
- as 3rd element: the function to call to treat the corresponding line. These functions are the one explained previously.
The function syntaxe_ligne(cle) is the access function to these entries.