Forum: Typo Is there any kind of doc on how to write textfilter plugins?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Rick D. (Guest)
on 2009-03-25 04:46
(Received via mailing list)
Now that I've got my blog back on the air and up to Typo 5.2, I'm
starting
to get some ideas.
Recently I'd started adding a re-tweet button to each article using
tweetmeme.cm.  This is pair of javascript tags which are boilerplate,
except
for needing the url of the current page inserted.

This seems like a perfect opportunity for a textfilter which could turn
something like <tweetmeme/> into the javascript tags.

I guess I can suss out how to code and install a new plugin, but if
there's
some doc somewhere it would help.

--
Rick DeNatale

Blog: http://talklikeaduck.denhaven2.com/
Twitter: http://twitter.com/RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale
de Villamil Frédéric (Guest)
on 2009-03-25 14:09
(Received via mailing list)
Le 25 mars 09 à 03:26, Rick DeNatale a écrit :

> I guess I can suss out how to code and install a new plugin, but if
> there's some doc somewhere it would help.


OK, I see, there is definitely an international conspiracy organized
to have me write all the long missing documentation I've been too lazy
to write during the almost 3 years since I took over the project and
show how poor my English is just before I release 5.3...

I've written the typo macro doc, you can find it at
http://wiki.github.com/fdv/typo/how-to-create-your...

Please correct if you find any mistake.
Cheers,
Frédéric
--
Frédéric de Villamil
"What's mine is mine. What's yours is still unsetteled" – Go player
proverb
removed_email_address@domain.invalid                        tel: +33 (0)6 62 19 
1337
http://t37.net                       Typo : http://typosphere.org
Rick D. (Guest)
on 2009-03-25 15:21
(Received via mailing list)
2009/3/25 de Villamil Frédéric <removed_email_address@domain.invalid>

>> This seems like a perfect opportunity for a textfilter which could turn
> English is just before I release 5.3...
>
> I've written the typo macro doc, you can find it at
> http://wiki.github.com/fdv/typo/how-to-create-your...


Bravo Frédéric!
Your English is excellent, certainly better than my French!

So if I want the popup to show the permalink for the content it could
just
do

def self.macrofilter(blog,content,attrib,params,text="")
  %{<script
type="text/javascript">alert('#{content.permalink}');</script>}
end

 Right?

By the way, playing around with script/console, it looks like the sense
of
the only_path argument is reversed:

>> article = Article.find(:first)
=> #<Article id: 2, type: "Article", title: "On Hunting Ducks", author:
"rdenatale", body: "Five doctors go duck hunting, they draw lots to
det...",
extended: "Last week, I ran across a thread on the ruby forum ...",
excerpt:
"", keywords: "types oop", created_at: "2006-07-26 15:39:07",
updated_at:
"2009-03-24 07:05:39", user_id: 1, permalink:
"my-favorite-duck-typing-story", guid:
"be83a184-9f5b-4ab2-97de-de47263fa986", text_filter_id: 5, whiteboard:
nil,
name: "", published: true, allow_pings: true, allow_comments: true,
published_at: "2006-07-26 15:39:00", state: "just_published">
>> article.permalink_url
=> "
http://talklikeaduck.denhaven2.com/2006/07/26/my-f...
>> article.permalink_url(nil, false)
=> "/2006/07/26/my-favorite-duck-typing-story"
>> article.permalink_url("foo", false)
=> "/2006/07/26/my-favorite-duck-typing-story#foo"
>> article.permalink_url(nil, true)
=> "
http://talklikeaduck.denhaven2.com/2006/07/26/my-f...

Note that if the second argument is true (which is also the default
value,
that the entire url is returned, not just the path, if it's false you
get
just the path.

--
Rick DeNatale

Blog: http://talklikeaduck.denhaven2.com/
Twitter: http://twitter.com/RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale
Rick D. (Guest)
on 2009-03-25 17:18
(Received via mailing list)
On Wed, Mar 25, 2009 at 9:00 AM, Rick DeNatale
<removed_email_address@domain.invalid>wrote:

>
>
I did find one missing end in the article on the wiki page.

And I quickly banged out my plugin,

published it on git hub
http://github.com/rubyredrick/typo_tweetmeme/tree/master

blogged about it
http://talklikeaduck.denhaven2.com/2009/03/25/a-ty...

published it on git hub
http://github.com/rubyredrick/typo_tweetmeme/tree/master

And  added to the list of 3rd party plugins on the wiki.
http://wiki.github.com/fdv/typo/typo-plugins-list


--
Rick DeNatale

Blog: http://talklikeaduck.denhaven2.com/
Twitter: http://twitter.com/RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale
de Villamil Frédéric (Guest)
on 2009-03-25 18:14
(Received via mailing list)
Le 25 mars 09 à 15:38, Rick DeNatale a écrit :

> Your English is excellent, certainly better than my French!
> http://talklikeaduck.denhaven2.com/2009/03/25/a-ty...
>
> published it on git hub
> http://github.com/rubyredrick/typo_tweetmeme/tree/master
>
> And  added to the list of 3rd party plugins on the wiki.
> http://wiki.github.com/fdv/typo/typo-plugins-list
>
>


OH MY GOD!!! A Typo plugin I didn't write :-) It's gonna rain gold
tonight.

Cheer :-)
Frédéric

--
Frédéric de Villamil
"What's mine is mine. What's yours is still unsetteled" – Go player
proverb
removed_email_address@domain.invalid                        tel: +33 (0)6 62 19 
1337
http://t37.net                       Typo : http://typosphere.org
This topic is locked and can not be replied to.