GeSHifilter DIVs inside P (conflict with Line break filter)

VladSavitsky - May 1, 2009 - 14:43
Project:GeSHi Filter for syntax highlighting
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

Problem is when DIV is placed into P.

I have done some changes to code. See attached patch

But this is NOT an enterprise-solution. This is quick and dirty fix of problem that really works.

Really good solution is to stop using DIV at all.
Thanks for very useful module.

AttachmentSize
geshifilter-6.x-1.2_fixed.diff1.16 KB

#1

VladSavitsky - May 1, 2009 - 14:44

Forgot to write that I'm using "Use no container" to avoid all DIV's in code of page.

#2

soxofaan - May 23, 2009 - 09:18
Status:active» postponed (maintainer needs more info)

Can you give an example of both the used input filter pipeline and the body text?

GeSHi filter does not add the <p> tags itself, I guess those come from the line break filter or something.

I think this is out of scope of the GeSHi filter itself, so I'm tempted to mark this as "won't fix".

Really good solution is to stop using DIV at all.

What is actually wrong with using DIVs?
Note that the GeSHi library will use SPANs instead of DIVs automatically if there is no newline in the codeblock.
Eg. [code]print "wello horld"[/code] will use a span and can be used inside paragraphs
while

[code]
print "wello horld"
[/code]

will use a DIV and should be used as a standalone block.

#3

saper - June 21, 2009 - 21:45
Status:postponed (maintainer needs more info)» active

To give you the example from my site (http://saper.info/pl/node/4)

My setup (I am not the original poster)
* Drupal 6.12
* GeSHi filter 6.x-1.2
* Zen skin (6.x-dev as of May 2009)

* GeSHi content node disabled
* GeSHi filter enabled
* Pathfilter enabled (although not used)

Enabled i18n with block and taxonomy translation

GeSHi filter settings:
* GeSHi library version 1.0.7.22 detected
* Use input format specific tag settings is OFF
* Generic syntax highlighting tags: <code> <blockcode>
* Tag style:
* Also apply syntax highlighting to <?php ... ?> style PHP source code blocks is OFF

* Default highlighting mode: plain text
* no line numbers
* Use built-in PHP function highlight_string() for PHP source code is OFF
* Enable GeSHi keyword URLs is ON

* Use CSS classes and an automatically managed external CSS style sheet.
* Use no container

Filters tab: No known filter conflicts were detected.

This node is using "Full HTML" filter, filter order:
- URL addresses 0
- Newlines 1
- GeSHi filter 10

Enabling HTML clean up does not seem to bring any difference.

---BEGIN SOURCE CODE------------->8----------------------------------
I have four JDK's installed on my machine:

FreeBSD JDK 1.5 compiled from source:

<blockcode>
java version "1.5.0_13-p7"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_13-p7-root_03_dec_2007_00_10)
Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_13-p7-root_03_dec_2007_00_10, mixed mode)
</blockcode>

Diablo FreeBSD JDK 1.5 binary:

<blockcode>
java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build diablo-1.5.0-b01)
Java HotSpot(TM) 64-Bit Server VM (build diablo-1.5.0_07-b01, mixed mode)
</blockcode>

FreeBSD JDK 1.6 compiled from source:

<blockcode>
java version "1.6.0_03-p4"
Java(TM) SE Runtime Environment (build 1.6.0_03-p4-saper_24_feb_2008_06_54-b00)
Java HotSpot(TM) 64-Bit Server VM (build 1.6.0_03-p4-saper_24_feb_2008_06_54-b00, mixed mode)
</blockcode>
---END SOURCE CODE------------->8----------------------------------

Rendered XHTML:

---BEGIN RENDERED CODE------------->8----------------------------------
<div class="content">

    <p>When playing with <a href="http://www.jforum.net">JForum</a> I have noticed a small annoyance in the log:</p>
<p><div class="geshifilter">java.version ''1.6.0_03-p4'' could not be parsed. Defaulting to JDK 1.1</div></p>
<p>(This problem has also been reported on some <a href="http://forum.l2jgroup.ru/index.php?showtopic=1279">Russian forum</a>).</p>
<p>I have four JDK's installed on my machine:</p>
<p>FreeBSD JDK 1.5 compiled from source:</p>
<p><div class="geshifilter">java version &quot;1.5.0_13-p7&quot;<br />

Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_13-p7-root_03_dec_2007_00_10)<br />
Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_13-p7-root_03_dec_2007_00_10, mixed mode)</div></p>
<p>Diablo FreeBSD JDK 1.5 binary:</p>
<p><div class="geshifilter">java version &quot;1.5.0&quot;<br />
Java(TM) 2 Runtime Environment, Standard Edition (build diablo-1.5.0-b01)<br />
Java HotSpot(TM) 64-Bit Server VM (build diablo-1.5.0_07-b01, mixed mode)</div></p>
<p>FreeBSD JDK 1.6 compiled from source:</p>
<p><div class="geshifilter">java version &quot;1.6.0_03-p4&quot;<br />

Java(TM) SE Runtime Environment (build 1.6.0_03-p4-saper_24_feb_2008_06_54-b00)<br />
Java HotSpot(TM) 64-Bit Server VM (build 1.6.0_03-p4-saper_24_feb_2008_06_54-b00, mixed mode)</div></p>
---END RENDERED CODE------------->8----------------------------------

#4

nicomat - June 22, 2009 - 21:06

subscribing

#5

soxofaan - June 23, 2009 - 07:29
Title:Patch for valid XHTML 1.0 Strict» GeSHifilter DIVs inside P (conflict with Line break filter)
Version:6.x-1.2» 6.x-1.x-dev

ok, confirmed

The problem is that Drupal core's line break filter is responsible for those <p>'s.

I'm not sure yet how this can be avoided or if it's feasible to remove the <p>'s again in a clean way.

#6

basvredeling - September 13, 2009 - 11:07

I think you should replace the < div > tags with < code > instead of < span >, and style all code.geshifilter tags to display as block. Should validate correctly. For example: http://codeculture.nl/article/20090912/jroute-and-module-visibility

 
 

Drupal is a registered trademark of Dries Buytaert.