Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-08-14 12:37:51

tennapel
Member
Registered: 2009-05-31
Posts: 62

using a txp tag in body text: how to influence the parsing of textile

I have been google-ing and searching this forum, but I cannot find the answer:

I made a very simple plug-in that adds a tag to the textpattern install:
<txp:jmn_column> .... </txp:jmn_column>

all it does is translate the tag to an opening <div> en closing </div> tag, with some extra tags within for styling reasons. This way, an author of a text can break-up the article body text in several columns.

However, when using textile the following fragment
<txp:jmn_column>This is the text that is wrapped in a column</txp:jmn_column>

is translated into this HTML code:
<p><div class="column">This is the text that is wrapped in a column</div></p>

Is there anyway to influence textile, so it does not generate the paragraph tags before and after the added textpattern tag? I would like being able to use the textile markup in the body text.

Offline

#2 2009-08-14 12:47:25

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,447
Website GitHub

Re: using a txp tag in body text: how to influence the parsing of textile

tennapel wrote:

Is there anyway to influence textile, so it does not generate the paragraph tags before and after the added textpattern tag?

You can put a couple of spaces in front of your tag so textile ignores it, or surround your tag in double-equals signs ==<txp:jmn_column> .... </txp:jmn_column>== or put notextile. in front of the tag.

Unfortunately it comes down to educating whoever is writing the articles to stick to whatever convention you choose. Or do something else, like allow people to put markers in the article such as {page} that your plugin reads (I think that’s the way etz_pg works, and perhaps jcb_columnize. smd_pagicle can work that way too).

P.S. don’t forget to register your jmn plugin prefix so nobody else can steal it!

Last edited by Bloke (2009-08-14 12:50:30)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#3 2009-08-14 13:30:58

tennapel
Member
Registered: 2009-05-31
Posts: 62

Re: using a txp tag in body text: how to influence the parsing of textile

Thanks for the pointers. jcb_columnize seems to be a not fully developed plugin, however, there are a few nice trick in the code of jcb_columnize that I can use, I’m not that good a PHP developer :-) I see what it does though and that is what I want.

The other suggestion is a nice fallback, since there are a limited number of users who write text.

Last edited by tennapel (2009-08-14 13:51:24)

Offline

#4 2009-08-15 17:28:47

tennapel
Member
Registered: 2009-05-31
Posts: 62

Re: using a txp tag in body text: how to influence the parsing of textile

In the end, I solved it pretty simple with a string replace routine. Since the plugin is used for a specific website only, I won’t make it available to the general public, it’s pretty useless for other purposes :-)

Offline

Board footer

Powered by FluxBB