Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2004-09-05 15:24:23

osei
Plugin Author
From: Stockholm, Sweden
Registered: 2004-07-01
Posts: 178
Website

[archived] glx_code: Dunstans code presentation

Notice: This thread is archived, this plugin is no longer available.

**********************************************************

Version: 0.3
Name: glx_code

Hi!

I have made a txp plugin of Dunstans code presentation php code that is demonstrated here

Here is an example from my own site.

dont forget to make a /code folder to place your code txt files in.

Edit: new version

Last edited by osei (2005-01-18 09:20:19)


Johan Nilsson

Offline

#2 2004-09-05 15:54:19

Andrew
Plugin Author
Registered: 2004-02-23
Posts: 730

Re: [archived] glx_code: Dunstans code presentation

That is definitely a good idea/implementation. Nice work. Color-coding would be a nice addition, but that is a much bigger endeavour.

Offline

#3 2004-09-05 18:10:58

ramanan
Plugin Author
From: Toronto
Registered: 2004-03-12
Posts: 323
Website

Re: [archived] glx_code: Dunstans code presentation

Beautiful! Well done. I’m going to start using this right now.

Offline

#4 2004-10-06 17:42:06

Andrew
Plugin Author
Registered: 2004-02-23
Posts: 730

Re: [archived] glx_code: Dunstans code presentation

Hey I just noticed that it doesn’t recognize comments that use ‘#’.

EDIT

Add this line near the comment type definitions:
<pre>$pound_pos = strpos($line, "#");</pre>

Change this line about 10-15 lines past that,

FROM:
<pre>// if its a single line comment
if (($slashslash_pos===0) || ($apos_pos===0))</pre>

TO:
<pre>// if its a single line comment
if (($slashslash_pos===0) || ($apos_pos===0) || ($pound_pos===0))</pre>

Last edited by compooter (2004-10-06 17:48:19)

Offline

#5 2004-10-06 20:28:34

osei
Plugin Author
From: Stockholm, Sweden
Registered: 2004-07-01
Posts: 178
Website

Re: [archived] glx_code: Dunstans code presentation

ahh thanks compooter, ive updated the plugin with your code hope thats okey, link is found in the first post.

Last edited by osei (2004-10-06 20:29:00)


Johan Nilsson

Offline

#6 2004-10-06 20:29:41

Andrew
Plugin Author
Registered: 2004-02-23
Posts: 730

Re: [archived] glx_code: Dunstans code presentation

thx!

Offline

#7 2004-10-26 18:32:50

domfucssion
Plugin Author
Registered: 2004-10-23
Posts: 39

Re: [archived] glx_code: Dunstans code presentation

hi, being a bit thick and not being able to understand languages like swedish, I can’t get it to work…

i have a made a code folder inside my site folder and a txt file called 1.txt. the tag i am using in my article looks like:

txp:code file=“1”

but nothing shows up in the browser – any one got any ideas?

Last edited by domfucssion (2004-10-26 18:33:16)

Offline

#8 2004-10-26 18:46:12

Andrew
Plugin Author
Registered: 2004-02-23
Posts: 730

Re: [archived] glx_code: Dunstans code presentation

Try:

<code><txp:glx_code file=“1” /></code>

instead of:

<code><txp:code file=“1” /></code>

D’oh! ;-)

Last edited by compooter (2004-10-26 18:46:24)

Offline

#9 2004-10-26 18:55:31

domfucssion
Plugin Author
Registered: 2004-10-23
Posts: 39

Re: [archived] glx_code: Dunstans code presentation

thanks compooter, that got it working, cheers

Offline

#10 2004-10-26 20:38:43

osei
Plugin Author
From: Stockholm, Sweden
Registered: 2004-07-01
Posts: 178
Website

Re: [archived] glx_code: Dunstans code presentation

oops… my bad here, the example in the plugins documentation says it should be <code><txp:code file=“1” /></code> but ofcourse like compooter says it should be <code><txp:glx_code file=“1” /></code>

The plugin has now been updated with a correct example. sorry.

edit: haha i did it again (typed wrong)

Last edited by osei (2004-10-27 07:17:55)


Johan Nilsson

Offline

#11 2004-10-28 22:24:59

Remillard
Plugin Author
From: Lenexa, KS
Registered: 2004-05-16
Posts: 169

Re: [archived] glx_code: Dunstans code presentation

This is a fantastic plugin. I used it extensively in the TXP 121 essay.

Out of curiosity, could you post a sample class that does what is shown on your page? I noticed the default behavior is a numbered list, but it adds a lot of clutter to the page and I’d like to eliminate it. I’ve tinkered with a few things but nothing’s really gone quite the way I wanted it.

Regards,
Remillard

Offline

#12 2004-10-28 22:56:11

osei
Plugin Author
From: Stockholm, Sweden
Registered: 2004-07-01
Posts: 178
Website

Re: [archived] glx_code: Dunstans code presentation

Hi

The Key classes are

  • source: this at the bottom of the code, where the download url is located
  • tab1 – tab6: If the code is tabbed
  • cmnt: Comments
  • code: Assigned to the ol tag

Hope this could help you a bit

A example css can be found at Dunstans blog entry to

This is what i use on my own page

<code>
ol.code { list-style-type: none; color: #2AA7DC; font-size: normal; font-family: Courier, monospace; margin: 0 10px 0 15px; overflow: auto; padding: 8px;
}
ol.code li { background-color: #F8F8F8; margin: 2px 0 0 0; padding: 0 5px; font-size: small;
}
ol.code li.source { background-color: #fff; color: #2395C4; padding: 5px; text-align: center; border-bottom: 1px solid #E8E6E6; font-family: verdana;
}
ol.code li.tab1 {padding-left: 15px;}
ol.code li.tab2 {padding-left: 30px;}
ol.code li.tab3 {padding-left: 45px;}
ol.code li.tab4 {padding-left: 60px;}
ol.code li.tab5 {padding-left: 75px;}
ol.code li.tab6 {padding-left: 90px;}

ol.code li code { color: #F45D0F;
}
ol.code li.cmnt code { color: #008000;
}
</code>


Johan Nilsson

Offline

Board footer

Powered by FluxBB