wiki:EntityMacro

Version 14 (modified by figaro, 8 years ago) (diff)

Rearranged paragraphs to maintain consistency

Character Entity Macro

Notice: This plugin is unmaintained and available for adoption.

Description

The EntityMacro package returns HTML 4.01 numeric character entity references from their corresponding names.

The character entity data is straight out of the DTD for HTML 4.01, so if there are errors or ommissions, please refer to the W3C.

See: Character entity references in HTML 4 for more information.

Calling the macro like so: [[Entity(name)]] returns the value. If no name matches, it returns an empty string. Names are case-sensitive, in other words, aacute is not the same code point as Aacute. Keyword syntax is also supported: [[Entity(name=name)]].

The macro is useful in any wiki formatted page.

Also see the WikiGoodiesPlugin, which supports smileys, HTML 4.0 entities (named entities and numerical entities), automatic replacement of common text idioms by their corresponding symbols, such as arrows, fractions, etc.

Source

  • Browse the source at: GitHub.
  • Public clone URL:
    git clone git://github.com/dwclifton/tracentitymacro.git
    

Installation

Download the zipped source. Unzip the archive to a temporary location, visit the 0.11 directory and run:

python setup.py bdist_egg
cp dist/*.egg /trac/env/Project/plugins

Configuration

Enable the macro in your /trac/env/Project/conf/trac.ini file:

[components]
entity.* = enabled

You may have to restart your Web server.

Examples

[[Entity(raquo)]]
[[Entity(name=raquo)]]

Both of these examples will return », the guillemet ».

Recent Changes

15264 by rjollos on 2016-02-11 04:22:34
Remove unnecessary svn:mime-type on py files

svn:mime-type was set to "plain" for many files.

8492 by rjollos on 2010-08-28 05:08:41
Adding source code that was previously attached to the project's wiki page.
5059 by dwclifton on 2008-12-25 18:22:19
New hack EntityMacro, created by dwclifton
(more)

Author/Contributors

Author: dwclifton
Maintainer: none (needsadoption)
Contributors: The Trac and Python community.