<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>svebee (English) &#187; Plugin</title>
	<atom:link href="http://en.svebee.com/tag/plugin/feed" rel="self" type="application/rss+xml" />
	<link>http://en.svebee.com</link>
	<description>Something about everything...</description>
	<lastBuildDate>Tue, 02 Jun 2009 14:05:40 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Syntax Highlighter/Code Snippet/Plugin</title>
		<link>http://en.svebee.com/52/syntax-highlightercode-snippetplugin</link>
		<comments>http://en.svebee.com/52/syntax-highlightercode-snippetplugin#comments</comments>
		<pubDate>Sun, 03 May 2009 14:56:23 +0000</pubDate>
		<dc:creator>svebee</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[Code Snippet]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[Syntax Highlighter]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://en.svebee.com/?p=52</guid>
		<description><![CDATA[
&#60;?php echo &#34;Syntax Highlighter&#34; . &#34;/Code Snippet/Plugin&#34;; ?&#62; &#60;br /&#62;

The one thing that I really needed was for easier editing and writing of my posts and putting source code onto my web-page/blog for viewing only, i.e. the code mustn&#8217;t be rendered (translated). Wordpress has one built-in, but it&#8217;s a little poor, something is translated, something [...]]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Syntax Highlighter&quot;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;/Code Snippet/Plugin&quot;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> &lt;br /&gt;</pre></div></div>

<p>The one thing that I really needed was for easier editing and writing of my posts and putting <strong>source code </strong>onto my web-page/blog for viewing only, i.e. the code mustn&#8217;t be <strong>rendered </strong>(translated). Wordpress has one built-in, but it&#8217;s a little poor, something is translated, something isn&#8217;t and similar. I was looking for some add-on/plugin which would have the capability to highlight/color some parts of code, i.e. code can be easy readable without any <strong>&#8220;translation“</strong> (for example <em>&lt;br&gt;</em> tag musn&#8217;t be rendered as a new line). I have found one interesting add-on called <strong><a href="http://ideathinking.com/blog-v2/?p=13">CodeHighlighter</a></strong> and from the beginning it seems quite good (also, it has the advantageous possibility to put line numbers at the left side of the code). But, when PHP code came up which contained HTML code (especially <em>&lt;br&gt;</em> tag) – it wasn&#8217;t translated properly, so the code which I didn&#8217;t wish to show wasn&#8217;t right, because the <em>&lt;br&gt;</em> tag wasn&#8217;t there. I tried to configure some files, add <em>&lt;br&gt;</em> tag in <em>Visual </em>layout, but all without any success – stupidly, he has translate it anyway.<span id="more-52"></span></p>
<p>Then, I was (again) looking for another plugin and found what I needed, simply named <strong><a href="http://wordpress.org/extend/plugins/wp-syntax/">WP-Syntax</a></strong>. It can <font color=orange>highlight/colour code</font>, add <strong>lines </strong>at left side (from any number) and you can choose the <strong>code language</strong> (<strong><a href="http://qbnz.com/highlighter/">full list</a></strong> of supported languages) when you add it. Here is how you add some source code to a post:</p>
<p style="text-align: center"><img style="margin: 5px" src="/images/syntax_highlighter_en.jpg" alt="Syntax Highlighter/Code Snippet/Plugin" /></a></p>
<p>The plugin which I wasn&#8217;t so enthusiastic about earlier (<strong><a href="http://ideathinking.com/blog-v2/?p=13">CodeHighlighter</a></strong>) and also the now mentioned <strong><a href="http://wordpress.org/extend/plugins/wp-syntax/">WP-Syntax</a></strong> are based on <em><a href="http://qbnz.com/highlighter/index.php">GeSHi</a></em> system which, as I have mentioned, support many avaliable languages.</p>
<p>Here are a few examples how it looks in real (codes are from <strong><a href="http://ideathinking.com/blog-v2/?p=13">CodeHighligher</a></strong> web-site).</p>
<p><strong>C++</strong></p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #0000ff;">class</span> nsScannerBufferList
<span style="color: #008000;">&#123;</span>
<span style="color: #0000ff;">public</span><span style="color: #008080;">:</span>
<span style="color: #ff0000; font-style: italic;">/**
  * Buffer objects are directly followed by a data segment. The start
  * of the data segment is determined by increment the |this| pointer
  * by 1 unit.
  */</span>
<span style="color: #0000ff;">class</span> Buffer <span style="color: #008080;">:</span> <span style="color: #0000ff;">public</span> PRCList
<span style="color: #008000;">&#123;</span>
<span style="color: #0000ff;">public</span><span style="color: #008080;">:</span>
Buffer<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
<span style="color: #000040;">++</span>index_<span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<p><strong>PHP (with start-line 5)</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>5
6
7
8
9
10
11
12
13
14
15
16
17
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span> <span style="color: #339933;">&lt;</span> <span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$utf8_string</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">++</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
<span style="color: #000088;">$value</span> <span style="color: #339933;">=</span> <span style="color: #990000;">ord</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$utf8_string</span><span style="color: #009900;">&#91;</span> <span style="color: #000088;">$i</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$value</span> <span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span> <span style="color: #cc66cc;">128</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #666666; font-style: italic;">// ASCII</span>
<span style="color: #000088;">$unicode</span> <span style="color: #339933;">.=</span> <span style="color: #990000;">chr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$values</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000088;">$num_octets</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$value</span> <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">224</span> <span style="color: #009900;">&#41;</span> ? <span style="color: #cc66cc;">2</span> <span style="color: #339933;">:</span> <span style="color: #cc66cc;">3</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000088;">$values</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$value</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p><strong>Perl (with start-line 1)</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #b1b100;">my</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$class</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$mail</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$orig</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">@_</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$new_list</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$class</span><span style="color: #339933;">-&gt;</span>_detect<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$orig</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">or</span> <span style="color: #000066;">return</span><span style="color: #339933;">;</span>
<span style="color: #0000ff;">$new_list</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">add_to_posts</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>mail <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">$mail</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">id</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #b1b100;">unless</span> Email<span style="color: #339933;">::</span><span style="color: #006600;">Store</span><span style="color: #339933;">::</span><span style="color: #006600;">List</span><span style="color: #339933;">::</span><span style="color: #006600;">Post</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">search</span><span style="color: #009900;">&#40;</span> mail <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">$mail</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">id</span><span style="color: #339933;">,</span>
        list <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">$new_list</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">id</span>
    <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p><strong>CSS</strong></p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">pre <span style="color: #00AA00;">&#123;</span>
<span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#ccc</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0em</span> <span style="color: #933;">0.5em</span><span style="color: #00AA00;">;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/* Browser specific (not valid) styles to make preformatted text wrap */</span>
<span style="color: #000000; font-weight: bold;">white-space</span><span style="color: #00AA00;">:</span> pre-wrap<span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* css-3 */</span>
<span style="color: #000000; font-weight: bold;">white-space</span><span style="color: #00AA00;">:</span> -moz-pre-wrap<span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* Mozilla, since 1999 */</span>
<span style="color: #000000; font-weight: bold;">white-space</span><span style="color: #00AA00;">:</span> -pre-wrap<span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* Opera 4-6 */</span>
<span style="color: #000000; font-weight: bold;">white-space</span><span style="color: #00AA00;">:</span> -o-pre-wrap<span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* Opera 7 */</span>
word-wrap<span style="color: #00AA00;">:</span> break-word<span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* Internet Explorer 5.5+ */</span>
#
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.strike</span> <span style="color: #00AA00;">&#123;</span>
<span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">line-through</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://en.svebee.com/52/syntax-highlightercode-snippetplugin/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
