Re: Automatic internal link middleware

2011-06-22 Thread Cal Leeming [Simplicity Media Ltd]
On Wed, Jun 22, 2011 at 2:33 PM, Herman Schistad wrote: > On Wed, Jun 22, 2011 at 15:24, Cal Leeming [Simplicity Media Ltd] > wrote: > > We have actually just implemented this on one of our other sites still in > > development. The

Re: Automatic internal link middleware

2011-06-22 Thread Herman Schistad
On Wed, Jun 22, 2011 at 15:24, Cal Leeming [Simplicity Media Ltd] wrote: > We have actually just implemented this on one of our other sites still in > development. The problem with keyword highlighting is you have to be careful > not to enter into infinite 

Re: Automatic internal link middleware

2011-06-22 Thread Cal Leeming [Simplicity Media Ltd]
Hi Herman, We have actually just implemented this on one of our other sites still in development. The problem with keyword highlighting is you have to be careful not to enter into infinite loops, by ensuring you only match keywords outside of existing HTML tags. Normally I'd just say "figure it

Re: Automatic internal link middleware

2011-06-22 Thread Tim Shaffer
Shouldn't be too hard to implement I don't think. Basically just loop through your list of keywords and replace them with a link. Something like this: def make_keyword_links(content): for keyword in Keyword.objects.all(): content = content.replace(keyword.text, keyword.link)

Automatic internal link middleware

2011-06-22 Thread Herman Schistad
Hi there fellow developers. I'm wondering if anyone has seen an app which does the following: * Finds keywords in the templates, which is defined by the user and then creates internal links to these. Use-case: 1. I create keyword: "Cupcakes" and give it the href/URL property: /info/cupcakes/ in