Changes between Version 17 and Version 18 of TopMacro
- Timestamp:
- Jul 23, 2015, 8:53:07 AM (9 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
TopMacro
v17 v18 1 1 [[PageOutline(2-5,Contents,pullout)]] 2 = Top of page Macro =3 2 4 = = Description ==3 = Top of page Macro 5 4 6 TopMacro is exceedingly simple, like all good software ;-). In a nutshell, it 7 does exactly what you'd expect, inserts a "top of page" link in your Wiki page. 8 The only option is a string that is inserted into the content of the markup. This 9 defaults to a single circumflex "!^" character (more commonly known as a caret), 10 surrounded by square brackets. The anchor element returned includes a "Top of Page" 11 title attribute so the user knows its purpose, and a "topofpage" class so the 12 Wiki author may apply their preferred style rules. 5 == Description 6 7 This macro inserts a "top of page" link in your Trac wiki page. The only option is a string that is inserted into the content of the markup. This defaults to a single circumflex "!^" character (more commonly known as a caret), surrounded by square brackets. The anchor element returned includes a "Top of Page" title attribute so the user knows its purpose, and a "topofpage" class so the Wiki author may apply their preferred style rules. 13 8 14 9 {{{ … … 29 24 Resulting in this: 30 25 31 {{{ 32 #!html 26 {{{#!html 33 27 [<a href="#" title="Top of page">^</a>] 34 28 }}} 35 29 36 But who wants to do all that typing? 30 Note that the brackets do not form part of the anchor itself. This is a personal preference. If you pass a string to the [http://github.com/dwclifton/tractopmacro/tree/master/0.11/top/macro.py#path macro] they are omitted. 37 31 38 That's what [http://en.wikipedia.org/wiki/Macro_(computer_science) macros] are for 39 after all. Note that the brackets do not form part of the anchor itself. This is a 40 personal preference. If you pass a string to the [http://github.com/dwclifton/tractopmacro/tree/master/0.11/top/macro.py#path macro] 41 they are omitted. 42 43 == Styling == 32 === Styling 44 33 45 34 If you like the caret, but prefer to omit the brackets and style the link yourself 46 35 with CSS, try something like this: 47 36 48 {{{ 37 {{{#!css 49 38 a.topofpage { 50 39 display: block; … … 67 56 }}} 68 57 69 '''Note''': If you're going to style the anchor like this you should really pass an argument 70 to the macro or you'll end up with the default brackets in addition to the styling. 58 '''Note''': If you're going to style the anchor like this you should also pass an argument to the macro or you'll end up with the default brackets in addition to the styling. 71 59 72 == Behavior ==60 === Behavior 73 61 74 If you want to get really fancy you can use jQuery to create a smooth scrolling effect when 75 the link is clicked. In your site.html template add: 62 If you want to get really fancy you can use jQuery to create a smooth scrolling effect when the link is clicked. In your site.html template add: 76 63 77 {{{ 64 {{{#!html 78 65 <html xmlns="http://www.w3.org/1999/xhtml" 79 66 xmlns:py="http://genshi.edgewall.org/" py:strip=""> … … 92 79 }}} 93 80 94 '''Note''': Returning false from the lambda, or anonymous, function prevents the browser 95 from kicking in it's own event model.However, it degrades nicely and still works even if 96 the user has !JavaScript disabled. 81 '''Note''': Returning false from the lambda, or anonymous, function prevents the browser from kicking in it's own event model. However, it degrades nicely and still works even if the user has !JavaScript disabled. 97 82 98 == Installation ==83 == Bugs/Feature Requests 99 84 100 Download the zipped source from [raw-attachment:topmacro.zip here] or 101 clone the repository (see [#Source below]) from !GitHub to a location on your local drive. 102 Unzip the archive to a temporary location, visit the [http://github.com/dwclifton/tractopmacro/tree/master/0.11 0.11] 103 directory and run: 85 Existing bugs and feature requests for TopMacro are [query:status!=closed&component=TopMacro&order=priority here]. 104 86 105 {{{ 87 If you have any issues, create a [/newticket?component=TopMacro new ticket]. 88 89 [[TicketQuery(component=TopMacro&group=type,format=progress)]] 90 91 == Installation 92 93 Download the zipped source from [raw-attachment:topmacro.zip here] or clone the repository (see [#Source below]) from !GitHub to a location on your local drive. 94 Unzip the archive to a temporary location, visit the [http://github.com/dwclifton/tractopmacro/tree/master/0.11 0.11] directory and run: 95 96 {{{#!sh 106 97 python setup.py bdist_egg 107 98 cp dist/*.egg /trac/env/Project/plugins 108 99 }}} 109 100 110 == Configuration ==101 == Configuration 111 102 112 Enable the macro in :103 Enable the macro in `/trac/env/Project/conf/trac.ini`: 113 104 114 /trac/env/Project/conf/trac.ini: 115 116 {{{ 105 {{{#!ini 117 106 [components] 118 107 top.* = enabled … … 121 110 You may need to restart your Web server. 122 111 123 == Examples ==112 == Examples 124 113 125 114 {{{ … … 130 119 }}} 131 120 132 == Source ==121 == Source 133 122 134 123 * Browse the source at: [http://github.com/dwclifton/tractopmacro/tree/master/0.11 GitHub]. … … 138 127 }}} 139 128 140 == Bugs/Feature Requests == 141 142 Existing bugs and feature requests for TopMacro are [query:status!=closed&component=TopMacro&order=priority here]. 143 144 If you have any issues, create a [/newticket?component=TopMacro&owner=dwclifton new ticket]. 145 146 == Recent Changes == 129 == Recent Changes 147 130 148 131 [[ChangeLog(topmacro, 3)]] 149 132 150 == Author/Contributors ==133 == Author/Contributors 151 134 152 * '''Author:''' [wiki:dwclifton]153 * '''Maintainer:''' [wiki:dwclifton]154 *'''Contributors:'''135 '''Author:''' [wiki:dwclifton] [[BR]] 136 '''Maintainer:''' [[Maintainer]] [[BR]] 137 '''Contributors:'''