Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-12-07 09:37:15

mourner
Member
From: Kiev, Ukraine
Registered: 2005-02-19
Posts: 57
Website

[textile] Pre tag and textile processing

Hi folks!

I’m working on a poetry section of a website. To retain indentation of some of the lines in posts, I need to use ‘pre’ tag or corresponding CSS property (whitespace: pre). The problem is that Textile processes everything inside pre tag, so retained whitespace plus Textile-inserted paragraph breaks and margins lead to incorrect formatting of text.

How can I overcome this problem?

I will be grateful for any advices. Thanks in advance!

Offline

#2 2007-12-07 09:53:05

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: [textile] Pre tag and textile processing

What are you actually meaning? Someting like:

Hello this is my first paragraph.

pre. This is preformated text as you wished.

This is just another regular paragraph.

Or are you saying that you want pre-tag inside p-tag like <p>I want <pre>this kind</pre> of thing</p>? But that ain’t possible, you know. Because it ain’t valid – it’s freaking unvalid, because you can’t put block-elements inside p-tags. So that’s why it called pre. in textile – it’s blockelement, and there for it doesn’t require inline-calling, coz it ain’t inline-element.

But in another hand if your meaning that you require to make two paragraps inside pre-element and then escape it, you could do like this:

Hello this is my first paragraph.

pre.. This is preformated text as you wished.

And this is some more of preformatted text.

p. This is just another regular paragraph.

And for styling, just put in your CSS, something like:

pre {
	white-space: normal; /* or: pre / nowrap */
	padding: 0;
	overflow: auto;
	margin: 0 0 20px 0;
}

Cheers!

Last edited by Gocom (2007-12-07 09:58:08)

Offline

#3 2007-12-07 09:56:58

mourner
Member
From: Kiev, Ukraine
Registered: 2005-02-19
Posts: 57
Website

Re: [textile] Pre tag and textile processing

Jukka, pre.. is exactly what I needed! Didn’t know about such possibility, thanks a lot for your help!

Last edited by mourner (2007-12-07 09:57:23)

Offline

#4 2007-12-07 09:58:55

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: [textile] Pre tag and textile processing

No problem :-)

Cheers!

Offline

#5 2007-12-07 10:08:49

mourner
Member
From: Kiev, Ukraine
Registered: 2005-02-19
Posts: 57
Website

Re: [textile] Pre tag and textile processing

But now I have another question. :) Is there any way to do the same thing implicitly in page forms? I will have a couple of staff editors that are unaware of Textile. They would just enter the poem in raw text and it would automatically be escaped and preformatted for that specific section.

Or maybe this is not very good idea and I’ll have to tell each writer about pre.. in the beginning…

Offline

#6 2007-12-07 10:26:39

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: [textile] Pre tag and textile processing

But, actually where do you need pre? Ain’t <br /> enough? Because if they insert line change, it will be there, automade by Textile.

But if you’re sure that you wan’t you could surround <txp:body /> with pre-tags (<pre><txp:body /></pre>) and change textile setting to “convert only line breaks” .

Cheers!

Last edited by Gocom (2007-12-07 10:29:13)

Offline

#7 2007-12-07 10:31:23

mourner
Member
From: Kiev, Ukraine
Registered: 2005-02-19
Posts: 57
Website

Re: [textile] Pre tag and textile processing

I need it for indentation, something like this:

Bla-bla-bla
Bla-bla-bla

	Bla-bla-bla
	Bla-bla-bla

Bla-bla-bla
Bla-bla-bla

Regarding textile setting, I only need this for one specific section, not whole website. :)

Last edited by mourner (2007-12-07 10:32:33)

Offline

Board footer

Powered by FluxBB