Content last modified Monday 6 March 2017
hop to #bottom
Categories:
Author:
Current version:
0.3
About It:
Get it:
Rate it:
  • Helpful?
  • 0 Yes
  • 0 No
Flag it:
Contact Reason [ ? ]

glx_code

This plugin implements Dunstan’s ideas of code presentation

Parameters
file
subtext
sublinktext
olclass

Example tags
<txp:code file="1" />

Example: In swedish, but you can see it in action

Thanks to Compooter for the pound sign comment.

Article Request Count:
Initially released:
2004-09-05
Posted here:
03 Mar 2005
Article modified:
17 Mar 2005

If there is a comment form at the Information URL, you may want to leave your comments/questions there or at the Forum thread for quicker feedback. Otherwise, comment away:

Your comment will NOT be submitted until you click the 'Submit' button on the next pageload.

Commented (1)

Since Johan’s site is down. I have re-encoded the plugin from the source in my old site. Please find it below:

# glx_code v0.3 # Transforms a txt-file to a nice code presentation. # Johan Nilsson # http://johan.galaxen.net/

# ...................................................................... # This is a plugin for Textpattern – http://textpattern.com/ # To install: textpattern > admin > plugins # Paste the following text into the ‘Install plugin’ box: # ......................................................................

YTo5OntzOjc6InZlcnNpb24iO3M6MzoiMC4zIjtzOjY6ImF1dGhvciI7czoxMzoiSm9oYW4g
Tmlsc3NvbiI7czoxMDoiYXV0aG9yX3VyaSI7czoyNToiaHR0cDovL2pvaGFuLmdhbGF4ZW4u
bmV0LyI7czoxMToiZGVzY3JpcHRpb24iO3M6NTA6IlRyYW5zZm9ybXMgYSB0eHQtZmlsZSB0
byBhIG5pY2UgY29kZSBwcmVzZW50YXRpb24uIjtzOjQ6InR5cGUiO2k6MDtzOjQ6Im5hbWUi
O3M6ODoiZ2×4X2NvZGUiO3M6NDoiaGVscCI7czoxMTU2OiIKPHA+VGhpcyBwbHVnaW4gaW1w
bGVtZW50cyBEdW5zdGFucyBpZGVhcyBvZiBjb2RlIHByZXNlbnRhdGlvbjwvcD4KPHA+RHVu
c3RhbnMgcG9zdDogPGEgaHJlZj0iaHR0cDovL3d3dy4xOTc2ZGVzaWduLmNvbS9ibG9nL2Fy
Y2hpdmUvMjAwNC8wNy8yOS9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4iXG4iLiI8L29sPiIuIlxuIjsKCgl9CgllbHNlCgl7CgkJJGxpc3QgPSAiPHA+
PHN0cm9uZz4iLiRmaWxlbmFtZS4iIG5vdCBmb3VuZC48L3N0cm9uZz48L3A+IjsKCX0KCgkv
LyByZXR1cm4gdGhlIGxpc3QKCXJldHVybiAkbGlzdDsKCn0KCgoiO3M6MzoibWQ1IjtzOjMy
OiJhMDcxYTMzOTFmNzNmNDRjN2MxNzNiMTA1OWVmOWFkNiI7fQ==

Subscribe to this article's comments RSS feed. [ ? ]   View Recent Comments across the site.

You know you want to visit the Archives.

Browse

Categories


Articles

There are also tag clouds, 'cause those are fun.
Published with Textpattern