Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2012-02-22 14:30:55
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,306
[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
- Archived Plugin Author
- 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
Offline
#3 2012-02-22 20:45:25
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,306
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
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
- Archived Plugin Author
- 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
Offline
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. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
#7 2012-02-23 21:10:44
- net-carver
- Archived Plugin Author
- 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
Offline
Re: [textile] bc. - class (and inline style) getting duplicated
Works great thanks, can now use Google Code Prettify with Textile formatted <pre>
blocks.
Offline
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
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
Re: [textile] bc. - class (and inline style) getting duplicated
With regard to my earlier comment on losing the code
tag within pre
, I was thinking out loud – In that maybe we could do in textile bc(prettify linenums). <code class="language-java"> ... </code>
But thinking about it since, that is not a great idea (we have Textile pre.
anyway).
Removing the duplicating classes from pre code
is a good start but ideally we need a way to put unique classes on the pre
and also unique classes on the code
.
Last edited by philwareham (2012-02-24 15:27:58)
Offline
#12 2012-02-24 20:45:35
- net-carver
- Archived Plugin Author
- Registered: 2006-03-08
- Posts: 1,648
Re: [textile] bc. - class (and inline style) getting duplicated
philwareham wrote:
Removing the duplicating classes from
pre code
is a good start<snip>
… and just committed to the master branch.
…but ideally we need a way to put unique classes on the
pre
and also unique classes on thecode
.
Which would complicate textile’s syntax somewhat; not sure I’m keen on going down that route.
— Steve
Offline