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.

CommentFileSizeAuthor
geshifilter-6.x-1.2_fixed.diff1.16 KBVladSavitsky
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

VladSavitsky’s picture

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

soxofaan’s picture

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.

saper’s picture

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----------------------------------
nschloe’s picture

subscribing

soxofaan’s picture

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.

basvredeling’s picture

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

xandeadx’s picture

subscribing

gingo’s picture

Try this quick fix: place GeSHi filter before the line break filter and before HTML corrector. Hope it helps.

kenorb’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

Closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.