Ask Your Question

auto linking of key terms

asked 2011-08-31 05:37:36 -0600

mether gravatar image

For better integration, I want the user to be able to write say bug 12345 and automatically link to our bugzilla and other such use of key terms. What would be the best way to implement this? I am thinking, this should be generic enough that I can configure it in settings rather than patch Askbot locally.

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2011-09-05 11:48:52 -0600

sagarun gravatar image

I will work on this!

edit flag offensive delete link more



Super! we will merge your other commits today. Please try to make it possible to create a template for the autolinking from live settings.

Evgeny gravatar imageEvgeny ( 2011-09-05 12:16:57 -0600 )edit

Hi, I have added this feature in my auto-link branch . Currently it processes only one regex and autolinks to an specified URL in settings UI. I am wondering about processing multiple regex's and URLS. Can i ask the user to specify the regex's and URLs in comma separated form in settings UI? Appreciate your suggestions :-)

sagarun gravatar imagesagarun ( 2011-09-18 08:58:02 -0600 )edit

@sagarun, looks great, I have a suggestion too - to support multiple patterns change the field to LongStringValue (or whichever allows multiline input) and then ask people to give one pattern/regex per line. And on save - validate the input:

  • numbers of lines must match in both fields
  • regexes should parse without errors

The live settings file supports input validation via an optional parameter update_callback, take a look at askbot/deps/livesettings/ to see how update callback is used... actually I am not 100% sure that proper custom validation can be done in livesettings.

Evgeny gravatar imageEvgeny ( 2011-09-18 10:05:34 -0600 )edit

@Evgeny Thank you! I will validate the user input. I will also look into LongStringValue

sagarun gravatar imagesagarun ( 2011-09-18 21:27:18 -0600 )edit

answered 2011-08-31 05:55:29 -0600

Evgeny gravatar image

In askbot/utils/ LINK_PATTERNS can be modified. We've done it on a couple of instances.

To make it more user-friendly some settings could be added to askbot/conf/ and hooked up in askbot/utils/

Here is an example

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

[hide preview]

Reliable Askbot Hosting

Create your Q&A site at Managed Askbot hosting at just $15/mo. Dedicated hosting, support contracts, consulting services.

create your Q&A site
30 days free trial

Question Tools

1 follower


Asked: 2011-08-31 05:37:36 -0600

Seen: 149 times

Last updated: Sep 05 '11