Changes between Version 1 and Version 2 of AbbrMacro

Jan 6, 2009 7:15:55 PM (5 years ago)



  • AbbrMacro

    v1 v2  
    33== Description == 
    5 AbbrMacro returns an <abbr> or <acronym> element with a title attribute. 
     5AbbrMacro returns an <abbr> or <acronym> element with a title attribute. 
     7If you've used InlineMacro to create abbreviations or acronyms in your [WikiFormatting formatted] wiki 
     8pages, you probably quickly realized how tedious it can be. The !AbbrMacro package is designed to 
     9alleviate this issue. 
     11It accepts keyword syntax only: 
     14[[Abbr(key=XYZ,title=Xenon Yeti Zulu,<tag=abbr|acronym>)]] 
     17Where `key` is the element content, `title` is required, and the `tag` keyword is optional. The element 
     18type (tag) will default to `acronym` if omitted. Why is acronym the default? For several reasons. First, 
     19most users are after acronyms (and as far as I know there are no plans for an `initialism` element). Second, 
     20Internet Explorer before version 7.0 does not support the `<abbr>` element. It won't do any harm to use them 
     21with IE 6 and below, but these browsers do not allow you to style the element with CSS and they don't display 
     22the title attribute as a tooltip. 
     24Many HTML authors mistakenly refer to elements as "tags." For a review of the syntax and nomenclature of WWW 
     25markup elements, visit the Wikipedia [ Element] article, or this 
     26quick synopsis will help. 
     28Syntactically, HTML elements are constructed with: 
     30 * A `start tag` marking the beginning of an element. 
     31 * Any number of valid `attributes` (and their associated values in quotes). 
     32 * Some amount of `content` (characters and other elements). 
     33 * An `end tag`. 
     37 * In general, empty elements do not have an end tag nor do they contain content. 
     38 * HTML elements that include attributes do so in their start tags; they define additional properties and behavior. 
     39 * The end tag is required for most elements and optional for others. 
     40 * These rules vary depending on what [ DOCTYPE] you are serving. 
     42There has been a long and sometimes heated discussion on the `<abbr>` and `<acronym>` elements around the 
     43Web. A good article at Juicy Studios was written by my friend Pamela Berman: 
     44[ Abbreviations are a Breeze]. 
     46== Dictionary File == 
     48`AbbrMacro` is designed to be rolled out in phases. The first and simplest use case I've already described. 
     49But even that can become tedious, especially if you use the same acronyms over and over. The second phase 
     50introduces a user-defined plain text dictionary file of key=value (content=title) pairs, which permits the 
     51omission of the title keyword. Assuming, that is, there is a matching abbreviation in the dictionary file. 
     52You may also include the title attribute using the macro even if the element is defined in the dictionary 
     53file, the macro title keyword will take precedence. If you omit the title and the element is ''not'' defined 
     54in the dictionary, the macro will issue a error message and exit. 
     56To configure the location of the dictionary file, add the following  entry to your project `trac.ini`: 
     60file = /path/to/your/abbreviations/file 
     63The file must be readable (and eventually writable, see below) by your Web server in order for this feature 
     64to work. 
     66The format of the dictionary file couldn't be simpler: 
     70PEP = Python Enhancement Proposal 
     71PHP = Hypertext Preprocesor 
     72RFC = Request For Comments 
     79Where leading and trailing whitespace are removed. Notice that there is a uncanny similarity between the dictionary file 
     80and trac.ini? This is no accident of course, each one has sections followed by name=value pairs. Sections other than 
     81`[abbr]` and `[acronym]` in the dictionary file are ignored, and there is no rule you must have both. I tend to only use 
     82acronyms for this sort of thing, and to help get you started here is an example [AbbrMacro/AbbrMap AbbrMap]. Like all 
     83Python/Trac files, strings beginning with a `#` (pound) character are treated as comments and are ignored. If you're 
     84going to use Unicode characters in your dictionary (typically in the title attribute), open the file, as always, with: 
     87# -*- coding: utf-8 -*- 
     95<div class="system-message"> 
     96<strong>Warning</strong>: Since abbreviations and acronyms kept in the dictionary file are stored in memory as unique 
     97key=value pairs, duplicates keys will cause a collision. If this happens, one will overwrite the other. However, since 
     98the keys are case-sensitive, in practice this should not be a issue&mdash;just something to keep in mind when you are 
     99editing your dictionary file. 
     103== !AbbrMapTxt == 
     105A third and final phase will allow the user to edit this file from within the wiki, similar to the InterMapTxt page 
     106for InterWiki links. 
     108== Installation == 
     110Download the [/raw-attachment/wiki/AbbrMacro/ zipfile], unzip the archive to a temporary 
     111location, visit the `0.11` folder and run: 
     114python bdist_egg 
     115cp dist/*.egg /trac/env/Project/plugins 
     118== Configuration == 
     120Enable the macro in: 
     126abbr.* = enabled 
     129See [#DictionaryFile Dictionary File] above if you plan on using this feature. 
     131You may have to restart your Web server. 
     133== Style == 
     135No sense doing it without style, here's mine. 
     139/* acronyms and abbrs */ 
     142acronym { 
     143  border-bottom: none; 
     144  cursor: default; 
     145  color: #309; 
     148acronym:hover { 
     149  border-bottom: 1px dotted #309; 
     153== Example == 
     157[[Abbr(key=PEP,title=Python Enhancement Proposal)]] 
     163<acronym title="Python Enhancement Proposal">PEP</acronym> 
    7166== Bugs/Feature Requests ==  
    10169[report:9?COMPONENT=AbbrMacro here]. 
    12 If you have any issues, create a  
    13 [ new ticket]. 
    15 == Download == 
    17 Download the zipped source from [download:abbrmacro here]. 
     171If you have any issues, create a [ new ticket]. 
    19173== Source == 
    21 You can check out AbbrMacro from [ here] using Subversion, or [source:abbrmacro browse the source] with Trac. 
    23 == Example == 
    25 [[Abbr(key=PEP,title=Python Enhancement Proposal)]] 
     175 * Browse the source at: [ GitHub]. 
     176 * Public clone URL: 
     178git clone git:// 
    27181== Recent Changes == 
    31185== Author/Contributors == 
    33 '''Author:''' [wiki:dwclifton] [[BR]] 
    34 '''Contributors:''' 
     187 * '''Author:''' [wiki:dwclifton] 
     188 * '''Contributors:''' The Trac and Python development community.