Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-10-11 05:09:47

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 2,697
Website

Textile & HTML5

Thinking about the future here…

issue 1.
acronym is not a valid element in HTML5. abbr is.

That is easy to solve: s/acronym/abbreviation/g and s/<acronym title="$2">$1</acronym>/<abbr title="$2">$1</abbr>/g in classTextile.php

issue 2.
Most HTML 4 elements can be used/included in an article as raw html and Textile will handle them without a problem (I personally never managed to create a more complex table with Textile tags…). Including HTML5 elements (1) doesn’t fare so well. They are interpreted literally :-(. Example: using <figure> outputs the literal string, instead of an html tag. Textile than wraps the whole thing in <p> tags.

That is not really a big problem, one can always disable textile for a particular article. Nicer would be if those elements where handled by Textile as it does for (most) HTML 4 elements. Not sure how to handle this. Is it all covered by function hasRawText($text) in classTextile.php ?

(1) sections 4.4 ~ 4.9 are the most relevant.

issue 3.
In the long run, one might have to think about creating Textile tags for those elements.


Where is that emoji for a solar powered submarine when you need it ?

Offline

#2 2009-10-11 10:26:16

trenc
Plugin Author
From: Cologne
Registered: 2008-02-27
Posts: 569
Website

Re: Textile & HTML5

Full Ack! :)

+1

Offline

#3 2009-10-11 11:09:25

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 8,870
Website GitHub Twitter

Re: Textile & HTML5

HTML5 will probably be the cause of some major discussions here. the way I understand it is that ie does not support it yet (surprise surprise!).

Unfortunately there are a lot of changes which include the deprecation of self closing tags (correct me if I am wrong here). changing acronym to abbr is just the tip of the iceberg.


Yiannis
——————————
neme.org | hblack.net | EMAP | NeMe @ github
I do my best editing after I click on the submit button.

Offline

#4 2009-10-11 12:23:22

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: Textile & HTML5

None of the browsers properly support the new elements/attributes yet, it’s just that you can trick most of them into “supporting” the new elements, whereas IE just can’t be fooled. Not suprising, since this only just became a working draft spec, not a recommendation yet.

Self-closing elements are okay:

Void elements in HTML (e.g. the br, img and input elements) do not require a trailing slash. e.g. Instead of writing <br />, you only need to write <br>. This is the same as in HTML4. However, due to the widespread attempts to use XHTML1, there are a significant number of pages using the trailing slash. Because of this, the trailing slash syntax has been permitted on void elements in HTML in order to ease migration from XHTML1 to HTML5.

http://wiki.whatwg.org/wiki/FAQ#Should_I_close_empty_elements_with_.2F.3E_or_.3E.3F

Then, if the element is one of the void elements, or if the element is a foreign element, then there may be a single U+002F SOLIDUS (/) character. This character has no effect on void elements, but on foreign elements it marks the start tag as self-closing.

http://www.whatwg.org/specs/web-apps/current-work/multipage/syntax.html#start-tags

However, there are a lot of invalid (not just deprecated) attributes in HTML 5 as well. I haven’t looked through Textile to see if any of them are used or not.

It might be a thought to leave the “official” Textile release alone until HTML 5 becomes a recommendation, and have an unoffical HTML 5 version available for the keeners amongst us.

(When I can finally get around to updating my personal site, I’m considering the change to HTML 5.)

Offline

#5 2009-10-11 12:31:08

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 2,697
Website

Re: Textile & HTML5

@ Colak,

Textpattern doesn’t need lots of changes to output HTML5. When you talk about ‘selfclosing tags’ you probably mean />. That remains valid (even though I personally find it ugly). Just replace your Doctype and you should be good to go. You don’t even need to use the new HTML5 elements. This document is HTML5 (even if the validator doesn’t agree, that is a bug, and I know the maintainer of the HTML5 validator to be pretty busy with other work). The timeline element is lifted straight out of the spec.

I cheat a little and use the jmd_html plugin to change the /> into >, but that is a side issue. All my templates use > already, whenever I hard code something. On my todo list: investigating how to minimise further the output of /> (images, form elements). I’m aware of the PHP function nl2br which I can’t change.

And yeah, iExploder is an issue, but not that much; a little bit of JS can ‘fix’ most of it. Other browsers don’t fare that much better. Yet.

@ Mary,

Except for the acronym issue, Textile doesn’t use any deprecated elements. It supports some invalid attributes though (which I never use anyway). I’ll investigate and compile a list this week.

Last edited by phiw13 (2009-10-11 12:32:22)


Where is that emoji for a solar powered submarine when you need it ?

Offline

#6 2009-10-16 12:24:12

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 2,697
Website

Re: Textile & HTML5

So, I had a second look at the Textile usage – within the Textpattern framework.

  1. invalid elements: 1. accronym (has been replace by abbr)
  2. invalid attributes: 0. Every time a textile attribute is used (e.g align:left|right|center), Textile outputs a style attribute. Classes and IDs are still valid in HTML5.
  3. the new HTML5 elements: those can simply be added to the list in function hasRawText($text) as suggested in my first post, and they can be used as raw HTML, just as one would do with a div.

When I get a moment, I’ll generate a patch based on the above to use for those who want to play with HTML5. I need to clean a bit my local installs of TXP first… all 3 are quite messy at the moment.


Where is that emoji for a solar powered submarine when you need it ?

Offline

#7 2009-10-24 02:42:24

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 2,697
Website

Re: Textile & HTML5

OK, here is a patch with the mods I applied to classTextile.php.
This does two things:

  • replace <acronym> with <abbr>
  • adds basic support for a number of the new HTML5 block-level elements, allowing the use of those elements in an article context without having to disable Textile completely (same as how e.g. <div> is handled now). The list is based on section 4.4 of the HTML5 spec. I’ve limited myself to those elements that are more likely used within the context of an article in Textpattern [*].

As noted above, what Textpattern/Textile otherwise spits out is fully compliant with the current HTML5 spec, as far as I can tell.

For the future, we may want to think about ways to handle those HTML5 elements in a more Textile way. That would probably be the same as how bq.. and bc.. are handled now.

[*] hmm, come to think of it, the HTML 4 <dl> element never found its way into Textile.

patch is here:
http://dev.l-c-n.com/textpattern/textile_html5.patch


Where is that emoji for a solar powered submarine when you need it ?

Offline

#8 2010-06-28 10:15:04

ax
Plugin Author
From: Germany
Registered: 2009-08-19
Posts: 161

Re: Textile & HTML5

The tables that are created with Textile would be incompatible, though. The HTML5 specification now makes the tbody tag obligatory: “Polyglot markup must explicitly have a tbody element surrounding groups of tr elements within a table element”, see:

http://www.w3.org/TR/2010/WD-html-polyglot-20100624/#tables

but Textile does not create thead or tbody tags.

Offline

#9 2010-06-28 10:48:58

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,743
Website GitHub

Re: Textile & HTML5

ax wrote:

Textile does not create thead or tbody tags.

But it could…

When we get round to looking at HTML 5 (perhaps when the spec’s more stable? I haven’t looked at it for ages) Textile will need changing anyway; as phiw13 says the acronym/abbr tags are another area that will need attention.

Thanks for the link. Worth knowing.

Last edited by Bloke (2010-06-28 10:50:17)


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

#10 2010-06-28 12:28:46

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: Textile & HTML5

I think tbody is required even in HTML 4. I say “I think” because the HTML 4 element declaration for table shows it as such (and does not show tr as an allowed element), while the examples on the same page show tables with no tbody.

htmlhelp.com, my favorite HTML 4 reference, says that tbody is required.


Code is topiary

Offline

#11 2010-06-28 13:04:40

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,743
Website GitHub

Re: Textile & HTML5

jsoo wrote:

I think tbody is required even in HTML 4.

Just as well we’re validating against XHTML 1.0 then at the moment, so we can do what we like ;-)

I’m not sure how we’d get around the multiple validation thing. I mean, for whatever reason, Textile and TXP have grown up around XHTML. I like my tags self-closing rather than optionally woolly because it makes parsing simpler. But HTML 5 is attractive. I wonder how we could tell Textile which system to validate against?

I guess the obvious — if laborious — approach is some way of specifing a class-level variable which TXP could expose as a system-wide preference to govern its own style of tag generation and also pass that on to Textile so it can do likewise. It’s a lot of work though, so if there is any way we can get commonality by allowing both TXP and Textile to generate markup compliant with both strict XHTML and HTML4/5 I’d prefer that route.

Does anybody have a handle on this from a standards perspective? I’d rather laminate my own head than wade through the W3C’s verbose documentation to find clues; perhaps somebody has already done a comparison somewhere that we can use as a baseline?


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

#12 2010-06-29 01:23:08

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 2,697
Website

Re: Textile & HTML5

jsoo wrote:

I think tbody is required even in HTML 4. I say “I think” because the HTML 4 element declaration for table shows it as such (and does not show tr as an allowed element), while the examples on the same page show tables with no tbody.

Nope, tbody is implied in HTML 4. XHTML (as application/xhtml+xml) is ‘nother story.

From the link you provide (my emphasis):

The TBODY start tag is always required except when the table contains only one table body and no table head or foot sections. The TBODY end tag may always be safely omitted.

(not to say it is a bad idea to add it… :-) – and I always use it, but then I always use a thead as well).

Last edited by phiw13 (2010-06-29 01:30:31)


Where is that emoji for a solar powered submarine when you need it ?

Offline

Board footer

Powered by FluxBB