Wiki gloss plug-in

From Mi'gmaq Wiki
Revision as of 18:54, 19 February 2012 by Jessica (talk | contribs)
Jump to navigation Jump to search

Overview

The Gloss extension provides a wiki markup element for linguistic annotations, developed for McGill Field Methods classes by Derek Ruths. The Gloss extension automatically aligns text with glosses, as well as provides auto-numbering and hyper-referencing. It closely follows the form and features of the Latex-based glossing tools, allowing the wiki source text to be easily pasted into Latex documents. This page provides both formal documentation of the extension as well as numerous examples of how the tool is used.

Installing the extension

To install the extension, you must have access to the includes directory of your MediaWiki installation. The installation is a two step procedure.

1. Copy the gloss.php file into the includes directory of your MediaWiki installation

2. Open the LocalSettings.php file in the root directory of your MediaWiki installation. Just below the line

require_once( "$IP/includes/DefaultSettings.php" );

add the line

require_once( "$IP/includes/gloss.php" );

You should now be able to use the Gloss extension in your wiki pages.

Using the extension

The GL element

The Gloss extension allows a wiki editor to automatically align text for interlinear glossing. In this extension, one phrase-gloss-translation entry is entered inside an xml-formatted element

<gl ...arguments...>
\gll ...text...
...gloss...
\trans ...translation...
</gl>

A simple example would be

<gl id="ex1">
\gll ela'l-ul magasan-g 
bring-1>2  store-LOC 
\trans I'm bringing you to the store.
</gl>

which produces the following block:

  1. ela'l-ul   magasan-g    
    bring-1>2  store-LOC    
    'I'm bringing you to the store.'

A fourth line can be added above the parsed line


Numbering and references

Notice that the example block above was automatically numbered. This number is inserted and autoincrements. As a result, the next block will receive the number 2.

  1. This is our second example, though we've used the same text.
    ego sum laetus
    ego sum laetus PRO VERB-1 ADJ
    'I am happy'

Beyond giving some structure to the blocks themselves, you can easily create hyperlinked references to specific GL elements by using the GL reference element

<glr id="...gl element id..."/>

. So, we can reference the example above using

<glr id="ex2"/>

which generates this: (2).

You can reset the numbering for a given GL element by using the GL element header:

<gl renum="true">
...
</gl>

Spacing

The number of spaces inserted between words in the GL element can be adjusted by using the parameter margin. Thus, we can render the same content with different spacings (for readability, for example), as follows:

  1. Here margin = 2 (this is the default value)
    ego sum laetus
    ego sum laetus PRO VERB-1 ADJ
    'I am happy'
  1. Here margin = 5
    ego sum laetus
    ego sum laetus PRO VERB-1 ADJ
    'I am happy'

Font size

The size of the font used inside of the GL element can be set using the parameter fontsize. By default, the fontsize is 15. Here is the same content as above, rendered in font size 12.

  1. ego sum laetus
    ego sum laetus PRO VERB-1 ADJ
    'I am happy'

Known issues

Unicode string handling

While the GL extension does handle unicode characters, there are some instances where it will incorrectly align strings containings rich unicode characters. Problematic characters include

  * ɪ́

When using these characters, the phrase and gloss may not perfectly line up.

Examples

Eventually, this page will provide documentation on the GLL Extension. For now, I'm using it to simply illustrate my progress with the extension. If you look at this page in the Edit view, you'll see how the gl tag environment is being used to produce the results below.

Remaining features/issues:

  • Write better documentation
  • Add error checking

The basic GL block

Changing spacing in the GL block

The gllmargin option changes the number of spaces that are used to separate individual words in the the \gll section. The default is 2 spaces. This next block also makes use of the empty token in the gloss.

  1. ego  sum     laetus  
         VERB-1  ADJ     
    'I am happy'

More blocks

Here are a couple more blocks simply to illustrate numbering:

  1. ego  sum     laetus  
    PRO  VERB-1  ADJ     
    'I am happy'
  1. ego      sum     laetus  
    PRONOUN  VERB-1  ADJ     
    'I am happy, this is test link 2'

Let me tell you something interesting about example (10). What if I try to tell you something about (8).... or maybe (6)?

  1. Jessica  escribe  ejemplo-s   
    Jessica  writes   example-PL  
    'Jessica writes examples.'
  1. ego  sum     laetus  
    PRO  VERB-1  ADJ     
    'I am happy'

Restart numbering

The renum option makes the numbering restart at 1. This next block should be numbered 1.

  1. ego sum laetus
    ego sum laetus PRONOUN VERB-1 ADJ
    'I am happy'

Cross-referencing GL blocks

Using the

<glr id="...">[text]</glr>

tag, one can create a linked reference to an existing gl tag. If the text is omitted, then the number of the referenced tag is used. Otherwise, the text itself is linked.

  1. ego  sum     laetus  
    PRO  VERB-1  ADJ     
    'I am happy'
  1. ego  sum     laetus  
    PRO  VERB-1  ADJ     
    'I am happy'
  1. ego  sum     laetus  
    PRO  VERB-1  ADJ     
    'I am happy'
  1. ego  sum     laetus  
    PRO  VERB-1  ADJ     
    'I am happy'
  1. This is another linked block.
    ego sum laetus PRO VERB-1 ADJ
    'I am happy'
  1. ego  sum     laetus  
    PRO  VERB-1  ADJ     
    'I am happy'

Setting font size

The size of the font itself can be set using the font_size argument.

  1. ego  sum     laetus  
    PRO  VERB-1  ADJ     
    'I am happy'

Handling unicode characters

  1. úla   úndʒi     mɛmɪ́ski:{k,g}ax  ulá   ɪktɪk  
    this  his.head  is.bigger.than    this  other  
    'this head is bigger than the other one'