Template:FAQItem: Difference between revisions

mNo edit summary
Tag: Reverted
mNo edit summary
Tag: Reverted
Line 44: Line 44:


<!-- Generate a stable anchor ID from the question text -->
<!-- Generate a stable anchor ID from the question text -->
<!-- Generate the anchor -->
<!-- Precompute everything BEFORE entering HTML mode -->
<span id="{{anchorencode:{{{question}}}}}"></span>
{{#vardefine:frag|{{anchorencode:{{{question}}}}} }}
{{#vardefine:q|{{{question}}}}}
{{#vardefine:a|{{{answer}}}}}


<!-- Store the fragment before entering HTML mode -->
<span id="{{#var:frag}}"></span>
{{#vardefine:frag|{{anchorencode:{{{question}}}}} }}


<html>
<html>
<details class="faq-item">
<details class="faq-item">
<summary style="font-weight: bold; font-size:larger;">{{{question}}}</summary>


<!-- Copy link control (now inside HTML mode, so not escaped) -->
<summary style="font-weight: bold; font-size:larger;">
{{#var:q}}
</summary>
 
<div style="margin:0.5em 0 1em 0; font-size:smaller; opacity:0.7;">
<div style="margin:0.5em 0 1em 0; font-size:smaller; opacity:0.7;">
     <a href="#" class="copy-link" data-frag="{{#var:frag}}">
     <a href="#" class="copy-link" data-frag="{{#var:frag}}">
Line 62: Line 65:


<blockquote class="faq-answer">
<blockquote class="faq-answer">
{{{answer}}}
{{#var:a}}
</blockquote>
</blockquote>
</details>
</details>