Texpattern context demo

Current global context
SectionArticle
context_demo150

The section tag

There’s more to the section tag than appears at first glance. It seems quite simple, returning either a named section, or the section from the current context. A closer look reveals numerous options for how to display the section:

Still, these options are easy to understand. But what is the current context? Section context has three layers, in descending order of priority:

Let’s put section through its paces.

This code:

<ul>
	<li>
		Current section: <b><txp:section /></b><br />
		(from global section context)
	</li>
	<txp:section_list sections="info">
		<li>
			Current section: <b><txp:section /></b><br />
			(from <code>section_list</code> context)
		</li>
		<txp:article_custom section="txp" limit="1">
			<li>
				Current section: <b><txp:section /></b><br />
				(still from <code>section_list</code> context,
				despite local article context)
			</li>
		</txp:article_custom>
	</txp:section_list>
	<txp:article_custom section="txp" limit="1">
		<li>
			Current section: <b><txp:section /></b><br />
			(now from local article context)
		</li>
	</txp:article_custom>
</ul>

produces this output: