Forums / Suggestions / Headings - H1 H2 H3

Headings - H1 H2 H3

Author Message

Esben Maaløe

Friday 27 June 2003 4:08:52 am

The new XML parser is soo much nicer than the old one.

And it 'understands' regular HTML better too.

Why not build in the ability to deal with <H1-6> tags ?

I've looked at it my self briefly - the 'tagalias' array is a little stroke of genious - but altering the parser so that it can create a tag AND and attribute from a tagalias seems too comprehensive... I don't mind 'fixing' my version of the parser - but I hate doing too much to it so that it looses compatability with the original ez parser.

IF I alter it - and provided that my code isn't clumsy or downright stupid - would there be a chance for it to be included in the 'official' parser ?

Alternatively (and better from the systems point of view) - is eZ contemplating such an alteration of the parser ?

Esben Maaløe

Monday 30 June 2003 5:34:19 am

in file:

kernel/classes/datatypes/ezxmltext/handlers/input/ezsimplifiedxmlinput.php

in function &convertInput

I've replaced the lines:

// Convert headers
$text =& preg_replace( "#<header>#", "<header level='1'>", $text );

With

//remove everything in <head></head>
$text =& preg_replace( "#<head(\s|>)+.*</head(\s|>)#", "", $text );

//remove <HTML> tags
$text =& preg_replace( "#</?html[^>]*>#", "", $text );

//remove body tags
$text =& preg_replace( "#</?body[^>]*>#", "", $text );

// Convert headers
$text =& preg_replace( "#<header>#", "<header level='1'>", $text );
$text =& preg_replace( "#<\s*h([0-9])[^>]*>#", "<header level='$1'>", $text );
$text =& preg_replace( "#</h([0-9])[^>]*>#", "</header>", $text );

Which makes eZPub better at handling a html copy/paste job

Valentin Svelland

Monday 14 July 2003 1:31:20 am

Hi Esben. I looked in the file you referred to, but couldn't find the lines to replace. Which version of eZ did you have installed while doing these changes? I want my eZ 3.1 to accept <h1> tags (and h2 etc) while publishing articles in admin as well...

Esben Maaløe

Monday 14 July 2003 5:22:00 am

I replaced it in one of the last betas ( if not the last) before latest release...

I just looked in the latest release - it is the same...

The function begins at line 595 - but do a textsearch for

// Convert headers