Geshi plugin question

Creating and modifying plugins.
Post Reply
mbaranski1
Posts: 3
Joined: Fri Jan 10, 2014 5:09 pm

Geshi plugin question

Post by mbaranski1 » Fri Jan 10, 2014 5:18 pm

I'm using serendipity_event_geshi and have a problem with the formatting I'm getting from it.

This is a brand new installation, and the docs/RELEASE file says:

Code: Select all

stable:1.7.3
beta:1.7.4-beta
The plugin Changelog says:

Code: Select all

# cat ChangeLog
0.7: Upgrade to Geshi 1.0.8.1
First Issue
See the attachment, the method name, method arguments and periods (.) are in some sort of superscript.

Any suggestions?
geshi.PNG
Geshi Formatting
geshi.PNG (3.74 KiB) Viewed 3237 times

Second Issue
If I do not surround the tags in <nl> I get a bunch of <br> tags in the displayed code.

Code: Select all

<nl>[geshi lang=java]
package net.site.test;

public class Main
{
public void main(String[] args) {
System.out.println("Testing");
}
}
[/geshi]</nl>

User avatar
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Geshi plugin question

Post by Timbalu » Fri Jan 10, 2014 5:45 pm

The second issue is done by the nl2br plugin. You either can use simple <nl> (noBR) </nl> or mark the nl2br plugin to get disabled for this entry (with entryproperties plugin installed, which offers a select box to do).

For the first, this might be a matter of plugin list placement, to avoid other plugins replacing parts, or may be some quirks in geshi itself.
Can you give us a live URL or show at least some frontend HTML source-code of this part?
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian

mbaranski1
Posts: 3
Joined: Fri Jan 10, 2014 5:09 pm

Re: Geshi plugin question

Post by mbaranski1 » Fri Jan 10, 2014 6:18 pm

I'll try your suggestion about the line breaks. Is this what you meant by the code posting?

Code: Select all

<div class="entry-content serendipity_entry_body">
   <div class="java geshi" style="text-align: left">
      <ol>
         <li style="font-weight: normal; vertical-align:top;">
            <div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
         </li>
         <li style="font-weight: normal; vertical-align:top;">
            <div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">net.site.test</span><span style="color: #339933;">;</span></div>
         </li>
         <li style="font-weight: normal; vertical-align:top;">
            <div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
         </li>
         <li style="font-weight: normal; vertical-align:top;">
            <div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Main</div>
         </li>
         <li style="font-weight: normal; vertical-align:top;">
            <div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#123;</span></div>
         </li>
         <li style="font-weight: normal; vertical-align:top;">
            <div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&q=allinurl%3Astring+java.sun.com&btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> args<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div>
         </li>
         <li style="font-weight: normal; vertical-align:top;">
            <div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><a href="http://www.google.com/search?hl=en&q=allinurl%3Asystem+java.sun.com&btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">"Testing"</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div>
         </li>
         <li style="font-weight: normal; vertical-align:top;">
            <div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span></div>
         </li>
         <li style="font-weight: normal; vertical-align:top;">
            <div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span></div>
         </li>
         <li style="font-weight: normal; vertical-align:top;">
            <div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
         </li>
      </ol>
   </div>
</div>
Here is my plugin configuration for my site, does this help?
S9plugins.PNG
S9plugins.PNG (23.48 KiB) Viewed 3232 times

User avatar
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Geshi plugin question

Post by Timbalu » Fri Jan 10, 2014 6:49 pm

Here is my plugin configuration for my site, does this help?
I'd say: Stick with these simple to use noBR tags in combination with the geshi highlighter.

About that superscript looking thing with certain text parts, I think, it is the vertical-align:top css inline rule, since all other normal looking text parts are inside span tags. This is placed by geshi and somehow interacts with your templates css, I presume.

I use the 2k11 template here and placed that source snipped in an entry and all lines and text parts show up baselined.

You could now play around with a general

Code: Select all

.geshi { vertical-align:top !important; }
in your templates css or edit all occurrences in plugins/serendipity_event_geshi/geshi.php https://github.com/s9y/additional_plugi ... i.php#L448 and L466 and L472 and L478 to vertical-align: baseline; or whatever is needed to get this flattened to the same ground line.
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian

mbaranski1
Posts: 3
Joined: Fri Jan 10, 2014 5:09 pm

Re: Geshi plugin question

Post by mbaranski1 » Fri Jan 10, 2014 7:13 pm

Thanks, your suggestion about the template fixed the GEshi issue. I'm not going to mod the plugin when the template works just fine.

Thanks again.

User avatar
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Geshi plugin question

Post by Timbalu » Fri Jan 10, 2014 7:39 pm

Great!
If that really helps, I would then try to use

Code: Select all

.geshi { vertical-align:baseline !important; }
or

Code: Select all

.geshi { vertical-align:text-bottom !important; }
instead, which could look better with other text parts.

Btw, Serendipity gets an update tomorrow. Do not forget to fetch that! :)

post scriptum:
Geshi moved to gitHub in the meanwhile and it might be worth to update the revision, which now is 1.0.8.12, even if it says it is 1.0.8.11.
Check this zip https://github.com/GeSHi/geshi-1.0/archive/master.zip and copy the geshi.php file and the /geshi directory to your plugins geshi installation. If you are willing to test and check if this update is a good choice, I will then update the serendipity plugin.
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian

Post Reply