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

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 30 2025 21:09:01
Script start
Timing: Jan 30 2025 21:09:01
Module start 'layout'
Timing: Jan 30 2025 21:09:01
Module start 'content'
Timing: Jan 30 2025 21:09:01
Module end 'content'
Timing: Jan 30 2025 21:09:01
Script end

Main resources:

Total runtime0.0266 sec
Peak memory usage6,144.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0061 588.0313151.1953
Module start 'layout' 0.00610.0038 739.2266220.6563
Module start 'content' 0.00990.0147 959.88281,001.7734
Module end 'content' 0.02460.0019 1,961.656333.9922
Script end 0.0265  1,995.6484 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.003011.2105140.0002
Check MTime0.00124.5122140.0001
Mysql Total
Database connection0.00103.705710.0010
Mysqli_queries0.00248.975930.0008
Looping result0.00000.052910.0000
Template Total0.00145.310.0014
Template load0.00114.022410.0011
Template processing0.00031.294410.0003
Override
Cache load0.00062.373610.0006
General
dbfile0.00207.610680.0003
String conversion0.00000.034140.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs