Saintapedia:Template documentation: Difference between revisions

Line 30: Line 30:


1. Create the Documentation Subpage:
1. Create the Documentation Subpage:
* Navigate to `Template:<TemplateName>/doc` (e.g., `Template:Infobox saint/doc`).
* Navigate to `Template:<TemplateName>/doc` (e.g., `Template:Infobox saint/doc`).
* If it doesn’t exist, create the page by editing it.
* If it doesn’t exist, create the page by editing it.
* Add `{{tlx|Documentation subpage}}` at the top.
* Add `{{tlx|Documentation subpage}}` at the top.
2. Structure the Documentation:
2. Structure the Documentation:
Use the following standard format:
 
* Purpose: Describe what the template does (e.g., “Displays a standardized infobox for saint biographies”).
Use the following standard format:
* Usage: Provide the basic syntax (e.g., `{{tlx|TemplateName|parameter1|parameter2}}`).
* Purpose: Describe what the template does (e.g., “Displays a standardized infobox for saint biographies”).
* Parameters: List all parameters, their purpose, and whether they are optional or required. Use a table or bullet points for clarity.
* Usage: Provide the basic syntax (e.g., `{{tlx|TemplateName|parameter1|parameter2}}`).
* Examples: Show how the template renders with sample inputs.
* Parameters: List all parameters, their purpose, and whether they are optional or required. Use a table or bullet points for clarity.
* Notes: Highlight dependencies (e.g., Cargo tables, specific extensions), common issues, or styling tips.
* Examples: Show how the template renders with sample inputs.
Example structure for `Template:Infobox saint/doc`:
* Notes: Highlight dependencies (e.g., Cargo tables, specific extensions), common issues, or styling tips.
<pre>
 
Example structure for `Template:Infobox saint/doc`:
 
<pre>
  {{tlx|Documentation subpage}}
  {{tlx|Documentation subpage}}
  == Purpose ==
  == Purpose ==
Line 54: Line 57:


  == Parameters ==
  == Parameters ==
* name – The saint’s name (required).
* name – The saint’s name (required).
* feast_day – The saint’s feast day (optional).
* feast_day – The saint’s feast day (optional).
* patronage – Areas or groups the saint is patron of (optional).
* patronage – Areas or groups the saint is patron of (optional).


  == Example ==
  == Example ==
Line 67: Line 70:


  == Notes ==
  == Notes ==
* Ensure dates follow Saintapedia’s style guide (e.g., “October 4” not “4 October”).
* Ensure dates follow Saintapedia’s style guide (e.g., “October 4” not “4 October”).
* Use Cargo queries for dynamic fields like parish lists, if applicable.
* Use Cargo queries for dynamic fields like parish lists, if applicable.


  [[Category:Template documentation]]
  [[Category:Template documentation]]
  </pre>
  </pre>
3. Link to Documentation:
3. Link to Documentation:
* Add `{{tlx|Documentation}}` to the bottom of the template page (e.g., `Template:Infobox saint`) to display the documentation subpage content.
* Add `{{tlx|Documentation}}` to the bottom of the template page (e.g., `Template:Infobox saint`) to display the documentation subpage content.
* Use `<noinclude>{{tlx|Documentation}}</noinclude>` to ensure it only appears on the template page, not where the template is transcluded.
* Use `<noinclude>{{tlx|Documentation}}</noinclude>` to ensure it only appears on the template page, not where the template is transcluded.
4. Use VisualEditor or Wikitext:
4. Use VisualEditor or Wikitext:
* Saintapedia supports VisualEditor for ease of use, but wikitext is recommended for precise control in template documentation.
* Saintapedia supports VisualEditor for ease of use, but wikitext is recommended for precise control in template documentation.
* Use “Show preview” to check formatting before saving.
* Use “Show preview” to check formatting before saving.
5. Test Changes:
5. Test Changes:
* Create a sandbox (e.g., `Template:<TemplateName>/sandbox`) to test template modifications.
* Create a sandbox (e.g., `Template:<TemplateName>/sandbox`) to test template modifications.
* Use testcases (e.g., `Template:<TemplateName>/testcases`) to compare outputs.
* Use testcases (e.g., `Template:<TemplateName>/testcases`) to compare outputs.
* Verify functionality on a test page before applying changes to live templates.
* Verify functionality on a test page before applying changes to live templates.


== Best Practices ==
== Best Practices ==