#1 2014-08-26 10:34:35

Loftux
Member
Registered: 2014-08-26
Posts: 6

[SOLVED] Output of extend fields truncated line breaks

I'm trying to add syntax highlighting support to my blog posts. Since TinyMce is the sworn enemy to custom formatting I'm adding this with an Extend field. This is a pure text box where I can add code like
<pre><code class="class="language-javascript"">
//My js code
</code></pre>

To output this in page_blog_post.php I use
<ion:extend:code-block>
   <ion:value />
</ion:extend:code-block>

It all works fine in terms of highlighting (tested both highlight.js and prism.js), the problem is line breaks.
For what I can understand all line breaks are removed by ionize when the value of "code-block" is output (and so the code looks minimized).
All line breaks remain in the edit field for the extended field 'code-block'.
Is there a parameter to let me output "raw" content value?

Last edited by Loftux (2014-10-13 08:00:45)

Offline

#2 2014-09-01 08:28:54

Loftux
Member
Registered: 2014-08-26
Posts: 6

Re: [SOLVED] Output of extend fields truncated line breaks

Could someone please tell me what code is generating the output of <ion:value>?
Is it CodeIgniter or Ionize code? Possibly what file to look into as well.

Just hoping for a hint in the right direction (or even better a full solution smile ) so that I can change the behavior for my needs and soon go live with my migration from wordpress to ionize.

Offline

#3 2014-09-07 17:06:13

Loftux
Member
Registered: 2014-08-26
Posts: 6

Re: [SOLVED] Output of extend fields truncated line breaks

I'm still looking for an answer to the above. (sorry for bumping my post like this, but it is keeping me from going live)

Offline

#4 2014-09-07 19:33:58

CodeStepper
Member
From: Poland
Registered: 2014-06-30
Posts: 53
Website

Re: [SOLVED] Output of extend fields truncated line breaks

libraries/Tagmanager.php
line 1392 (ionize 1.0.7) - tag_extend_field_value

I don't think that it removing line breaks...

Maybe give some more details - I still don't know what are you doing (why are you using extend fields?) and how you displaying it (where are you put your code to highlight).
You can put it in article / page and write html tag with class for your "highlighter".
Just click first button in TinyMCE (show/hide toolbars) and HTML.

Last edited by CodeStepper (2014-09-07 19:46:21)

Offline

#5 2014-09-08 03:03:28

damascus
Member
From: Brisbane, Australia
Registered: 2013-04-08
Posts: 270
Website

Re: [SOLVED] Output of extend fields truncated line breaks

@Loftux,

You would be best off checking admin->settings and enabling the html tags you wanted in the list there

Then try that html view and you should see they stick

You could make it easier to work with those tags by adding buttons or even just style classes to tinymce, and/or playing with the ionize_tinymce.js file - but thats only for extra credit wink

In regards to Tagmanager, in 0.9.7 there is a function called Tagmanager::process_string() which i did modify back then. Not sure about line breaks, but tag_simple_value was the function outputting ion:value at the time, and called to the process_strings function.

If line breaks are still an issue, first checkout tinymce forums/google to find if others had issues (as if it only occurs in <code>, then very doubtful if ionize)

Last edited by damascus (2014-09-08 03:07:38)


Webmaster | OneCNC Australia

Offline

#6 2014-09-08 10:05:40

Loftux
Member
Registered: 2014-08-26
Posts: 6

Re: [SOLVED] Output of extend fields truncated line breaks

Hi and thanks for the responses.
Main goal: to be able to post blog post that includes code samples with syntax highlighting.
So far: I've been able to get highlight.js (and also others) to work, but since line breaks are removed, it all comes in one line.

And I found the solution:
It is a setting in System, Advanced Settings, Ssytem: Compress HTML output. It was ticked, removing that, the output is now correct. I don't know it that is the default in a new install, or if someone ticked it. Anyway, now there is a forum post if someone comes across the same problem.

Offline

#7 2014-10-13 03:19:30

damascus
Member
From: Brisbane, Australia
Registered: 2013-04-08
Posts: 270
Website

Re: [SOLVED] Output of extend fields truncated line breaks

@Loftux - please update title with [solved] for better SEO (edit first post)

Thanks smile


Webmaster | OneCNC Australia

Offline

What's Ionize ?

Ionize is an Open Source Content Management System created by webdesigners for webdesigners.

Created and maintained by Partikule and Toopixel, Ionize wants to be the easiest and most powerful CMS.

Can I help ?

Because talent is nothing without involvement, we are looking for motivated coders and webdesigners to join the project team.

Resources

Website : ionizecms.com
Documentation : doc.ionizecms.com

Development : Ionize on GitHub
Translations : Ionize Translations