Textfilters in AtomPub

1 view
Skip to first unread message

Alexander

unread,
Aug 31, 2010, 1:18:26 PM8/31/10
to habari-users
I'm using the habarimarkdown module and write my posts in an external
editor.

Everything works nice and If I edit online I've still got my raw
Markdown content - just like expected.
But if I want to edit a post in the external editor Habari sends me
the converted HTML and not the raw Markdown code I really expect and
want.

Is there a way to turn off the filter for the AtomPub, while keeping
it on for the normal Atom feed?

I had this problem with every text filter I tried and I can't imagine
that this behaviour is intended.

Alex

Alexander

unread,
Sep 4, 2010, 4:26:24 PM9/4/10
to habari-users
Since it seems no one else this problem, or there is no good solution
for this problem I'll just post what I'm using right now.

I only allow the call to atom_get_collection in get_collection in
atomhandler.php if the request is not authenticated. Since I'm the
only user that uses authenticated feeds it works for me, but it's a
quite dirty hack and I'd be really happy if anyone had a better
solution to this problem.

Alex

--- atomhandler.php (revision 4299)
+++ atomhandler.php (working copy)
@@ -773,7 +773,10 @@

$xml = $this->add_posts($xml, $posts );

- Plugins::act( 'atom_get_collection', $xml, $params,
$handler_vars );
+ if ( !$this->is_auth() ) {
+ Plugins::act( 'atom_get_collection', $xml, $params,
$handler_vars );
+ }
+
$xml = $xml->asXML();

ob_clean();

Colin

unread,
Sep 5, 2010, 11:03:38 AM9/5/10
to habari...@googlegroups.com
Hi Alexander

I don't use either the Markdown plugin (I like my content to be in HTML) nor use AtomPub  (I may if you know a good cross platform - *nux & Mac - client), but your can understand the situation you're in.

One method is indeed to change the atomhandler.php as you have done, but a better solution would be to change the plugin itself.

I suspect most plugin authors of plugins that modify feeds only consume the end result and don't actually use the AtomPub functionality.

I'll take a look at the various plugins and the Habari code when I've got a free moment (hopefully in the afternoons this week) to see if I can come up with a better solution. First thing I need to do is get myself an AtomPub client to test with :-)

Cheers,
Colin


--
To post to this group, send email to habari...@googlegroups.com
To unsubscribe from this group, send email to habari-users...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/habari-users



--
Colin Seymour
Blog: http://colinseymour.co.uk
Tech Stuff: http://lildude.co.uk
Barefoot Running: http://barefootrunner.co.uk
IRC: lildude #habari

Alexander

unread,
Sep 6, 2010, 5:07:31 AM9/6/10
to habari-users
I just noticed I somehow messed up the above statement & patch.

The fix has to be in add_posts not atom_get_collection.

Anyway I tried fixing the plugin first, since it has an
action_atom_add_post function, but I could not figure out how to
differentiate between a normal Atom Feed and the AtomPub response.
This is the complicated part, since of course I want the normal Atom
Feeds to display the converted text and only the AtomPub should
respond with the raw text.

Thanks for the offer to help.
Alex

Colin

unread,
Sep 6, 2010, 12:16:10 PM9/6/10
to habari...@googlegroups.com
Hi Alex

I've now rectified this issue in the plugin.  Now when authenticated viewers view the feed, they'll get the markdown syntax rather than the formatted HTML syntax. Unauthenticated (ie normal viewers) will not see the markdown syntax.

Download 0.4.5 of this plugin (avail at http://www.habariproject.org/dist/plugins/habarimarkdown/ )  for your particular Habari revision (0.6.4 or trunk) to get the change.

Cheers,
Colin


--
To post to this group, send email to habari...@googlegroups.com
To unsubscribe from this group, send email to habari-users...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/habari-users

Alexander

unread,
Sep 13, 2010, 6:03:44 AM9/13/10
to habari-users
Hi Colin,

thanks a lot for the patch. It works perfectly for me and what I need.

I just wanted to add that there are situations when there might be
authenticated users that still want the filtered posts. (For private
posts for example)

I'm not sure if this problem can be solved, since I really don't
understand the AtomPub specifications well enough. If I have time I'll
try to have a look at how other CMS engines handle this problem.

Alex

On 6 Sep., 18:16, Colin <lild...@gmail.com> wrote:
> Hi Alex
>
> I've now rectified this issue in the plugin.  Now when authenticated viewers
> view the feed, they'll get the markdown syntax rather than the formatted
> HTML syntax. Unauthenticated (ie normal viewers) will not see the markdown
> syntax.
>
> Download 0.4.5 of this plugin (avail athttp://www.habariproject.org/dist/plugins/habarimarkdown/)  for your
Reply all
Reply to author
Forward
0 new messages