Edgewall Software

Changes between Version 41 and Version 42 of WikiMacros


Ignore:
Timestamp:
Jul 16, 2012, 10:21:04 PM (12 years ago)
Author:
trac
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • WikiMacros

    v41 v42  
    1 ** Note: this page documents the 0.12 version of Trac, see [[0.11/WikiMacros]] if you need the previous version and [[0.13/WikiMacros]] if you need the next version**
     1** Note: this page documents the 1.0 version of Trac, see [[0.12/WikiMacros]] if you need the previous version and [[0.13/WikiMacros]] if you need the next version**
    22= Trac Macros =
    33
     
    1616The list of available macros and the full help can be obtained using the !MacroList macro, as seen [#AvailableMacros below].
    1717
    18 A brief list can be obtained via ![[MacroList(*)]] or ![[?]].
     18A brief list can be obtained via `[[MacroList(*)]]` or `[[?]]`.
    1919
    20 Detailed help on a specific macro can be obtained by passing it as an argument to !MacroList, e.g. ![[MacroList(MacroList)]], or, more conveniently, by appending a question mark (?) to the macro's name, like in ![[MacroList?]].
     20Detailed help on a specific macro can be obtained by passing it as an argument to !MacroList, e.g. `[[MacroList(MacroList)]]`, or, more conveniently, by appending a question mark (`?`) to the macro's name, like in `[[MacroList?]]`.
    2121
    2222
     
    6868''Note that the following list will only contain the macro documentation if you've not enabled `-OO` optimizations, or not set the `PythonOptimize` option for [wiki:TracModPython mod_python].''
    6969
    70 (the following is snapshot for Trac 0.12.2 - see [[0.13/WikiMacros]] for the documentation of macros in trunk / 0.13dev)
    71 {{{#!html
    72 <div class="trac-macrolist"><h3 id="Image-macro"><code>[[Image]]</code></h3><p>
    73 Embed an image in wiki-formatted text.
    74 </p>
    75 <p>
    76 The first argument is the file specification. The file specification may
    77 reference attachments in three ways:
    78 </p>
    79 <ul><li><tt>module:id:file</tt>, where module can be either <strong>wiki</strong> or <strong>ticket</strong>,
    80 to refer to the attachment named <em>file</em> of the specified wiki page or
    81 ticket.
    82 </li><li><tt>id:file</tt>: same as above, but id is either a ticket shorthand or a Wiki
    83 page name.
    84 </li><li><tt>file</tt> to refer to a local attachment named 'file'. This only works from
    85 within that wiki page or a ticket.
    86 </li></ul><p>
    87 Also, the file specification may refer to repository files, using the
    88 <tt>source:file</tt> syntax (<tt>source:file@rev</tt> works also).
    89 </p>
    90 <p>
    91 Files can also be accessed with a direct URLs; <tt>/file</tt> for a
    92 project-relative, <tt>//file</tt> for a server-relative, or <tt>http://server/file</tt>
    93 for absolute location of the file.
    94 </p>
    95 <p>
    96 The remaining arguments are optional and allow configuring the attributes
    97 and style of the rendered <tt>&lt;img&gt;</tt> element:
    98 </p>
    99 <ul><li>digits and unit are interpreted as the size (ex. 120, 25%)
    100 for the image
    101 </li><li><tt>right</tt>, <tt>left</tt>, <tt>center</tt>, <tt>top</tt>, <tt>bottom</tt> and <tt>middle</tt> are interpreted
    102 as the alignment for the image (alternatively, the first three can be
    103 specified using <tt>align=...</tt> and the last three using <tt>valign=...</tt>)
    104 </li><li><tt>link=some TracLinks...</tt> replaces the link to the image source by the
    105 one specified using a <a class="wiki" href="/wiki/TracLinks">TracLinks</a>. If no value is specified, the link is
    106 simply removed.
    107 </li><li><tt>nolink</tt> means without link to image source (deprecated, use <tt>link=</tt>)
    108 </li><li><tt>key=value</tt> style are interpreted as HTML attributes or CSS style
    109 indications for the image. Valid keys are:
    110 <ul><li>align, valign, border, width, height, alt, title, longdesc, class,
    111 margin, margin-(left,right,top,bottom), id and usemap
    112 </li><li><tt>border</tt>, <tt>margin</tt>, and <tt>margin-</tt>* can only be a single number
    113 </li><li><tt>margin</tt> is superseded by <tt>center</tt> which uses auto margins
    114 </li></ul></li></ul><p>
    115 Examples:
    116 </p>
    117 <pre class="wiki">    [[Image(photo.jpg)]]                           # simplest
    118     [[Image(photo.jpg, 120px)]]                    # with image width size
    119     [[Image(photo.jpg, right)]]                    # aligned by keyword
    120     [[Image(photo.jpg, nolink)]]                   # without link to source
    121     [[Image(photo.jpg, align=right)]]              # aligned by attribute
    122 </pre><p>
    123 You can use image from other page, other ticket or other module.
    124 </p>
    125 <pre class="wiki">    [[Image(OtherPage:foo.bmp)]]    # if current module is wiki
    126     [[Image(base/sub:bar.bmp)]]     # from hierarchical wiki page
    127     [[Image(#3:baz.bmp)]]           # if in a ticket, point to #3
    128     [[Image(ticket:36:boo.jpg)]]
    129     [[Image(source:/images/bee.jpg)]] # straight from the repository!
    130     [[Image(htdocs:foo/bar.png)]]   # image file in project htdocs dir.
    131 </pre><p>
    132 <em>Adapted from the Image.py macro created by Shun-ichi Goto
    133 &lt;gotoh@…&gt;</em>
    134 </p>
    135 <h3 id="InterTrac-macro"><code>[[InterTrac]]</code></h3><p>
    136 Provide a list of known <a class="wiki" href="/wiki/InterTrac">InterTrac</a> prefixes.
    137 </p>
    138 <h3 id="InterWiki-macro"><code>[[InterWiki]]</code></h3><p>
    139 Provide a description list for the known <a class="wiki" href="/wiki/InterWiki">InterWiki</a> prefixes.
    140 </p>
    141 <h3 id="KnownMimeTypes-macro"><code>[[KnownMimeTypes]]</code></h3><p>
    142 List all known mime-types which can be used as <a class="wiki" href="/wiki/WikiProcessors">WikiProcessors</a>.
    143 </p>
    144 <p>
    145 Can be given an optional argument which is interpreted as mime-type filter.
    146 </p>
    147 <h3 id="MacroList-macro"><code>[[MacroList]]</code></h3><p>
    148 Display a list of all installed Wiki macros, including documentation if
    149 available.
    150 </p>
    151 <p>
    152 Optionally, the name of a specific macro can be provided as an argument. In
    153 that case, only the documentation for that macro will be rendered.
    154 </p>
    155 <p>
    156 Note that this macro will not be able to display the documentation of
    157 macros if the <tt>PythonOptimize</tt> option is enabled for mod_python!
    158 </p>
    159 <h3 id="PageOutline-macro"><code>[[PageOutline]]</code></h3><p>
    160 Display a structural outline of the current wiki page, each item in the
    161 outline being a link to the corresponding heading.
    162 </p>
    163 <p>
    164 This macro accepts three optional parameters:
    165 </p>
    166 <ul><li>The first is a number or range that allows configuring the minimum and
    167 maximum level of headings that should be included in the outline. For
    168 example, specifying "1" here will result in only the top-level headings
    169 being included in the outline. Specifying "2-3" will make the outline
    170 include all headings of level 2 and 3, as a nested list. The default is
    171 to include all heading levels.
    172 </li><li>The second parameter can be used to specify a custom title (the default
    173 is no title).
    174 </li><li>The third parameter selects the style of the outline. This can be
    175 either <tt>inline</tt> or <tt>pullout</tt> (the latter being the default). The <tt>inline</tt>
    176 style renders the outline as normal part of the content, while <tt>pullout</tt>
    177 causes the outline to be rendered in a box that is by default floated to
    178 the right side of the other content.
    179 </li></ul><h3 id="RecentChanges-macro"><code>[[RecentChanges]]</code></h3><p>
    180 List all pages that have recently been modified, grouping them by the
    181 day they were last modified.
    182 </p>
    183 <p>
    184 This macro accepts two parameters. The first is a prefix string: if
    185 provided, only pages with names that start with the prefix are included in
    186 the resulting list. If this parameter is omitted, all pages are listed.
    187 </p>
    188 <p>
    189 The second parameter is a number for limiting the number of pages returned.
    190 For example, specifying a limit of 5 will result in only the five most
    191 recently changed pages to be included in the list.
    192 </p>
    193 <h3 id="RepositoryIndex-macro"><code>[[RepositoryIndex]]</code></h3><p>
    194 Display the list of available repositories.
    195 </p>
    196 <p>
    197 Can be given the following named arguments:
    198 </p>
    199 <dl class="wiki"><dt><em>format</em></dt><dd>
    200 Select the rendering format:
    201 <ul><li><em>compact</em> produces a comma-separated list of repository prefix
    202 names (default)
    203 </li><li><em>list</em> produces a description list of repository prefix names
    204 </li><li><em>table</em> produces a table view, similar to the one visible in
    205 the <em>Browse View</em> page
    206 </li></ul></dd><dt><em>glob</em></dt><dd>
    207 Do a glob-style filtering on the repository names (defaults to '*')
    208 </dd><dt><em>order</em></dt><dd>
    209 Order repositories by the given column (one of "name", "date" or
    210 "author")
    211 </dd><dt><em>desc</em></dt><dd>
    212 When set to 1, order by descending order
    213 </dd></dl>
    214 <p>
    215 (<em>since 0.12</em>)
    216 </p>
    217 <h3 id="TicketQuery-macro"><code>[[TicketQuery]]</code></h3><p>
    218 Wiki macro listing tickets that match certain criteria.
    219 </p>
    220 <p>
    221 This macro accepts a comma-separated list of keyed parameters,
    222 in the form "key=value".
    223 </p>
    224 <p>
    225 If the key is the name of a field, the value must use the syntax
    226 of a filter specifier as defined in <a class="wiki" href="/wiki/TracQuery#QueryLanguage">TracQuery#QueryLanguage</a>.
    227 Note that this is <em>not</em> the same as the simplified URL syntax
    228 used for <tt>query:</tt> links starting with a <tt>?</tt> character. Commas (<tt>,</tt>)
    229 can be included in field values by escaping them with a backslash (<tt>\</tt>).
    230 </p>
    231 <p>
    232 Groups of field constraints to be OR-ed together can be separated by a
    233 litteral <tt>or</tt> argument.
    234 </p>
    235 <p>
    236 In addition to filters, several other named parameters can be used
    237 to control how the results are presented. All of them are optional.
    238 </p>
    239 <p>
    240 The <tt>format</tt> parameter determines how the list of tickets is
    241 presented:
    242 </p>
    243 <ul><li><strong>list</strong> -- the default presentation is to list the ticket ID next
    244 to the summary, with each ticket on a separate line.
    245 </li><li><strong>compact</strong> -- the tickets are presented as a comma-separated
    246 list of ticket IDs.
    247 </li><li><strong>count</strong> -- only the count of matching tickets is displayed
    248 </li><li><strong>table</strong>  -- a view similar to the custom query view (but without
    249 the controls)
    250 </li></ul><p>
    251 The <tt>max</tt> parameter can be used to limit the number of tickets shown
    252 (defaults to <strong>0</strong>, i.e. no maximum).
    253 </p>
    254 <p>
    255 The <tt>order</tt> parameter sets the field used for ordering tickets
    256 (defaults to <strong>id</strong>).
    257 </p>
    258 <p>
    259 The <tt>desc</tt> parameter indicates whether the order of the tickets
    260 should be reversed (defaults to <strong>false</strong>).
    261 </p>
    262 <p>
    263 The <tt>group</tt> parameter sets the field used for grouping tickets
    264 (defaults to not being set).
    265 </p>
    266 <p>
    267 The <tt>groupdesc</tt> parameter indicates whether the natural display
    268 order of the groups should be reversed (defaults to <strong>false</strong>).
    269 </p>
    270 <p>
    271 The <tt>verbose</tt> parameter can be set to a true value in order to
    272 get the description for the listed tickets. For <strong>table</strong> format only.
    273 <em>deprecated in favor of the <tt>rows</tt> parameter</em>
    274 </p>
    275 <p>
    276 The <tt>rows</tt> parameter can be used to specify which field(s) should
    277 be viewed as a row, e.g. <tt>rows=description|summary</tt>
    278 </p>
    279 <p>
    280 For compatibility with Trac 0.10, if there's a last positional parameter
    281 given to the macro, it will be used to specify the <tt>format</tt>.
    282 Also, using "&amp;" as a field separator still works (except for <tt>order</tt>)
    283 but is deprecated.
    284 </p>
    285 <h3 id="TitleIndex-macro"><code>[[TitleIndex]]</code></h3><p>
    286 Insert an alphabetic list of all wiki pages into the output.
    287 </p>
    288 <p>
    289 Accepts a prefix string as parameter: if provided, only pages with names
    290 that start with the prefix are included in the resulting list. If this
    291 parameter is omitted, all pages are listed.
    292 If the prefix is specified, a second argument of value 'hideprefix'
    293 can be given as well, in order to remove that prefix from the output.
    294 </p>
    295 <p>
    296 Alternate <tt>format</tt> and <tt>depth</tt> named parameters can be specified:
    297 </p>
    298 <ul><li><tt>format=compact</tt>: The pages are displayed as comma-separated links.
    299 </li><li><tt>format=group</tt>: The list of pages will be structured in groups
    300 according to common prefix. This format also supports a <tt>min=n</tt>
    301 argument, where <tt>n</tt> is the minimal number of pages for a group.
    302 </li><li><tt>format=hierarchy</tt>: The list of pages will be structured according
    303 to the page name path hierarchy. This format also supports a <tt>min=n</tt>
    304 argument, where higher <tt>n</tt> flatten the display hierarchy
    305 </li><li><tt>depth=n</tt>: limit the depth of the pages to list. If set to 0,
    306 only toplevel pages will be shown, if set to 1, only immediate
    307 children pages will be shown, etc. If not set, or set to -1,
    308 all pages in the hierarchy will be shown.
    309 </li></ul><h3 id="TracAdminHelp-macro"><code>[[TracAdminHelp]]</code></h3><p>
    310 Display help for trac-admin commands.
    311 </p>
    312 <p>
    313 Examples:
    314 </p>
    315 <pre class="wiki">[[TracAdminHelp]]               # all commands
    316 [[TracAdminHelp(wiki)]]         # all wiki commands
    317 [[TracAdminHelp(wiki export)]]  # the "wiki export" command
    318 [[TracAdminHelp(upgrade)]]      # the upgrade command
    319 </pre><h3 id="TracGuideToc-macro"><code>[[TracGuideToc]]</code></h3><p>
    320 Display a table of content for the Trac guide.
    321 </p>
    322 <p>
    323 This macro shows a quick and dirty way to make a table-of-contents
    324 for the <a class="missing wiki">Help/Guide?</a>. The table of contents will contain the Trac* and
    325 <a class="wiki" href="/wiki/WikiFormatting">WikiFormatting</a> pages, and can't be customized. Search for <a class="missing wiki">TocMacro?</a> for a
    326 a more customizable table of contents.
    327 </p>
    328 <h3 id="TracIni-macro"><code>[[TracIni]]</code></h3><p>
    329 Produce documentation for the Trac configuration file.
    330 </p>
    331 <p>
    332 Typically, this will be used in the <a class="wiki" href="/wiki/TracIni">TracIni</a> page.
    333 Optional arguments are a configuration section filter,
    334 and a configuration option name filter: only the configuration
    335 options whose section and name start with the filters are output.
    336 </p>
    337 </div>
    338 }}}
     70[[MacroList]]
    33971
    34072== Macros from around the world ==
     
    418150For example, when writing:
    419151{{{
    420 {{{#!HelloWorld style="polite"
     152{{{#!HelloWorld style="polite" -silent verbose
    421153<Hello World!>
    422154}}}
     
    430162One should get:
    431163{{{
    432 Hello World, text = <Hello World!> , args = {'style': u'polite'}
     164Hello World, text = <Hello World!> , args = {'style': u'polite', 'silent': False, 'verbose': True}
    433165Hello World, text = <Hello World!> , args = {}
    434166Hello World, text = <Hello World!> , args = None