Textpattern Forum

You are not logged in. Register | Login | Help

#1 2012-02-22 14:30:55

uli
Moderator
From: Cologne/Köln
Registered: 2006-08-15
Posts: 3,047

[textile] bc. - class (and inline style) getting duplicated

I had difficulties choosing the correct padding values in order to justify code I have textilized with bc.
Each time I applied the values (edit: to my stylesheet) that I’ve set up in Firebug the results were not the ones I desired.
Looking at the source code I finally saw that classes and inline styles given to bc were applied to both pre and code. This behaviour can cause quite a headache with any properties offsetting elements. Is it the intended one?
(IDs on bc are handled “properly”, BTW.)

Last edited by uli (2012-02-22 16:28:44)


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#2 2012-02-22 20:13:41

net-carver
Admin
From: UK
Registered: 2006-03-08
Posts: 1,648

Re: [textile] bc. - class (and inline style) getting duplicated

Hi Uli,

Thanks for caring about textile!

I’ve done a little digging but what I can tell you is that this is an old habit — try it out in Zem’s old textile site. If you look the bc. section in Zem’s textile manual you will also find that rendering as <pre><code>...</code></pre> is intended, even if the double-up of the classes isn’t.

My next question is, if I do reduce this to just a class on either the <pre> or the <code>; which should it be?


Steve
Textile | My plugins on GitHub | @netcarver

Offline

#3 2012-02-22 20:45:25

uli
Moderator
From: Cologne/Köln
Registered: 2006-08-15
Posts: 3,047

Re: [textile] bc. - class (and inline style) getting duplicated

Uh, I’ve pretty porky fingers to pick up such tiny pearls. I’d probably prefer it in pre but to be honest, it’s been the first time that I used bc not in the forum. So you better not ask the first available ;)

Thanks for taking the time, though, Steve.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#4 2012-02-22 21:02:55

philwareham
Core designer
From: Farnham, Surrey, UK
Registered: 2009-06-11
Posts: 1,582
Website

Re: [textile] bc. - class (and inline style) getting duplicated

I’d already posted this issue on textile GitHub a few days back. The classes should be on pre not on the code. In fact you could probably lose the code tag entirely – but it’s valid either way.

At the moment, with the duplicate classes, it stops me using google code prettify on my block code.

Offline

#5 2012-02-22 21:19:39

net-carver
Admin
From: UK
Registered: 2006-03-08
Posts: 1,648

Re: [textile] bc. - class (and inline style) getting duplicated

Hi Phil,

Yes, you did indeed post first — thought this looked like familiar ground.

In fact you could probably lose the code tag entirely – but it’s valid either way.

As Zem intended the nesting of the pre and code tags I’ll not mess with that — but restricting the classes to just the (outer) <pre> block should be relatively easy to do.

@all Would this break things for anyone else?


Steve
Textile | My plugins on GitHub | @netcarver

Offline

#6 2012-02-22 21:22:45

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 5,840
Website

Re: [textile] bc. - class (and inline style) getting duplicated

net-carver wrote:

@all Would this break things for anyone else?

Won’t impact my usage I don’t think. Makes sense to target the <pre>.

P.S. Steve, sorry I haven’t got back to you about Textile testing yet. I’ll try and give it a look at the weekend.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern.

Txp Builders – finely-crafted code, design and Txp

Offline

#7 2012-02-23 21:10:44

net-carver
Admin
From: UK
Registered: 2006-03-08
Posts: 1,648

Re: [textile] bc. - class (and inline style) getting duplicated

Just pushed a new branch to github with a fix for this. Feedback welcome.

@phil: Could you let me know if this allows you to use code-prettify please?

Last edited by net-carver (2012-02-23 21:11:44)


Steve
Textile | My plugins on GitHub | @netcarver

Offline

#8 2012-02-24 12:04:15

philwareham
Core designer
From: Farnham, Surrey, UK
Registered: 2009-06-11
Posts: 1,582
Website

Re: [textile] bc. - class (and inline style) getting duplicated

Works great thanks, can now use Google Code Prettify with Textile formatted <pre> blocks.

Offline

#9 2012-02-24 14:09:43

sacripant
Plugin Author
From: Dakar – Sénégal – Africa
Registered: 2008-06-01
Posts: 358
Website

Re: [textile] bc. - class (and inline style) getting duplicated

philwareham a écrit:

In fact you could probably lose the code tag entirely – but it’s valid either way.

Why?

Meaningfully must be differentiated preformatted text with code snippet or block of code.

W3C council “pre + code” for “block of code”:
4.6.11 The code element
4.5.3 The pre element

@all Would this break things for anyone else?

The problem will come up essentially for “code highlinting”. I used beautyofcode.js on a site, and I need to add class to pre and code
So what?

At the moment, with the duplicate classes, it stops me using google code prettify on my block code.

In the FAQ of google-code-prettify

You may also use the HTML 5 convention of embedding a code element inside the PRE and using language-java style classes. E.g.
     <pre class=“prettyprint”><code class=“language-java”>…</code></pre>

I tested with version 2.2 of “textile” and I have no problem

bc(lang-js prettyprint). $('#selector').lenght;

@philwareham
What is your problem with Textile and Google Code Prettify ?

Offline

#10 2012-02-24 14:31:56

philwareham
Core designer
From: Farnham, Surrey, UK
Registered: 2009-06-11
Posts: 1,582
Website

Re: [textile] bc. - class (and inline style) getting duplicated

What is your problem with Textile and Google Code Prettify ?

Maybe I’m missing something here, but how would you do this in Textile 2.2?…

<pre class=“prettyprint”><code class=“language-java”>…</code></pre>

(i.e. how could I put a class solely on the code tag?)

Offline

Board footer

Powered by FluxBB