|
Cookbook /
SourceBlock-Talkback to SourceBlock Please leave the latest message at the top.Change Request (to make code work with Precode): Any other similar options for setting
$geshi->set_header_type(GESHI_HEADER_??);
should work.
165c165,167
< $geshi->set_header_type(GESHI_HEADER_DIV);
---
> if(@$opt['headw']==='0')
> $geshi->set_header_type(GESHI_HEADER_NONE);
> else $geshi->set_header_type(GESHI_HEADER_DIV);
VKrishn July 23, 2012, at 02:27 AM Change Request:
243c243
< $infos = array("Geshi Version: " . GESHI_VERSION);
---
> $out = "Geshi Version: " . GESHI_VERSION;
245c245
< $infos[] = "\n||border=1\n||! lang ||! full name ||";
---
> $out .= "\n||border=1\n||! lang ||! full name ||\n";
253c253
< $infos[] = "||
260c260,261
< $out = implode("\n", $infos) . "\n";
---
> ksort($infos);
> $out .= implode("\n", $infos) . "\n";
As you can see, it builds the precursors to the actual language list in the $out variable, and $infos just contains the rows of the table, using $lang as the index into the $infos array. Before joining into $out, the $infos array is key sorted. In addition, if there are wiki words in the language list, they are not enabled. --tamouse November 09, 2011, at 08:13 AM on second thought, leave out the (:no/linkwikiwords:) stuff. Better to let the author decide if they want to do that rather than force something on them. --tamouse November 09, 2011, at 08:24 AM
patch supplied: sourceblock-make-changes-to-sort-languages.patch.txtΔ --tamouse April 07, 2012, at 01:30 PM
The feature has been adopted --Dfaure July 06, 2012, at 04:30 AM
Question: I found a bug, not sure where else to put it, but this will highlight the problem, if placed on a wiki with the SourceBlock recipe installed. If highlighting is used on any source block, the last instance of that same language source block type on the same page must also use highlighting
(:source lang=XML highlight='1,2' :) [=
<!--This
Should be highlighted -->
=]
(:source lang=XML :) [=
<!--This
Should NOT be highlighted -->
=]
(:source lang=Java highlight='1' :) [=
System.out.println("highlighted");
=]
(:source lang=Java :) [=
System.out.println("not highlighted");
=]
Nice catch! Fixed in latest release --Dfaure July 06, 2012, at 08:36 AM
Question: how can I place ~~~~ (4 times the ~) in a codebox? Astrid May 31, 2011, at 10:15 AM The 4 times '~' post markup is processed while the page is saved after editing it. The recipe don't even see it. --Dfaure July 06, 2012, at 04:30 AM
Question: Anyone got SourceBlock to work with GeSHI 1.0.8.10? I just get a blank trying to use the new version, but 1.0.8.8 works fine. Daniel Andersson 2011-04-24 08:54:47 UTC The directory structure is different between 1.0.8.8 and 1.0.8.10, and for 1.1.2 GeSHi seems to be completey remade. So SourceBlock needs to be remade as well I guess? Daniel Andersson 2011-04-27 08:41:55 UTC Hi I've just done a fresh install, apart from some apache rewrites its all pretty standard so far. I'm having the strange issue that when I attempt to post a script the GetCode link has the wrong num=X, should start at 1 but they're starting at 2. Even in Site/Side bar... interestingly though num=1 works on Main/HomePage.. Just to confirm I just did a reinstall skipping any unneeded steps and I'm getting this on all my BlogIt posts. Nov 3 2010 DStark?
I encountered the problem that the Link GetCode is no longer written as GetCode but now with A workaround is to add SDV($SourceBlockLinkText, "Get Code"); before the include_once line. This breaks the automatic localisation. Maxim? October 31, 2009, at 07:48 AM
Question: Is there an easy way to add a little expand/collapse button to expand or collapse the source code block. I have code that has 100s of line of code and will be helpful. Thanks. -Shah April 23, 2009 at 02:18 PM Nevermind - It was quite easy to implement, I just used Toggle - Shah Regarding leading whitespace trimming: for many languages, the whitespace is significant and the first line might contain leading whitespace. If I change line 147 to restrict the trim characters:
if(!@in_array('trim', (array)$opt['-'])) $block = trim($block, "\n\r");
it behaves as I'd like - it still trims line breaks so you don't have to cram the first line after the SourceBlock is very nice and works well but I find that some of the colors really hard to read. I assume that Provided that:
<div class='sourceblock MYCLASS' id='...'> <div class='sourceblocktext'>COLORIZED SOURCE CODE HERE</div> <div class='sourceblocklink'>...</div> </div> You may use you own CSS definition such as:
.MYCLASS .LANG .kw1 { ... }
Please refer to the Local customization files and the GeShi documentation for further details on what styles to define and how to enable them on your pages. --Dfaure April 02, 2009, at 07:35 AM
Leading whitespace on the first line is lost. This is a feature. Use the -trim option to prevent this behavior. --Dfaure April 02, 2009, at 06:21 AM
What is the recommended way of changing colors? You may either use the id=... or class=... parameters associated with your own stylesheet definition, or alter the $GeshStyles global variable --Dfaure June 11, 2008, at 07:54 AM
I like SourceBlock very much and without external files it works for me like a charm. But I just can't get external files running. I installed LinkedResourceExtras and as an "enduser" didn't configure anything else - although this feels a little wrong because the receipe for LinkedResourceExtras says to I tried [EDIT: deleted the wrong ones]
and only get empty code blocks. Thanks for any help! Frank - October 12, 2007, 7:20 PM The LinkedResourceExtras must be includes before SourceBlock to be taken in account. Then the dedicated markup is simply (:source FILE_SPECIFICATION PARAMS:).--Dfaure October 14, 2007, at 04:40 AM
I get an error when I try to use lang=html for some reason. If I just sub lang=php, it will highlight html, but I'm confused, since html is in the list of languages at geshi. As an example, here http://baldwinsoftware.com/wiki/pmwiki.php?n=Public.Penwell1 I am now using lang=php, because when I try to use lang=html, I get GeSHi Error: GeSHi could not find the language html (using path /home/content/29/5132729/html/wiki/cookbook/geshi/geshi/) (code 2) tonybaldwin June 03, 2011, at 08:15 AM This is a GeSHi idiosyncrasy. They have the file name as html4strict for html formatting. So you need to do the following:
--tamouse November 09, 2011, at 08:00 AM
Talk page for the SourceBlock recipe (users). |