source: anchormacro/0.10/Anchor.py

Last change on this file was 9865, checked in by Ryan J Ollos, 13 years ago

Fix: for the case of an anchor with visible text, the visible text was being used in the href rather than the anchor id. Thank you peichman@… for the patch. Fixes #8413.

  • Property svn:keywords set to LastChangedRevision HeadURL
File size: 611 bytes
RevLine 
[9865]1# -*- coding: utf-8 -*-
2"""
3This macro allows you to add anchor.
4
5Author: Dmitri Khijniak
6
7Usage:
8{{{
9  [[Anchor(anchor_name,text )]]
10}}}
11or
12{{{
13  [[Anchor(anchor_name)]]
14}}}
15Where:
16anchor_name::
17  is a URL used to reference the anchor
18text::
19  visible text describing the anchor
20
21Example:
22{{{
23  [[Anchor(anchor)]]
24  [[Anchor(anchor, name)]]
25}}}
26"""
27
28def execute(hdf, args, env):
29    args = tuple(args.split(","))
30    print args
31    if len(args) == 2:
32      return '<a name="%s" href="#%s">%s</a>' % (args[0],args[0],args[1])
33    else:
34      return '<a name="%s"></a>' % args
Note: See TracBrowser for help on using the repository browser.