Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2013-08-24 14:00:25

dewyatt
New Member
Registered: 2013-08-20
Posts: 7

[textile] Keep line breaks

I’m using TXP 4.5.4 w/Textile and I have some articles where I need some line breaks preserved.
Simple example:

notextile.. <![CDATA[
1
2

3

4
]]>

The output I get is:

<![CDATA[
1
2
3
4
]]>

I would expect the notextile bit to indicate “don’t mess with my data!”. Am I doing something wrong or is this more or less a bug?

Offline

#2 2013-08-24 14:09:59

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,091
Website GitHub Mastodon Twitter

Re: [textile] Keep line breaks

I guess it depends what you need to d. Do you want to include a jacascript or present code in the front end?


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#3 2013-08-24 14:16:34

dewyatt
New Member
Registered: 2013-08-20
Posts: 7

Re: [textile] Keep line breaks

colak wrote:

I guess it depends what you need to d. Do you want to include a jacascript or present code in the front end?

I use javascript (SyntaxHighlighter), to present code to the user:

notextile.. <script type="syntaxhighlighter" class="brush:c; toolbar: false">
<![CDATA[
//code here
]]></script>

Is there any way to get this to work?

Last edited by dewyatt (2013-08-24 14:24:39)

Offline

#4 2013-08-24 14:29:14

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

Re: [textile] Keep line breaks

dewyatt wrote:

Am I doing something wrong or is this more or less a bug?

This seems to be unwanted behavior, and is reproducible on the latest Textile version. Could you open a new issue on Textile’s issue tracker?

The issue seems to originate from where blocks are shelved. There should be linefeed, I suppose.

Is there any way to get this to work?

You could use the same pre. tag you just used. You probably can bind SyntaxHighlighter’s languages to some valid classes, opposed to their semicolon syntax. If not, there are other options such as Prism.js or Google Code Prettify.

Last edited by Gocom (2013-08-24 14:35:06)

Offline

#5 2013-08-24 14:42:46

etc
Developer
Registered: 2010-11-11
Posts: 5,195
Website GitHub

Re: [textile] Keep line breaks

A weird etc_query way (remove whitespace in front of pre.. and notextile.):

notextile. <script type="syntaxhighlighter" class="brush:c; toolbar: false">
<txp:etc_query data="

 pre.. 
1
2 

3

4

 notextile. "><![CDATA[{//text()}]]></txp:etc_query>
</script>

Offline

#6 2013-08-24 14:44:06

dewyatt
New Member
Registered: 2013-08-20
Posts: 7

Re: [textile] Keep line breaks

Gocom wrote:

This seems to be unwanted behavior, and is reproducible on the latest Textile version. Could you open a new issue on Textile’s issue tracker?

Done

You could use the same pre. tag you just used. You probably can bind SyntaxHighlighter’s languages to some valid classes, opposed to their semicolon syntax. If not, there are other options such as Prism.js or Google Code Prettify.

Thanks, I’ll look into this. I tried prism first actually and found something to be a deal breaker, can’t remember what. I might have to reconsider.

Offline

#7 2013-08-24 15:29:00

dewyatt
New Member
Registered: 2013-08-20
Posts: 7

Re: [textile] Keep line breaks

I ended up switching to prism.js and using something like:

bc(language-cpp line-numbers).. some_file.cpp
#include <string>

int main ( int argc, char *argv[] ) {
  //...
}

Much simpler! I can’t recall why I decided not to use prism.js before but hopefully it works out.

Offline

Board footer

Powered by FluxBB