Textile ( http://drupal.org/project/textile ) formatted text are displayed verbatim in atom feed, without parsing. The RSS feed does parse the filter correctly.

CommentFileSizeAuthor
#6 atom.module.diff.txt1.11 KBdrumm

Comments

Robert Daeley’s picture

Title: Does not work with Textile filter » Does not work with Markdown filter, either

The same issue seems to be taking place with the Markdown module as well.

Robert Daeley’s picture

Title: Does not work with Markdown filter, either » Does not work with Textile or Markdown filters
Robert Daeley’s picture

After a bit of investigation, I've come up with a temporary solution to this problem, at least for the Markdown format (I don't have Textile installed, so someone else will have to confirm).

If you check out the raw XML file atom.module creates, it is creating a proper Atom file with and fields. The atom.module fills these in with the contents of the "teaser" and "body" fields for each node. So far so good.

Strangely, the teaser field is getting formatted correctly -- in other words, the Markdown markup is being converted to regular HTML, as it should be (and as it is on the regular webpage). But the body field atom.module is filling in is the raw Markdown, sans conversion.

Spending a bit of time familiarizing myself with the system, I've not tracked down the exact problem (though I suspect it might be a problem with the node_invoke_nodeapi usage here), but my temporary fix is to simply replace the line (line 179 in my copy of atom.module) that reads

$output .= check_markup($item->body);

with this:

$output .= check_markup($item->teaser);

All this does is use the same command as on line 173 just above, which calls the properly formatted teaser.

This is not a permanent solution by any means, and is also at the whims of whether or not you use teasers and/or excerpts, but it takes care of things for me until the real fix is in.

Robert Daeley’s picture

UPDATE: After yet more experimentation, I've discovered the following:

1. atom.module apparently uses the default Input Format to display the body version of the story.
2. If that Input Format is *not* Markdown-capable, the story will not display properly.
3. If it *is* Markdown-capable, but certain HTML tags are forbidden, it will *not* display those.

Although this additional temporary solution isn't for everybody, if you allow Markdown in your default Input Format, and include appropriate HTML formatting+filtering, you will take care of the problem for now.

chrisada’s picture

I can confirm that setting the default format to use atom makes the feed appears with the atom filter applied.

drumm’s picture

Title: Does not work with Textile or Markdown filters » Filter content only once
StatusFileSize
new1.11 KB

Currently, $node->teaser and ->body are passed to check_markup() on output. At this point the content has already been filtered with the node's default input format. The second call is unnecessary and removes important allowed markup.

drumm’s picture

Status: Active » Needs review
chrisada’s picture

drumm, I just tried your patch. While it makes sense to not check_markup() on output, this does not fix the problem of default filters being applied to all nodes in feeds, instead of node-specific filters.

pete@fiddley.com’s picture

Status: Needs review » Active

Before creating a patch, can someone check if this is really doing what I think it is...

Changed line 141 of atom.module from:
node_invoke($item, 'view', TRUE, FALSE);

To:
node_invoke($item, 'view', TRUE);

The filter_hook doesn't require the 4th parameter and may have been overriding the 3rd.

furmans’s picture

I also found that the module was only applying the default filter on my site as noted in #5. I want the module to apply the filter of the node and display that in the feed. I'd like to see this behavior in the default blog/feed too. Here's my solution for the fixing the atom feed...

Line 173 of atom.module:
change:
$output .= check_markup($item->teaser);
to:
$output .= check_markup($item->teaser, $item->format, FALSE);

Line 179 of atom.module:
change:
$output .= check_markup($item->body);
to:
$output .= check_markup($item->body, $item->format, FALSE);

That works for me. You can check the results at my website: American Inventor Spot

deekayen’s picture

Status: Active » Fixed

Committed #10 to DRUPAL-5, DRUPAL-4-7, and DRUPAL-4-6. Yes, I know the furmans version does have redundancy, but atom can't predict what the node_prepare() is going to do when invoking the view hook in a totally different module.

Anonymous’s picture

Status: Fixed » Closed (fixed)