nektros - Cynicism in a Hot Dish

Some Textile hang-ups (with simple fix-ups)

Posted 4 May 2008 in by Yvonne

In the initial stages of my Textpattern thrall, a sole source of peevishness was the at once beautiful simplicity and frustrating complexity of its discretionary markup language, Textile.

In an effort to spare those still apt to giving Textile a chance after coming up short on answers with the following popular Textile generators –

– following are some problems which can arise when utilising an oftentimes unfairly berated coding tool, with accompanying solutions.

Disabling Textile for specific paragraphs

Activating Textile in Textpattern –

Admin → Preferences → Use Textile

– can mean trouble when attempting to add raw XHTML code within posts.

By default, paragraphs preceded by a blank line with no accompanying Textile modifiers are wrapped in <p> tags. If you were to write the following (and for some reason didn’t want to use the * symbol to create a list with Textile) –

Reasons why my day was so awesome:

<ul>
<li>I wrestled a crocodile and saved a cat</li>
<li>The cat smiled at me</li>
</ul>

– it would render as –

<p>Reasons why my day was so awesome:</p>

<p><ul>
<li>I wrestled a crocodile and saved a cat</li><br />
<li>The cat smiled at me</li><br />
</ul></p>

Coupled with the seizure-inducing addition of break tags, the above code would most likely conflict with your stylesheet’s settings, and would definitely conflict with any code validator out there.

A better option would be to write the following Textile code:

Reasons why my day was so awesome:

notextile. <ul>
<li>I wrestled a crocodile and saved a cat</li>
<li>The cat smiled at me</li>
</ul>

Another way to disable Textile in a paragraph would be to add a space at the start of the paragraph.

Adding p. or a heading modifier such as h2. at the start of the following paragraph would resume Textile usage.

Extended blockquotes over several lines

In the above blockquotes, you can see blank lines between each paragraph. While achieving these should, well, not be so bloody frustrating for Textile users, the following Textile code –

bq. Why yes,

you’re goddamn awesome.

– would render as –

<blockquote>Why yes,</blockquote>

<p>you’re goddamn awesome.</p>

While you could disable Textile using the method outlined above in order to work around this problem, that would defeat the entire ‘effing purpose of using Textile in the first place.

Instead, the following little-known solution can be used –

bq.. Why yes,

you’re goddamn awesome.

– which results in –

<blockquote><p>Why yes,</p>

<p>you’re goddamn awesome.</p></blockquote>

Note the double dots after the bq. modifier. Again, adding p. or a heading modifier at the start of the following paragraph would resume Textile usage.

Embedding <code> tags within <pre> tags

One way of preventing long snippets of code from breaking your layout is to contain your <code> tags within <pre> tags.

Alas, the following Textile code –

pre. @Show me the code!@

– would once again screw up your well-laid plans, spitting out –

<pre>@Show me the code!@</pre>

Ack. Fortunately, the bc. modifier exists to help us, with the following Textile code –

bc. Show me the code!

– rendering perfectly as –

<pre>
<code>Show me the code!</code>
</pre>

The bc. modifier can also be used with double dots to extend code over several lines, with the following –

bc.. Show me the code!

Here endeth the lame pop culture pun.

– becoming –

<pre>
<code>Show me the code!</code>

<code>Here endeth the lame pop culture pun.</code>
</pre>

For the sake of repeating myself into a gibbering mess, adding p. or a heading modifier at the start of the following paragraph would resume Textile usage.

Recommended further reading on Textile

Comments

No discussion yet, but you can start one below.

Leave a comment

Comment form




(Textile Help)

-------