Recent Changes - Search:

Cookbook

PmWiki

pmwiki.org

SourceBlock-Talk

back to SourceBlock

Please leave the latest message at the top.

I encountered the problem that the Link GetCode is no longer written as GetCode but now with [$[Get Code]] ... -Markus October 12 2009

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 [@, so the wikisource is more readable. How about adding a variable in config.php to control this? Maxim? April 03, 2009, at 05:15 AM

SourceBlock is very nice and works well but I find that some of the colors really hard to read. I assume that id=ID, class=CLASS can be used in some way to modify the colors ... but how should they be used, I couldn't find an example of how to use it. j 2009-04-01

Provided that:
  • The recipe configures Geshi to work using classes.
  • The (:source lang=LANG class=MYCLASS:) ... markup result will (by default) be encapsulated into the following <div> hierarchy:
<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 include_once('cookbook/extlinkedres.php'); which I couldn't find in sourceblock.php. Could you please give a complete example for an external file, e.g. http://www.gnu.org/licenses/fdl.txt?

I tried [EDIT: deleted the wrong ones]

(:source http://www.gnu.org/licenses/fdl.txt :)

(:source http://www.gnu.org/licenses/fdl.txt :)

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

Talk page for the SourceBlock recipe (users).

Edit - History - Print - Recent Changes - Search
Page last modified on October 31, 2009, at 07:48 AM