Over the last few months we’ve been playing around with a Discourse Theme Component which adds automatic ‘linkifying’ of certain words. It automatically converts the words, when used in a post, into a link. We can direct this link anywhere we want - to another part of discourse.digitalhealth.net, to Wikipedia, or to another site.
We’re using this feature to make the content of the Networks more accessible. New users might benefit from having an easy link to an explanation of an acronym than more experienced users take for granted.
If you have suggestions for other abbreviations we should use this feature to explain, then please reply to this post with:
It keeps on picking up clinical informatics first. I’m not quite sure why, because it has worked for other short strings okay such as discourse and discourse meta. For the time being, I’ve added a clear path to the FCI in the clinical informatics topic.
You can also force it to link as you wish by putting the link into your post directly (using the button in the post composer), but that is of course a manual step which the Theme Component is attempting to automate!
Depending on the code, altering the order of the term being searched for - usually either the 1st or last match will always take priority. This is usually cleanest and easiest.
Using a RegEx negative lookbehind assertion. The problem here is that the regex engine must support lookbehind (most RegEx flavours now days support lookbehind assertions), and the next poor sod who has to alter/debug the expression. For ‘clinical informatics’ not starting with ‘faculty of’ the regex is (?<!faculty of )clinical informatics
Some kind of string hack as per EricGT to confuse automatic parsing of the text. Obviously this will sometimes (assuming html tags are not stripped out 1st) stop any kind of automatic linking. Any fans of semantic markup will feel uneasy about using the <s> tag (denoting the ‘no longer correct or relevant’). Therefore I would personally feel more comfortable putting in a non breaking space clinical informatics.
I have within the WebUI but it didn’t work. Deleting one works until it is reinstated. I suspect that they need to be reordered in the actual database table. I’m not sure how to access that for a Theme Component. @pacharanero, is this worth chasing? The FCI is a pretty important thing to link to both abbreviated and full text.
We aren’t the only ones with this issue (I note that @EricGT is in the thick of it over there!)
Checking the way this is stored in the DB, it is contained in a single string in the Theme Component’s settings Object. Tidied up and split into lines it looks like this:
PCN,/t/primary-care-networks/
Health Forum NZ,https://healthforum.nz
HFNZ,https://healthforum.nz
CiLN,https://www.ehealthnews.nz/clinical-informatics-leadership-net
NERVTAG,https://www.gov.uk/government/groups/new-and-emerging-respiratory-virus-threats-advisory-group
quote,/t/quoting-in-the-digital-health-networks/14320
markdown,https://www.markdownguide.org/getting-started/
Discourse,https://discourse.org
discourse meta,https://meta.discourse.org
FAQ,/faq
wiki,https://meta.discourse.org/t/30801
new user guide,https://meta.discourse.org/t/96331
moderation guide,https://meta.discourse.org/t/63116
doodle poll,https://meta.discourse.org/t/87630/8
personal message,https://ehealthforum.nz/t/private-messages-in-discourse/15815
personal messages,https://ehealthforum.nz/t/private-messages-in-discourse/15815
PM me,https://ehealthforum.nz/my/messages
FedIP,http://fedip.org/
FCI,https://facultyofclinicalinformatics.org.uk
Clinical Informatics Leadership Network,https://www.ehealthnews.nz/clinical-informatics-leadership-net
Faculty of Clinical Informatics,https://facultyofclinicalinformatics.org.uk/
Clinical Informatics,/t/clinical-informatics/13089
= Still not working. I wonder if it’s to do with the Ruby implementation of how it scans the text. I’m not sure I can devote time to fixing this really.
Agree, it isn’t worth chasing any further - the logic in the code has been posted below. And it will be moving into Discourse core soon anyway (and so is likely to change):