Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-01-10 13:02:45

net-carver
Archived Plugin Author
Registered: 2006-03-08
Posts: 1,648

[textile] New test branch: extending Textile's block-level handling via plugins

All

Due to receiving multiple requests for new, block-level elements, please check out & try this zip.

This is my first shot at opening up textile to plugins.

Textplugs are small php additions that extend textile, if they are present and enabled, allowing it to do new tricks, or change the way it does old ones. They are totally optional, the core textile features all work without them. Only block-level handlers are supported at the moment but I want to see if this can be extended to both glyphs and spans (phrase modifiers) too.

Last edited by net-carver (2011-01-21 13:15:20)


Steve

Offline

#2 2011-01-21 13:08:59

net-carver
Archived Plugin Author
Registered: 2006-03-08
Posts: 1,648

Re: [textile] New test branch: extending Textile's block-level handling via plugins

All

Autoloading of textile plugins (hereafter known as textplugs) has been added, as have two new examples of block-level handlers for horizontal rule (via hr.) and syntax highlighted php code (via bcphp.)

Here’s how to try this out…

  • Install a test copy of textpattern on a localhost site.
  • Download the zip
  • Open the zip and over-write your textpattern installation’s classTextile.php with the one from the zip and follow the instructions in extending textile to enable the textplugs.
  • Try them out.
  • Let me know (below) how it goes.
  • Write your own and submit them!

Steve

Offline

#3 2011-01-22 23:45:03

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: [textile] New test branch: extending Textile's block-level handling via plugins

Pretty great stuff, these TextPlugs. The plugin author inside me appreciates — must feature imo. Would be great if the feature was available even when Textile is in lite mode (blocks are not allowed in Lite), but this is good start nonetheless.

Today (or correctly yesterday for me) at the IRC channel (#textile@irc.freenode.net) Steve asked if I have had change to play with textplugs. Actually, I haven’t even noticed that there were Textile plugins, so I took look.

Using Textplugs is pretty easy, just couple lines of code and that’s pretty much it. To test the things out, I came up with small example plugin:

Textile::RegisterBlockHandler('tags', '_textile_tags_block_handler');
function _textile_tags_block_handler($textile, $tag, $att, $atts, $ext, $cite, $o1, $o2, $content, $c2, $c1, $eat)
{
	if($tag === 'tags') {
		$content = trim($content);
		if($content !== '') {
			$content = explode(' ',$content);
			foreach($content as &$keyword) 
				$keyword = '<a rel="tag" href="' . $textile->shelve($textile->relURL( '/tags/' . $keyword )) . '">' . $keyword . '</a>';
			$content = implode(' ',$content);
		}
	}
	return array($o1, $o2, $content, $c2, $c1, $eat);
}

The code adds new blocktag called tags. that turns list of words into linked tags. You could think them as hashtags, w/o hashes. Small usage example you say? Sure:

tags. foo bar cat home

Would output:

<a href="/tags/foo">foo</a> <a href="/tags/bar">bar</a> <a href="/tags/cat">cat</a> <a href="/tags/home">home</a>

Not the best example, but it shows that the feature is very powerful and usable.

Offline

#4 2011-01-23 00:28:16

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: [textile] New test branch: extending Textile's block-level handling via plugins

Documentation (extending textile) says:

If you write a new textplug then your file name must follow a string filename
convention.

{plugname}.textplug.php

Where {plugname} is definable by the textplug author but, in the case of
block-level textplugs, this should match the name of the block being added.

This seems to imply that a block-level textplug can handle only a single tag.
If so, then why is the tag name supplied as an argument to the block_handler function?
Can’t the if ($tag == constructs be removed from block handlers?

Offline

#5 2011-01-23 01:12:04

net-carver
Archived Plugin Author
Registered: 2006-03-08
Posts: 1,648

Re: [textile] New test branch: extending Textile's block-level handling via plugins

Hi Ruud,

That is very early documentation. Emphasis on ‘should’ (it’s not a ‘must’). If the textplug implements one extension block then I’d prefer the file name reflect the new block name. However, Textplugs can implement as many block handlers as you like and you could indeed map many tags back to one handler function if you so wished.

Coincidentally, I just posted an example of a textplug that does add multiple blocks to textile, and experiments with allowing glyph replacements to be modified too.


Steve

Offline

#6 2011-01-23 12:38:31

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: [textile] New test branch: extending Textile's block-level handling via plugins

Just wrote my first Textplug … for an experimental branch off my “doc-updates” branch

[tangled amidst all the git branches :-b]

A couple of general notes:

I had to edit the txp_plugin_directory definition to dirname(__FILE__) . DIRECTORY_SEPARATOR . 'textplugs-enabled' for use with the help viewer. I presume this would apply whenever including classTextile.php from outside its directory.

I made a nitpicky edit to the example bcphp textplug:

$o1 = '<p'.$atts.'>';

because $atts will already have a leading space if required.


Code is topiary

Offline

#7 2011-01-23 13:25:33

net-carver
Archived Plugin Author
Registered: 2006-03-08
Posts: 1,648

Re: [textile] New test branch: extending Textile's block-level handling via plugins

Jukka

Thanks for trying out textplugs and glad you like them. You’re suggestion about allowing them in lite modes has been noted but am a little wary of that, at least for now, as I can imagine a poorly executed textplug (let’s say used in comments) might well become a security risk.

Ruud

Looking at the documentation you quoted after a good sleep, yes, it needs clarification and extension. Noted.

Jeff

Re: txp_plugin_directory good catch.

Re: bcphp. FWIW, that one’s an external submission from the collaborator on a German CMS (iirc) that also uses textile. I have his permission to use the code, and I wrestled it into a textplug, but I’m waiting on his choice of attribution and linkback url for the comment block. Good to see textile adoption in other projects.


Steve

Offline

#8 2011-01-23 18:24:26

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: [textile] New test branch: extending Textile's block-level handling via plugins

Some explanation on what all the block_handler function parameters mean/are would be nice as well. That will definitely make it easier for people to write their own textplugs.

Offline

#9 2011-01-31 05:36:10

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: [textile] New test branch: extending Textile's block-level handling via plugins

If you’re Textpattern user interested in playing with textplugs, I have crafted a small (and experimental) plugin for Textpattern. The plugin allows installing, disabling and uninstalling textplugs via a nice little admin interface.

You can get the thing, for now named as rah_textplug, from here and try it out:

# Name: rah_textplug vdev 
# Type: Admin only plugin
# RahLab Experiment: TextPlug GUI.
# Author: Jukka Svahn
# URL: http://rahforum.biz
# Recommended load order: 5

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

YToxMTp7czo0OiJuYW1lIjtzOjEyOiJyYWhfdGV4dHBsdWciO3M6NjoiYXV0aG9yIjtzOjEx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xsIHRoZSBvbGQgdmVyc2lvbiBi
ZWZvcmUgcHJvY2VlZGluZy4nKTsNCgkJCXJldHVybjsNCgkJfQ0KCQkNCgkJJGZpbGUgPSBn
ZXRfdXBsb2FkZWRfZmlsZSgkX0ZJTEVTWydyYWhfdGV4dHBsdWcnXVsndG1wX25hbWUnXSk7
DQoJCQ0KCQlpZigkZmlsZV9tYXhfdXBsb2FkX3NpemUgPCBmaWxlc2l6ZSgkZmlsZSkpew0K
CQkJcmFoX3RleHRwbHVnX2xpc3QoJ0ZpbGVzaXplIGlzIHRvbyBiaWcuJyk7DQoJCQlyZXR1
cm47DQoJCX0NCgkJDQoJCWlmKCFzaGlmdF91cGxvYWRlZF9maWxlKCRmaWxlLCAkcmFoX3Rl
eHRwbHVnWydkaXInXSAuIERTIC4gJG5hbWUpKSB7DQoJCQlyYWhfdGV4dHBsdWdfbGlzdCgn
VXBsb2FkaW5nIGZhaWxlZC4nKTsNCgkJCXJldHVybjsNCgkJfQ0KCQkNCgkJcmFoX3RleHRw
bHVnX2xpc3QoJ0luc3RhbGxlZCB0aGUgcGx1Z2luICcuaHRtbHNwZWNpYWxjaGFycygkbmFt
ZSkuJy4gWW91IGNhbiBub3cgYWN0aXZhdGUgaXQuJyk7DQoJfSI7czo0OiJ0eXBlIjtzOjE6
IjMiO3M6NToiZmxhZ3MiO3M6MToiMCI7czo1OiJvcmRlciI7czoxOiI1IjtzOjM6Im1kNSI7
czozMjoiNmY0NWIzOGIwZmQ0ZjU3YmJmZjhmZGU2YmY2ZjlkY2IiO30=

The plugin requires TXP v4.0.7 or newer, classTextile.php from block plugins branch and access to symbolic links. If installed on Windows server, at least Vista (or newer) and PHP 5.3.0 (or newer) are required.

Please, keep in mind that it’s experiment and development for funsies.

Edit. Embedded the plugin code to the post, removed download link.

Last edited by Gocom (2012-08-18 21:01:46)

Offline

Board footer

Powered by FluxBB