Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
[plugin] [ORPHAN] ako_syntax
ako_syntax
Syntax highlighting for CSS, PHP and (X)HTML
This is, as Marios requested, a syntax highlighting plugin. It is, for those of you interested in more of the details, it’s a port of the Visual.Syntax plugin for WP.
I’m releasing it right now as beta. That is, I think everything works, but I haven’t had time to fully check it all out. I’m going to be away for a bit, with a highly questionable internet connection, but please do let me know of any bugs you all may find, or if there are any other features that you want with this plugin. I’ll try to stay in touch as much as is possible, but no guarantees (at least for the coming ~3wks)
As far as usage goes, just wrap a <code>< code >< /code ></code> or <code><css></css></code> block with <code><txp:ako_syntax></txp:ako_syntax></code>, and it should all work out well.
As well, it will automatically create a stylesheet with some default rules for some of the code. This should be named ako_syntax.
For now, ako_syntax only supports these tags:- wraptag – tag to wrap the output with
- class – class attribute to add onto the wraptag.
- Automatically run the plugin on any entry being created / updated
- Fix the output of PHP syntax highlighting from highlight_string() to uses classes and not inline styles (or, even worse, with PHP < 5, the dreaded font tags
- [Insert what you want here!]
Download v.1
(no help file yet)
Last edited by akokskis (2006-07-07 05:29:05)
Offline
#2 2006-07-07 05:56:24
- marios
- Archived Plugin Author
- Registered: 2005-03-12
- Posts: 1,253
Re: [plugin] [ORPHAN] ako_syntax
EDIT.: Reformatting works well, I forgot to wrap the samples in code blocks, I haven’t tested this in-depth yet,
I’ll do a couple of styles for this in the next couple of days.
regards, marios
Last edited by marios (2006-07-07 06:05:44)
⌃ ⇧ < ⎋ ⌃ ⇧ >
Offline
#3 2006-08-04 10:42:47
- marios
- Archived Plugin Author
- Registered: 2005-03-12
- Posts: 1,253
Re: [plugin] [ORPHAN] ako_syntax
The class selectors are inserted are iserted insteaed of the properties.
An arbitrary code sample:
<code><span style=“color: #000000”>
<div class=“postleft”><span class=“syntax-dl”><dl></span><span class=“syntax-dt”><dt></span><span class=“syntax-strong”><strong></span><a href=“profile.php?id=4461”>marios<span class=“syntax-a”></a></span><span class=“syntax-strong”></strong></span><span class=“syntax-dt”></dt></span><dd class=“usertitle”><span class=“syntax-strong”><strong></span>mu<span class=“syntax-strong”></strong></span><span class=“syntax-dd”></dd></span><dd class=“postavatar”><img src=“img/avatars/4461.png” width=“60” height=“60” alt=”“ /><span class=“syntax-dd”></dd></span> <span class=“syntax-p”><p></span><span class=“syntax-dd”><dd></span>From: Greece<span class=“syntax-dd”></dd></span><br /><span class=“syntax-dd”><dd></span>Known languages: de-el-en-(some-fr),meta-idiotics<span class=“syntax-dd”></dd></span><br /><span class=“syntax-dl”></dl></span><br /><span class=“syntax-div”></div></span></span>
</code>
Another problem I ran into are the html entities, if I run textile on it
and when textile is switched off I get the line rewrapping on samples if I use the pre tag as well.
regards, marios
⌃ ⇧ < ⎋ ⌃ ⇧ >
Offline
Re: [plugin] [ORPHAN] ako_syntax
marios wrote:
The class selectors are inserted are iserted insteaed of the properties.
Do you mean to say that it’s not actually colouring the code? If so, then you just need to use the stylesheet. There should be a stylesheet automatically created, with the name of “ako_syntax,” that has all the colours for the text.
Or am I misunderstanding what you mean by this?
Offline
#5 2006-08-04 17:58:25
- marios
- Archived Plugin Author
- Registered: 2005-03-12
- Posts: 1,253
Re: [plugin] [ORPHAN] ako_syntax
ok, sorry I’ve got it working.
I did some light testing on this .
The coloring works. (I had forgotten also to reference the style sheets in the page templates.)
I can override the default styles by inserting an important statement for each rule in the stylesheet.
One more observation.
The span wrapping does not work, for elements that do contain properties and property values.
It will display normally, since it is textiled but uncolored, since it will not get the usual span tag wrapping.
Here is the corresponding line from from my source sample:
<code><table border=“0” cellspacing=“5” cellpadding=“5”></code>
regards, marios
Last edited by marios (2006-08-04 17:59:27)
⌃ ⇧ < ⎋ ⌃ ⇧ >
Offline
Re: [plugin] [ORPHAN] ako_syntax
Do you happen to have a URL I could take a look at? Kind of confused by what you mean.
Offline
#7 2006-08-04 20:29:43
- marios
- Archived Plugin Author
- Registered: 2005-03-12
- Posts: 1,253
Re: [plugin] [ORPHAN] ako_syntax
Sorry for the delay, I had to port it over to a live install.
<a href=“http://development.cybermarios.com/about/testing-syntax-hilighting”>Testpage</a>
One note for the wraptag option. A class attribute for the wraptag would be usefull.
That way, you could distinguish later on your code blocks according to language.
regards, marios
Last edited by marios (2006-08-04 21:27:32)
⌃ ⇧ < ⎋ ⌃ ⇧ >
Offline
Pages: 1