This discussion is about the “Add tags to words in posts” theme component. Freso introduced the component, which is similar to the “Linkify words in post” plugin, but instead wraps abbreviations in <abbr> tags.
Southern asked about using the component to provide explanations for Android Hidden Codes and encountered issues with the component not working with preformatted text. Johani provided a solution by adjusting the theme to fix two problems.
Southern also reported issues with repeating characters in abbreviations and Johani fixed the issue by making a small change in the theme.
Tophee suggested features such as limiting abbreviations to certain categories and making detection context-sensitive. Tophee also asked about stopping a word from being abbrified on a per-post basis, and danekhollas suggested manually inserting the abbr tag or adding a non-intrusive HTML tag to the skipTags object.
Aschrijver asked about using the component for a crowdsourced glossary and danekhollas explained how the component works and suggested installing it to try it out.
Aschrijver reported issues with installing the component and danekhollas suggested trying the original autolinkify theme.
Fearlessfrog asked if the abbr tags work on mobile, and codinghorror replied that it depends on the mobile browser.
Eextra reported issues with the component not working with linkify, and danekhollas provided a solution by modifying the code.
Jrgong suggested adding the tooltip theme component functionality, and jesus2099 provided a rough user stylesheet to allow tooltips on mobile.
Aizada_M asked about achieving the effect of a comment appearing above an abbreviation and provided a solution using CSS code.
This theme component is ported from Auto-Linkify Words to provide functionality similar to the Abbreviations and acronyms plugin – namely to wrap various abbreviations used in a given forum/site/Discourse installation in <abbr> tags.
Location
How to install
Credits
Thanks to @sam for writing the “Linkify words in post” plugin.
Thanks for creating Auto-Abbrify! It’s so simple for users to be able to mouse over an abbreviation rather than having to click away from what they are reading to look it up online or in a lexicon!
One question for you, please:
I was hoping to also use it to provide explanations for some Android Hidden Codes, for example: *#*#8647#*#*
To make such a code display correctly in Discourse, we have to escape the sequence using the preformatted text button . I’m having trouble getting Auto-Abbrify to work with this code. I’ve tried entering the code in the Auto-Abbrify theme both with and without the backticks. Do you have any suggestion to make Auto-abbrify work with this kind of sequence?
ask the theme not to ignore <code> tags when looking for abbreviated words. Which allows you to add the sequence *#*#8647#*#* in the abbreviated words list (no backticks) like any other word and it should work:
The catch here is that this a local change and would need to be reapplied every time you update the theme, but considering it’s only one word, I don’t think this is a big problem.
Are there any other places where you’re seeing duplicate letters in abbreviations?
I wonder if it would be feasible to make it so that certain abbreviations can be limited to certain categories? For example, by specifying CA,California,US politics and CA,Canada,International politics CA would be abbrified differently in the Categories US politics and International Politics.
Oh, and it would also be great if the detection of acronyms could be context sensitive (to avoid false positives when an abbreviation also exists as a word in ordinary language).
Let’s say on my forum, AA commonly stands for Alcoholic Anonymous and so we have a the abbrify theme component set up to explain AA as Alcoholics Anonymous. Now let’s say John writes a post mentioning the Automobile Association as AA. If he notices that the explanation for the abbreviation is wrong, he might want to stop discourse from abbrifying AA in his post. Or perhaps he doesn’t notice the problem but a staff member does but doesn’t know what AA stands for, only that it’s obviously not Alcoholics Anonymous.
Is there perhaps an easy solution to stop a word from being abbrified on a per post basis (except for using a different word or abbreviation, of course)? Perhaps such an escape mechanism could also be useful for the linkify theme component?
Well, one solution would be to manually insert the abbr tag in those instances.
Or, if there exist some non-intrusive HTML tag that you could wrap around that particular abbreviation and than add that tag to the skipTags object in the code.
This is a super project, and exactly what we need for Humane Tech Community! I gather that - since we are a hosted instance, and this is a Theme Component - we are able to apply this for our community.
The documentation on how to use this component is still a bit thin, though. I gather since this is derived from the Linkify component, it will work similarly?
We have community members with many different professional backgrounds and expertise (medical, psychology, IT, education) and the need for a crowdsourced glossary, with a lot of terms, ultimately. Given how Linkify works, that would mean having a workflow that goes something like this:
There is a (sub)category that needs Moderator approval before posting
Some member posts a new term for the glossary, with explanatory text
When approved, an admin takes the post URL and adds the proper config (term + URL) to the Abbrev/Linkify list in Settings
Not ideal for this use case, maybe (a bit involved, with the Admin interaction needed), but workable.
Is this indeed how the module works, and is the workflow I described the one to go for?
Edit: Additionally - since we are a hosted instance - I am wondering, if a view of an abbreviation ‘balloon’ counts as a pageview on our account quotum?
If I understand you correctly, this is indeed how it works. Although from you description I am not sure what your end-goal is. Is the abbreviation gonna link to a separate dedicated post? In that case, use the auto-linkify theme. If you just want explanatory text when hoovering over the abbreviation (i.e. <abbr> tag, use this theme. You can also combine them.
This is not clear, can you explain exactly how you think it will work? If the “ballon” is gonna be a link leading to your post that I guess yes it will count.
Overall, I’d recommend simply to install the theme and try it out You’ll quickly see hot it works.
Thanks for your info @danekhollas! I think this is exactly what I’m looking for , so I’ll give it a go.
PS. With that last part I meant indeed if the explanation of an abbreviation is defined by links, then do they count or not. But maybe that is not how one sets this up, so I will first check it out.
Edit: I have installed it, but I see no obvious place where to define abbreviations.