Class ImageMacro
source code
object --+
|
core.Component --+
|
WikiMacroBase --+
|
ImageMacro
Embed an image in wiki-formatted text.
The first argument is the file specification. The file specification may
reference attachments in three ways:
* `module:id:file`, where module can be either '''wiki''' or '''ticket''',
to refer to the attachment named ''file'' of the specified wiki page or
ticket.
* `id:file`: same as above, but id is either a ticket shorthand or a Wiki
page name.
* `file` to refer to a local attachment named 'file'. This only works from
within that wiki page or a ticket.
Also, the file specification may refer to repository files, using the
`source:file` syntax (`source:file@rev` works also).
Files can also be accessed with a direct URLs; `/file` for a
project-relative, `//file` for a server-relative, or `http://server/file`
for absolute location of the file.
The remaining arguments are optional and allow configuring the attributes
and style of the rendered `<img>` element:
* digits and unit are interpreted as the size (ex. 120, 25%)
for the image
* `right`, `left`, `center`, `top`, `bottom` and `middle` are interpreted
as the alignment for the image (alternatively, the first three can be
specified using `align=...` and the last three using `valign=...`)
* `link=some TracLinks...` replaces the link to the image source by the
one specified using a TracLinks. If no value is specified, the link is
simply removed.
* `nolink` means without link to image source (deprecated, use `link=`)
* `key=value` style are interpreted as HTML attributes or CSS style
indications for the image. Valid keys are:
* align, valign, border, width, height, alt, title, longdesc, class,
margin, margin-(left,right,top,bottom), id and usemap
* `border`, `margin`, and `margin-`* can only be a single number
* `margin` is superseded by `center` which uses auto margins
Examples:
{{{
[[Image(photo.jpg)]] # simplest
[[Image(photo.jpg, 120px)]] # with image width size
[[Image(photo.jpg, right)]] # aligned by keyword
[[Image(photo.jpg, nolink)]] # without link to source
[[Image(photo.jpg, align=right)]] # aligned by attribute
}}}
You can use image from other page, other ticket or other module.
{{{
[[Image(OtherPage:foo.bmp)]] # if current module is wiki
[[Image(base/sub:bar.bmp)]] # from hierarchical wiki page
[[Image(#3:baz.bmp)]] # if in a ticket, point to #3
[[Image(ticket:36:boo.jpg)]]
[[Image(source:/images/bee.jpg)]] # straight from the repository!
[[Image(htdocs:foo/bar.png)]] # image file in project htdocs dir.
}}}
''Adapted from the Image.py macro created by Shun-ichi Goto
<[email protected]>''
|
|
|
|
|
__init__(self,
compmgr,
init=None,
cls=<class 'trac.wiki.macros.ImageMacro'>)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature |
source code
|
|
|
Inherited from WikiMacroBase:
get_macro_description,
get_macros,
parse_macro
Inherited from object:
__delattr__,
__getattribute__,
__hash__,
__reduce__,
__reduce_ex__,
__repr__,
__setattr__,
__str__
|
|
Inherited from object:
__class__
|
__init__(self,
compmgr,
init=None,
cls=<class 'trac.wiki.macros.ImageMacro'>)
(Constructor)
| source code
|
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
- Overrides:
object.__init__
- (inherited documentation)
|