Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2008-05-05 09:01:32
- Ian Goldby
- Archived Plugin Author
- Registered: 2007-09-16
- Posts: 6
img_rebase_headings
This plugin is useful if you want to ensure that the headings marked up with Textile inside an article body are all subheadings of the article title.
For example, your template might define the article title as an <h3> heading. If the author of the article used Textile h1. or h2. headings, these would then break the hierarchy of heading levels. Presumably you would want the first subheading in the article body to be h4. so that it is a proper subheading of the article title <h3>.
img_rebase_headings
looks to see what is the top-level heading used in the article and adjusts all of the headings and subheadings found so that the top-level heading used matches the desired base level.
Download
Example
<txp:img_rebase_headings base="4"><txp:body /></txp:img_rebase_headings>
Attributes
Required
- base: the highest-level heading (i.e. lowest numbered) that you want inside the wrapped text.
Comments
- XHTML supports heading levels 1 to 6.
img_rebase_headings
will not renumber any heading to be above 6. One consequence of this is that more than one level might be converted to <h6>. img_rebase_headings
assumes valid XHTML and does not replace heading tags if they are in uppercase.
——
I’ve been using it for a while now and I don’t have plans to develop it any further, except to fix any problems that might be found. However all comments are very welcome.
Offline
Offline
#3 2008-05-05 10:43:31
- lee
- Member
- From: Normandy, France
- Registered: 2004-06-17
- Posts: 831
Re: img_rebase_headings
Very cute.
Offline
Re: img_rebase_headings
Nice little one! Thanks!
Particularly useful when someone forgot to write the proper excerpt (and when you are obsesed with every heading being the right level…)
An example:
<txp:if_article_list>
<txp:if_excerpt>
<txp:excerpt />
<p class="read-more"><txp:permlink>Read more →</txp:permlink></p>
<txp:else />
<txp:img_rebase_headings base="4"><txp:body /></txp:img_rebase_headings>
</txp:if_excerpt>
<txp:else />
<txp:body />
</txp:if_article_list>
Offline
Pages: 1