Extension talk:Terminology

From mediawiki.org
Latest comment: 12 years ago by Caile13 in topic Limiting to specific namespaces

Acronyms on multiple lines doesn't work, diacritic signs aren't supported and how to insert links?[edit]

Hi. So here I have three problems with this extension.
First, I tried to put acronyms on multiple lines like this :

;ACRONYM
:First Line
:Second Line

And it didn't work and the lines under the acronym disappear on all pages.

Second, I'm unable to insert diacritic signs such as àéèâêîôû... instead of showing them properly they're converted to a weird code.

Last but not least, I didn't find out how to insert links externally or internally, any idea?

Thanks.

neox

Difference between the extensions Terminology and Glossary[edit]

Hallo, was ist nun genau der Unterschied zwischen Terminoloy und der Glossary Extension?

2008-Jul-03: I wrote the original extension called Glossary, and it was improved on quite a bit by others. I adopted a version that was completely rewritten by BarkerJr and started improving it again. However a heavily modified version of my original code seems to still be popular. Rather than get into a wiki revert war with my extension, I created a new extension with the much improved code.

xkahn

Works on some pages but not on others[edit]

Hi, I installed the version for PHP5x. I don't understand why but it on some articles it works and others seem not to be parsed at all. I really don't see the difference. The only other extensions I use are CategoryTree and Cite. Maybe someone has any ideas on that matter. Further it alway ignores the last line on the Terminology-Page which never shows a tooltip. Thanks in advance.

2010-Mar-05: Pages are cached aggressively, which means you may need to edit pages (and then save them with no changes) which don't show definitions. This includes showing the last definition you inserted on the Terminology-Page. Alternatively, you can just wait for the cache to expire...

xkahn

Holp[edit]

Ok. I have terminology up and running and i LOVE how it highlights the words on the page (dotted underline) MUCH better idea than mine for changing the colours. I did it and my pages looked like rainbows.. this works much better.

Now I am still having problems (and i have ws_tooltip.js installed) getting it to display hyperlinks and formatting. If i use the ws_tooltip references the way they are showed on the page for that, everything is fine but when i try to put them on the terminology page and have the other pages reference them, all that shows up is the actual code.

Has anyone been able to get this working?

Kay

2008-Jul-03: I've updated the instructions now. Is it easier to follow?

xkahn

2008-Jul-15: Looks great!!! Thank you so much

Kay

Formatting[edit]

Ok after ton of fighting and trying to understand the code in Terminology.php and the code in wz_tooltip.js I finally have a solution. I am going to document it here and if anyone with more knowledge of php and js can tell me a better way to do this, i'd be thrilled. I don't like messing with other people's code, especially when i have almost NO knowledge at all of the language being used to write it. There is a line that reads:

$span->setAttribute('onmouseover', "TagToTip('$term', STICKY, true, DURATION, -400)");

I commented out this line using // and replaced it with

$span->setAttribute('onmouseover', "Tip('$definition')");

and then commented out:

$span->setAttribute('onmouseout', "UnTip()");

After doing this i was about to use <br> for adding line breaks and <a href ...></a> tags for external hyperlinks to my entries on the Terminology page. One thing that is VERY important to keep in mind all instances of quotes in the hyperlink must be either converted to ascii or preceded with a \ for the hyperlink to work.

If you plan to use external hyperlinks, you also need to play with your settings in the .js file to get the combination of a wait time that works well for you. You can use any combination of sticky and clickclose or closebtn that works for your particular page.

I have also tried using unordered lists using the html tags and keeping everything on one line and that seems to work fine. I am guessing any formatting that required a hard carriage return to be placed on the Terminology page within the definition would cause things to break.

Example of the unordered list I used:<ul><li>Test<li>Another Test</ul>

==Kay

2008-Jul-03: I've updated the code now to handle your suggestions. Hyperlinks should now work by default. You shouldn't need to escape anything to get them to work. I've done some light testing, so let me know if it doesn't work.

xkahn

2008-Jul-15: Ok we finished updating to the new version, changing our Terminology page to account for the hyperlinks and everything looks great! Thank you so much for all our help.

There is ONE other thing and i'm not even sure it's possible or if you'd even want to be bothered. BUT have you ever considered the implementation of something set in local settings that allowed for having every instance of a page show up with the tooltip OR simply the first instance? We've just noticed that some of our pages are almost entirely green and we haven't decided if we want to modify our terminology page to have less words on it.

Kay

2008-Aug-27: This isn't too hard. Find the line that says:

$texts = preg_split('/\b('.preg_quote($term).'s?)\b/iu', $node->textContent, -1, PREG_SPLIT_DELIM_CAPTURE);

and change the "-1" to 1 or 2.

xkahn

..........Addendum

Ok I am running into a few problems. Not with the formatting but with multiple word 'terms' If i have a one word term that appears within another term that is made up of more than one word, the second term is not recognized as an entry.

For example: Reference Global Reference

The 'Reference' in 'Global Reference' shows up underlined and pops up the definition for 'Reference' but I can't get 'Global Reference' to work at all unless i delete 'Reference'

Any ideas?

==Kay

2008-Jul-03: This is basically an implementation detail. Try changing the order of the definitions.

xkahn

2008-Jul-15: I made the change and it worked perfectly. Thanks so much!

Kay

Changing wiki page name[edit]

Ok this one is probably pretty simple but could anyone tell me how to change the name of the page in the wiki from Terminology to something else (probably Acronyms)

What exactly do i need to edit within the .php files to make this work (and/or IS it possible)

Kay

2008-Jul-03: Line 46: $rev = Revision::newFromTitle(Title::makeTitle(null, 'Terminology')); defines the name of the page. Simply change 'Terminology' to whatever you want.

xkahn

2008-Jul-15: Thank you!!

Kay

How do i make it work?[edit]

Ok. The extension is working , but how do i make it work with the wz_tooltip.js practically ? Where do i put the code and what code ? and how do i format the text ? How do i format the text for terminology ? I want to make the tooltip to look nicer but all i get is the text on all the screen. I want to make a tooltip with 5 rows how do i do that ??

2008-Jul-03: I've updated the instructions now. Is it easier to follow?

xkahn

What defines an acronym?[edit]

I am trying to figure out what characters are allowed within what is an 'acronyn' dashes '-' seem to work fine but several of ours have ampersands '&' and slashes '/' When i put a plain ampersand in ;ACRO&NYM: the & and all text following vanishes. I tried the equivalent & amp ;(had to add spaces to get it to show up, everything else translated it into &) and it shows up right on the terminology page but is not recognized as an acronym (ie does not get the green underscore or popup box) Any thoughts on how to work around this?

Kay

2008-Aug-27: You've got some crazy acronyms! The trouble is the ampersand is a special character in regular expressions and the terminology code is feeding it raw to a regex parser. Try putting a backslash or two in front? I haven't tried this...

xkahn

2008-10-13

Crazy acronyms? What defines crazy? AT&T is one which comes to mind quickly.

Is anyone else having issues?[edit]

Mine is real flaky and I keep having to clear <meta content="charset=utf-8" http-equiv="content-type"></meta> from my pages when it works at all....

GobleS 16:33, 25 August 2008 (UTC)Reply

2008-Aug-27: I'm not sure what you mean. No, it isn't flaky for me. What happens when it doesn't work? Why are you removing a meta tag? What version of mediawiki? What OS/Distro/Platform are you running on? Which version of PHP?

xkahn

The problem is that the meta tag is put on everypage that it modifies. And it is displayed as text on the page, and it places it in there everytime the page is saved so 3 saves = 3 meta tags!

This is on a HP Proliant DL380 G4 running Windows 2008 with:

   * MediaWiki: 1.11.0
   * PHP: 5.2.5
   * MySQL: 5.0.45

Thanks for anything you can suggest.

GobleS 23:51, 27 August 2008 (UTC)Reply

2008-Aug-28: I've updated the code to support the FCKeditor, which was causing your problem. Simply click the "wikitext" button to edit the page in the FCKeditor.

xkahn

Mis-interpretation of acronym[edit]

I added the acronym for ;SAN:Storage Area Network as shown.

The problem is than my wiki is mostly in french and that the word "sans" appear with a dotted underline. Anyone got this problem? --Abrillon 16:56, 27 August 2008 (UTC)Reply

Problem circumvented. Changed line

$texts = preg_split('/\b('.preg_quote($term).'s?)\b/iu', $node->textContent, -1, PREG_SPLIT_DELIM_CAPTURE);

to

$texts = preg_split('/\b('.preg_quote($term).'s?)\b/u', $node->textContent, -1, PREG_SPLIT_DELIM_CAPTURE);

to remove the case insensitivity so that SAN SANs are underline but sans san are not.

--Abrillon 13:30, 28 August 2008 (UTC)Reply

2008-Aug-28: That's a great fix. Acronyms are case sensitive anyway. Thanks.

--xkahn

System load[edit]

Hello,

great extension, but it makes my Wiki very very slow. I put a list with at least 621 definitions to the Terminology side. If this is too much, I have to turn off the whole feature - and I don't want to.

Any Ideas, how to fast it up?

--62.128.18.198 13:01, 9 September 2008 (UTC)Reply

There are a number of ways to speed up the extension, but it will likely always be O(n) time to hilight the definitions. So as the number of definitions grows, the extension will slow down. There may be improvements to the substitution I could make, or it might be possible to cache the final document.

--xkahn 5/29/2009

Highlighting an acronym only once on a page[edit]

For acronyms that appear more than once on a single page, would it be possible to make that acronym get highlighted once only? How would the extension need to be edited to do this?

Exclude pages, create links[edit]

Hi, First, thanks for this great extension. Is there a way to exclude some pages from being parsed... eg, I'd like the page Terminology not to show the tooltips, same for the main page...

I like the green underline system, but is there a simple way to add [[ around the acronym in the text so that it becomes a link to its own page ?

Thanks Doc

Issues with NCL extension[edit]

Hi again, Looks very much like Terminology is causing NCL extension strange behaviour... when terminology runs, then, the <ncl> hook can be used only once on a page... Any help welcome... Thanks Doc

Short URL[edit]

Hi! The Terminology extension didn't work at all for me on my newly istalled wiki, so I gave up and did my next task, fixing a Short URL. When that was done, I saw to my surprise that the Terminology started to work. /MikaelLindmark 11:46, 13 October 2008 (UTC)Reply

Hiding the underline on printed version[edit]

I don't think it's terribly useful to have the green underlines appear on a printed version of a wiki page, so I figured out a minor change so that they only appear on the screen:

In the terminologySetup() function, change the following line:

$wgOut->addHTML("<style text=\"text/css\" ><!-- .terminologydef {border-bottom: 1px dashed green;} --></style>");

to:

$wgOut->addHTML("<style text=\"text/css\" media=\"screen\"><!-- .terminologydef {border-bottom: 1px dashed green;} --></style>");

-- Hawaiian717 21:36, 14 January 2009 (UTC)Reply

Great suggestion! I've added this code in. Thanks.

-- xkahn May 29, 2009

Warning-Message[edit]

Hi,

I installed the extension. It works, but on every wiki page the following warning message is displayed:

Warning: Cannot modify header information - headers already sent by (output started at /home/imc/public_html/extensions/terminology.php:143) in /home/imc/public_html/includes/WebResponse.php on line 16

How can I get rid of this?

  • MediaWiki 1.14.0
  • PHP 5.2.8 (cgi)
  • MySQL 4.1.22-standard

-Bernhard

Remove ?> from the end of the extension file. —Emufarmers(T|C) 05:53, 20 June 2009 (UTC)Reply
Thanx. That worked. -Bernhard

Uninitialized string offset[edit]

I'am getting the following notices twice: Notice: Uninitialized string offset: 0 in /path/tomy/wiki/extensions/terminology.php on line 62 Notice: Uninitialized string offset: 0 in /path/tomy/wiki/extensions/terminology.php on line 62

Line 61 - 64 stating:

$terms = explode(':', $entry, 2);
       if ($terms[0][0] == ';') {

         // It's possible that the definition is on the next line

any clues on that? 88.70.95.173 12:58, 4 August 2009 (UTC)Reply

From "Known Issues" on Extension page
  • Any empty lines in the Terminology page will cause "Notice: Uninitialized string offset" errors displayed on Wiki pages.
  • To correct this issue, change $terms[0][0] to @$terms[0][0] on line number 62 of extensions/terminology.php.
This did not fix the problem for me, but knowing how to avoid the problem is almost as good. (Just don't put any blank lines in your Terminology page)
--Cforrest 23:27, 29 September 2009 (UTC)Reply

Excellent! I've fixed this in the code. Thanks for the catch.

-- xkahn Jan 07, 2010

FIX option from wz_tooltip scripts not functioning with Terminology[edit]

I had started using Glossary before realizing Terminology was the newer extension and broke down the tip better for my needs. Using wz_tooltip.js for the Glossary extension I was able to get the FIX function to work properly and the tip would always appear above the term when moused over. Now that I've switched over to Terminology, the tip from FIX will always be placed at 0,0 of the page, rather than look for what should be a local tag (this is from trying to tell it to attach to [this, 0, 0]. I am somewhat assuming this as when the FIX isn't defined properly, the tip appears in the top right corner of the page. Telling it Tip or TagToTip doesn't seem to matter.

I'm wondering if I'm just using it wrong (but it works in the older version) or if terminology sets the structure of the tagging up differently than Glossary which is causing the problem (if it's something obvious, I apologize, I'm unfortunately not that well versed in Php).

2010-Mar-05: So rather than having the tooltip appear above the word when you mouse over it, you are trying to make the tip appear on top of the word itself? I haven't tried this, but it should work with a function call; check out the wz_tooltip.js documentation. Seems crazy to me though, since the mouse cursor will block the definition.

xkahn

Error message "wz_tooltip.js must be included INSIDE the body section, immediately after the opening <body> tag"[edit]

Hi xkahn, I am getting this error message every time I want to edit a page with semantic forms. The problem occurs when a form is loaded with Special:FormStart/“name of form”/“name of page”. After the page continued to Special:FormEdit/“name of form”/“name of page” the error message disappears. The downside is now that no tool-tips appear on the thus loaded entry form Special:FormEdit/“name of form”/“name of page”. I think that Terminology does not get loaded properly. However, since editing pages like this is a very frequent action on a semantic wiki... The functionality provided by this extension is very helpful, especially with semantic forms, because it explains the input fields. It would be fantastic to see this fixed somehow. Cheers --kgh 21:41, 11 May 2010 (UTC) PS This problem was addressed on the discussion page of Glossay, too but I will direct the attention from there to this page.Reply

Different tooltips for different user groups[edit]

Hi, is it possible to show different tooltips for different user groups? Thanks in advance.

Hyperlinks in definitions appear as wiki syntax in tool tip[edit]

Hi, Thanks for the great extension, It works perfect but have a small issue with hyperlinks in definition. When definitions are refrenced to other pages with hyperlinks, the tool tip popup shows these hyperlinks as actual wiki syntax. I prefer to have the tool tip show the definition without any wiki syntax

Any help is immensely appreciated

Thank you, Sats

Multiple Terminology pages or Sub pages?[edit]

I have hundreds of terms that I'd like to include in the Terminology list, but the standard page is getting entirely too big. Is it possible to place terms on a Terminology subpage (../Terminology/Samplesubpage for example)? -hkdm

Warning: DOMDocument::createElement() [function.DOMDocument-createElement]:[edit]

Hi

Warning: DOMDocument::createElement() [function.DOMDocument-createElement]: unterminated entity reference Repeat in /usr/local/share/mediawiki/extensions/Terminology/Terminology.php on line 102

I get this above warning at the top of my terminology page. Also appears when I edit terminology page but the extension works very well. I am not sure what causes this issue. would like to know if anyone has come across this problem earlier

thank you

International characters in acronims[edit]

It is not working for subject. For me that changes makes it work:

$texts = preg_split('/(?<!\p{L})('.preg_quote($term).')(?!\p{L})/iu', $node->textContent, -1, PREG_SPLIT_DELIM_CAPTURE);

Better examples for mixed terms and spacing[edit]

The extension page is lacking some vital explanations. I'm no programmer and don't know if the functionality is present. But several questions come to mind and should be answered in the Extension manual page:

  • How can i use terms with space characters in the name? Example: writing ";Red Mist" results in just the word "Red" being underlined in the wiki.
  • How should i handle mixed and composed terms? Examples: "screw", "screw attack" and "a screw operator device" should have individual explanations each.
  • How to define substitutes of terms? Example: aggressor -> should display definition of: opponent

Bug (w/fix): '/' in terminology causes PHP error[edit]

Issue is that preg_quote doesn't escape '/' so it gets treated as part of the regex.

Change:

$texts = preg_split('/\b('.preg_quote($term).'s?)\b/u', $node->textContent, -1, PREG_SPLIT_DELIM_CAPTURE);

To:

$texts = preg_split('/\b('.preg_quote($term, '/').'s?)\b/u', $node->textContent, -1, PREG_SPLIT_DELIM_CAPTURE);

Slow with large terminology db[edit]

Just to let you know, I've rewritten this plugin from scratch to solve the lag problem. See Extension:Lingo. Bcoughlan 03:58, 9 January 2011 (UTC)Reply

My terminology is up to about 500 entries, and page loading on a local server takes about 30 seconds now.

I did some profiling and the major culprit is in terminologyParseThisNode:

  } elseif ($node->hasChildNodes()) {
    // We have to do this because foreach gets confused by changing data
..............
..............
      if (terminologyParseThisNode($doc, $child, $term, $definition)) {
        $changed = true;
      }

There is no foreach loop any more, what is the reason for recursively calling this function? Bcoughlan 16:54, 8 January 2011 (UTC)Reply

Terminology page requires to be saved twice before it takes effect[edit]

Title says it all. Does this has to do something with the cache?

Do I need to mark anything to make glossary work in my document?[edit]

I installed Entexsions/Glossary follow instruction but don't know how to use. I typed word that have def. in glossary but nothing happen.

Thank you

Terminology in my local language don't work!!![edit]

In Terminology has both Thai and English terms. and also in definition. But in my test page the term in Thai don't work like in English term. but no problem in definition.

How to correct this problem?

Limiting to specific namespaces[edit]

For some reason terminology is conflicting with some other extensions i am using. I only have one namespace that will contain technical information that will have acronyms and the extensions it fights with are in a different name space. i was wondering if it would be possible to somehow tell terminology to only check pages in a specific namespace? --Kay 11:30, 18 October 2011 (UTC)Reply

Terminology highlighting underline[edit]

Works fine, but the dotted underline is too small. Wondering how to change that.

Product Version MediaWiki 1.32.1 PHP 7.1.28 (apache2handler) MySQL 5.7.23