Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 116 lines (87 sloc) 2.638 kb
6648394 @dwclifton Initial commit of Trac TopMacro
authored
1 = !TopMacro =
2
3 TopMacro is exceedingly simple, like all good software ;-). In a nutshell, it
769f018 @dwclifton Removed parent <span> element, bumped version and updated README.
authored
4 does exactly what you'd expect, inserts a "top of page" link in your Wiki page.
5 The only option is a string that is inserted into the content of the markup. This
6 defaults to a single circumflex "!^" character (more commonly known as a caret),
6648394 @dwclifton Initial commit of Trac TopMacro
authored
7 surrounded by square brackets. The anchor element returned includes a "Top of Page"
769f018 @dwclifton Removed parent <span> element, bumped version and updated README.
authored
8 title attribute so the user knows its purpose, and a "topofpage" class so the
9 Wiki author may apply their preferred style rules.
6648394 @dwclifton Initial commit of Trac TopMacro
authored
10
11 {{{
769f018 @dwclifton Removed parent <span> element, bumped version and updated README.
authored
12 [[Top]] returns:
6648394 @dwclifton Initial commit of Trac TopMacro
authored
13
769f018 @dwclifton Removed parent <span> element, bumped version and updated README.
authored
14 [<a class="topofpage" href="#" title="Top of page">^</a>]
6648394 @dwclifton Initial commit of Trac TopMacro
authored
15 }}}
16
17 You could of course achieve the same effect by doing this:
18
19 {{{
20 {{{
21 #!html
2d2586b @dwclifton Synced README with the wike page
authored
22 [<a href="#" title="Top of page">^</a>]
6648394 @dwclifton Initial commit of Trac TopMacro
authored
23 }}}
24 }}}
25
26 Resulting in this:
27
28 {{{
29 #!html
2d2586b @dwclifton Synced README with the wike page
authored
30 [<a href="#" title="Top of page">^</a>]
6648394 @dwclifton Initial commit of Trac TopMacro
authored
31 }}}
32
2d2586b @dwclifton Synced README with the wike page
authored
33 But who wants to do all that typing?
34
35 That's what [http://en.wikipedia.org/wiki/Macro_(computer_science) macros] are for
36 after all. Note that the brackets do not form part of the anchor itself. That is a
769f018 @dwclifton Removed parent <span> element, bumped version and updated README.
authored
37 personal preference. If you pass a string to the macro they are omitted.
2d2586b @dwclifton Synced README with the wike page
authored
38
39 == Styling ==
40
41 If you like the caret, but prefer to omit the brackets and style the link yourself
769f018 @dwclifton Removed parent <span> element, bumped version and updated README.
authored
42 with CSS, try something like this:
2d2586b @dwclifton Synced README with the wike page
authored
43
44 {{{
769f018 @dwclifton Removed parent <span> element, bumped version and updated README.
authored
45 a.topofpage {
46 display: block;
47 height: 11px;
48 width: 11px;
49 font-family: 'BitStream Vera Sans',Verdana,Arial,Helvetica,sans-serif;
50 font-weight: bold;
51 text-decoration: none;
2d2586b @dwclifton Synced README with the wike page
authored
52 background-color: #eaeaea;
769f018 @dwclifton Removed parent <span> element, bumped version and updated README.
authored
53 color: #e9611c;
54 padding: 1px 2px 2px;
2d2586b @dwclifton Synced README with the wike page
authored
55 border: 1px solid #c6c7db;
769f018 @dwclifton Removed parent <span> element, bumped version and updated README.
authored
56 margin-left: -6px;
57 }
58 a.topofpage:hover {
59 border-color: #000;
60 background-color: #777;
61 color: #fc3;
2d2586b @dwclifton Synced README with the wike page
authored
62 }
63 }}}
64
769f018 @dwclifton Removed parent <span> element, bumped version and updated README.
authored
65 {{{
66 [[Top(^)]]
67 }}}
68
2d2586b @dwclifton Synced README with the wike page
authored
69 Resulting in:
70
71 [[Top(^)]]
72
769f018 @dwclifton Removed parent <span> element, bumped version and updated README.
authored
73 Note that if you're going to style the anchor like this you should really pass an argument
74 to the macro or you'll end up with the default brackets in addition to the styling.
6648394 @dwclifton Initial commit of Trac TopMacro
authored
75
76 == Installation ==
77
769f018 @dwclifton Removed parent <span> element, bumped version and updated README.
authored
78 Download the zipped source from [/raw-attachment/wiki/TopMacro/topmacro.zip here] or on
79 [http://trac-hacks.org/attachment/wiki/TopMacro/topmacro.zip?format=raw Trac Hacks]. Unzip
80 the archive to a temporary location, visit the 0.11 directory and run:
81
6648394 @dwclifton Initial commit of Trac TopMacro
authored
82 {{{
83 python setup.py bdist_egg
84 cp dist/*.egg /trac/env/Project/plugins
85 }}}
86
87 == Configuration ==
88
89 Enable the macro in:
90
91 /trac/env/Project/conf/trac.ini:
92
93 {{{
94 [components]
95 top.* = enabled
96 }}}
97
2d2586b @dwclifton Synced README with the wike page
authored
98 You may need to restart your Web server.
6648394 @dwclifton Initial commit of Trac TopMacro
authored
99
100 == Examples ==
101
102 {{{
103 [[Top]]
2d2586b @dwclifton Synced README with the wike page
authored
104 [[Top(^)]]
6648394 @dwclifton Initial commit of Trac TopMacro
authored
105 [[Top(top)]]
106 [[Top(Top of page)]]
107 }}}
108
109 == Source ==
110
769f018 @dwclifton Removed parent <span> element, bumped version and updated README.
authored
111 * Browse the source at: [http://github.com/dwclifton/tractopmacro/tree/master/0.11 GitHub].
2d2586b @dwclifton Synced README with the wike page
authored
112 * Public clone URL:
6648394 @dwclifton Initial commit of Trac TopMacro
authored
113 {{{
2d2586b @dwclifton Synced README with the wike page
authored
114 git clone git@github.com:dwclifton/tractopmacro.git
6648394 @dwclifton Initial commit of Trac TopMacro
authored
115 }}}
Something went wrong with that request. Please try again.