Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

{% post_url ... %} erroring with rdiscount #75

Closed
pmarshwx opened this issue Feb 8, 2013 · 10 comments
Closed

{% post_url ... %} erroring with rdiscount #75

pmarshwx opened this issue Feb 8, 2013 · 10 comments

Comments

@pmarshwx
Copy link

pmarshwx commented Feb 8, 2013

When using krawdown or redcarpet parsers (or anything else for that matter) and attempt to do the following (using Octopress):

[post url]({% post_url 2012-09-15-understanding-tornado-risk %})

to link to an internal post, everything works fine.

However, when trying the same command but using the rdiscount parser I get the following error:

Liquid Exception: Tag '{%%20post_url%202012-09-15-understanding-tornado-risk%20%}' was not properly terminated with regexp: /%}/ in atom.xml

Being relatively new to Ruby, and still feeling my way around, I'm not sure what the problem is here, nor how to fix it. Heck, I'm not sure if this is a bug or if it is an error on my part! Any guidance would be appreciated. Thanks!

@davidfstr
Copy link
Owner

Works fine for me.

Since you're getting a Liquid exception, the problem must have something to do with your surrounding Liquid markup (ex: {% i_am_a_tag %}). This shouldn't be specific to any particular Markdown processor.

Try to isolate the problem by experimentally removing Liquid tags.

@pmarshwx
Copy link
Author

pmarshwx commented Feb 8, 2013

I have to admit, I'm not sure what you want me to experiment with?

When I replace the enclosing parenthesis with brackets, I get the following

[test post][{% post_url 2012-09-15-understanding-tornado-risk %}]

produced

[test post][/blog/2012/09/15/understanding-tornado-risk/]

Removing the brakets altogether

[test post]{% post_url 2012-09-15-understanding-tornado-risk %}

produces

[test post]/blog/2012/09/15/understanding-tornado-risk/

It appears that is has to do with how the link is being created. I've updated my version of liquid, rdiscount, etc thinking that might have been the culprit, but alas, nothing appears to be working here.

@davidfstr
Copy link
Owner

Try creating an empty Markdown post that only contains:

---
# Insert you required post metadata here
---
[post url]({% post_url 2012-09-15-understanding-tornado-risk %})

Do you still see the problem?

@pmarshwx
Copy link
Author

pmarshwx commented Feb 8, 2013

Wow... that actually works! Furthermore, when I copy and paste the content from a previous post into the new file, it still works! But why won't the original work? In full disclosure, the original posts were generated by exitwp.

The only difference between the two is the front matter

Working:

---
layout: post
title: "This Is A Test"
date: 2013-02-08 07:58
comments: true
categories:
---

Not working:

---
title: Population Density Background Maps for GRx Radar Viewers
author: pmarshwx
layout: post
categories:
  - Weather
  - Coding
tags:
  - GRx
  - population
comments: true
sharing: true
published: true
---

@davidfstr
Copy link
Owner

You can continue modifying the test file to match the original file, by slowing getting the front matter to line up. That will isolate the problem further. (When you can no longer make changes without breaking things, you've found the culprit.)

@pmarshwx
Copy link
Author

pmarshwx commented Feb 8, 2013

After doing all of this, I've found that I only get the error when I have a categories section in the front matter.

This works

---
title: Population Density Background Maps for GRx Radar Viewers 2
author: pmarshwx
layout: post
date: 2013-02-08 11:40
comments: true
tags:
  - GRx
  - population
sharing: true
published: true
---

This does not work

---
title: Population Density Background Maps for GRx Radar Viewers 2
author: pmarshwx
layout: post
date: 2013-02-08 11:40
comments: true
categories:
  - Weather
  - Coding
tags:
  - GRx
  - population
sharing: true
published: true
---

@davidfstr
Copy link
Owner

Okay. So there is probably something related to categories outside this page that is breaking. Since that could be anything on your site, you'll have to investigate it yourself.

If you can isolate a specific problem with RDiscount that interacts badly with your categories, open a new Issue.

@prigazzi
Copy link

I felt obligated to comment here since I've been looking to fix this in Octopress and looked at this issue like a thousand times.

The file that's causing this problem in octopress, is category_feed.xml, inside _includes/custom. You need to replace "markdownify" for "markdownize" and it works. Now I can rest.

@iveney
Copy link

iveney commented Oct 8, 2013

Thanks @prigazzi . I encountered the exact same problem. Would be loved to see an explanation on this.

@JetStarBlues
Copy link

@prigazzi Thanks 👍 , had the same issue with Octopress categories and that fixed it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants