Template:FAQItemNL: Difference between revisions

m added optional id parameter, auto-generated ID fallback, link to this question icon
m ST moved page Template:FAQItem to Template:FAQItemNL: swapped with FAQItemL (makes link)
 
(10 intermediate revisions by the same user not shown)
Line 1: Line 1:
<noinclude>
<noinclude>
<templatedata>
{
  "description": "Creates a FAQ item",
  "params": {
    "text": {
      "label": "Question",
      "description": "The Question",
      "type": "string",
      "required": true
    },
    "answer": {
      "label": "Answer",
      "description": "The Answer to the question",
      "type": "string",
      "required": true
    }
  }
}
</templatedata>
<big>FAQItem usage</big>
<big>FAQItem usage</big>


# Optional: | id = custom-id
# Copy text between the horizontal lines for each Question with Answer
# Required: | question =
# Put the Question after | question =
# Required: | answer =
# Put the Answer after | answer =
 
----
 
<nowiki>{{</nowiki>'''FAQItem'''
 
| question =  
 
| answer =  


If no id is provided, one will be auto-generated from the question text.
<nowiki>}}</nowiki>


----
----
<nowiki>{{FAQItem
 
| id      = optional-custom-id
The FAQItem will render as it appears below this line.
| question = Your question
 
| answer  = Your answer
}}</nowiki>
----
----
</noinclude>
</noinclude>
<!-- Generate an ID if none is provided -->
{{#vardefine:faqid |
  {{#if:{{{id|}}}
    | {{{id}}}
    | {{#replace:{{lc:{{{question}}}}}| |-}}
  }}
}}


<html>
<html>
<details class="faq-item" id="{{#var:faqid}}">
<details class="faq-item">
<summary style="font-weight: bold; font-size:larger;">
<summary style="font-weight: bold; font-size:larger;"></html>{{{question|Question}}}<html></summary>
</html>
 
<!-- Question text -->
{{{question|Question}}}
 
<!-- Link icon -->
<html>
<a href="#{{#var:faqid}}" class="faq-link-icon" style="margin-left:8px; text-decoration:none;">🔗</a>
</summary>
 
<blockquote class="faq-answer">
<blockquote class="faq-answer">
</html>
</html>{{{answer|Answer}}}<html>
{{{answer|Answer}}}
<html>
</blockquote>
</blockquote>
</details>
</details>
</html>
</html>