Wiki Macros

inyoka.wiki.macros

Macros for the wiki.

copyright:
  1. 2012-2025 by the Inyoka Team, see AUTHORS for more details.

license:

BSD, see LICENSE for more details.

class inyoka.wiki.macros.Attachment(*args, **orig_kw)

This macro displays a download link for an attachment.

allowed_context = ['wiki']

The render context this macro is allowed in. Restrictive by default

arguments = (('attachment', <class 'str'>, ''), ('text', <class 'str'>, ''))

the arguments this macro expects

build_node(context, format)

If this is a static macro this method has to return a node. If it’s a runtime node a context and format parameter is passed.

A static macro has to return a node, runtime macros can either have a look at the passed format and return a string for that format or return a normal node which is then rendered into that format.

names = ('Attachment', 'Anhang')

The canonical names for this macro. A macro may have multiple aliases e.g to support multiple languages.

class inyoka.wiki.macros.AttachmentList(*args, **orig_kw)

Return a list of attachments or attachments below a given page.

allowed_context = ['wiki']

The render context this macro is allowed in. Restrictive by default

arguments = (('page', <class 'str'>, ''), ('shorten_title', <class 'bool'>, False))

the arguments this macro expects

build_node(context, format)

If this is a static macro this method has to return a node. If it’s a runtime node a context and format parameter is passed.

A static macro has to return a node, runtime macros can either have a look at the passed format and return a string for that format or return a normal node which is then rendered into that format.

is_block_tag = True

true if this macro returns a block level node in dynamic rendering. This does not affect static rendering.

names = ('AttachmentList', 'Anhänge')

The canonical names for this macro. A macro may have multiple aliases e.g to support multiple languages.

class inyoka.wiki.macros.FilterByMetaData(*args, **orig_kw)

Filter pages by their metadata.

One filter has the form key: value. Multiple filters can be combined with a ; in the sense of a and. Value can contain multiple values seperated by , in the sense of or.

NOT at the start of a value negates the filter. It can be used (multiple times) only at the start of a filter. Additionally, only one value can be used with NOT.

Examples:

[[FilterByMetaData(“tag: baz”)]] lists pages that have the tag baz [[FilterByMetaData(“X-Link: foo,bar”)]] lists pages that have a link to foo _or_ bar [[FilterByMetaData(“X-Link: foo; X-Link: bar”)]] lists pages that have a link to foo _and_ bar [[FilterByMetaData(“X-Link: NOT gras”)]] lists pages that not contain a link to gras

_is_allowed_key(key: str) bool

Returns True, if this is an allowed metadata key.

Via this method the queryable metadata keys can be restricted. Disallowed is for example the key X-Behave.

allowed_context = ['wiki']

The render context this macro is allowed in. Restrictive by default

arguments = (('filters', <class 'str'>, ''),)

the arguments this macro expects

build_node(context, format)

If this is a static macro this method has to return a node. If it’s a runtime node a context and format parameter is passed.

A static macro has to return a node, runtime macros can either have a look at the passed format and return a string for that format or return a normal node which is then rendered into that format.

is_block_tag = True

true if this macro returns a block level node in dynamic rendering. This does not affect static rendering.

names = ('FilterByMetaData', 'MetaFilter')

The canonical names for this macro. A macro may have multiple aliases e.g to support multiple languages.

class inyoka.wiki.macros.OrphanedPages(*args, **orig_kw)

Return a list of orphaned pages.

allowed_context = ['wiki']

The render context this macro is allowed in. Restrictive by default

build_node(context, format)

If this is a static macro this method has to return a node. If it’s a runtime node a context and format parameter is passed.

A static macro has to return a node, runtime macros can either have a look at the passed format and return a string for that format or return a normal node which is then rendered into that format.

is_block_tag = True

true if this macro returns a block level node in dynamic rendering. This does not affect static rendering.

names = ('OrphanedPages', 'VerwaisteSeiten')

The canonical names for this macro. A macro may have multiple aliases e.g to support multiple languages.

class inyoka.wiki.macros.PageCount(*args, **orig_kw)

Return the number of existing pages.

allowed_context = ['wiki']

The render context this macro is allowed in. Restrictive by default

build_node(context, format)

If this is a static macro this method has to return a node. If it’s a runtime node a context and format parameter is passed.

A static macro has to return a node, runtime macros can either have a look at the passed format and return a string for that format or return a normal node which is then rendered into that format.

names = ('PageCount', 'Seitenzahl')

The canonical names for this macro. A macro may have multiple aliases e.g to support multiple languages.

class inyoka.wiki.macros.PageList(*args, **orig_kw)

Return a list of pages.

allowed_context = ['wiki']

The render context this macro is allowed in. Restrictive by default

arguments = (('pattern', <class 'str'>, ''), ('case_sensitive', <class 'bool'>, True), ('shorten_title', <class 'bool'>, False))

the arguments this macro expects

build_node(context, format)

If this is a static macro this method has to return a node. If it’s a runtime node a context and format parameter is passed.

A static macro has to return a node, runtime macros can either have a look at the passed format and return a string for that format or return a normal node which is then rendered into that format.

is_block_tag = True

true if this macro returns a block level node in dynamic rendering. This does not affect static rendering.

names = ('PageList', 'Seitenliste')

The canonical names for this macro. A macro may have multiple aliases e.g to support multiple languages.

class inyoka.wiki.macros.PageName(*args, **orig_kw)

Return the name of the current page if the render context knows about that. This is only useful when rendered from a wiki page.

allowed_context = ['wiki']

The render context this macro is allowed in. Restrictive by default

build_node(context, format)

If this is a static macro this method has to return a node. If it’s a runtime node a context and format parameter is passed.

A static macro has to return a node, runtime macros can either have a look at the passed format and return a string for that format or return a normal node which is then rendered into that format.

names = ('PageName', 'Seitenname')

The canonical names for this macro. A macro may have multiple aliases e.g to support multiple languages.

class inyoka.wiki.macros.Picture(*args, **orig_kw)

This macro can display external images and attachments as images. It also takes care about thumbnail generation. For any internal (attachment) image included that way an X-Attach metadata is emitted.

Like for any link only absolute targets are allowed. This might be surprising behavior if you’re used to the MoinMoin syntax but caused by the fact that the parser does not know at parse time on which page it is operating.

allowed_context = ['ikhaya', 'wiki']

The render context this macro is allowed in. Restrictive by default

arguments = (('picture', <class 'str'>, ''), ('size', <class 'str'>, ''), ('align', <class 'str'>, ''), ('alt', <class 'str'>, None), ('title', <class 'str'>, None))

the arguments this macro expects

build_node(context, format)

If this is a static macro this method has to return a node. If it’s a runtime node a context and format parameter is passed.

A static macro has to return a node, runtime macros can either have a look at the passed format and return a string for that format or return a normal node which is then rendered into that format.

names = ('Picture', 'Bild')

The canonical names for this macro. A macro may have multiple aliases e.g to support multiple languages.

class inyoka.wiki.macros.RedirectPages(*args, **orig_kw)

Return a list of pages that redirect to somewhere.

allowed_context = ['wiki']

The render context this macro is allowed in. Restrictive by default

build_node(context, format)

If this is a static macro this method has to return a node. If it’s a runtime node a context and format parameter is passed.

A static macro has to return a node, runtime macros can either have a look at the passed format and return a string for that format or return a normal node which is then rendered into that format.

is_block_tag = True

true if this macro returns a block level node in dynamic rendering. This does not affect static rendering.

names = ('RedirectPages', 'Weiterleitungen')

The canonical names for this macro. A macro may have multiple aliases e.g to support multiple languages.

class inyoka.wiki.macros.SimilarPages(*args, **orig_kw)

Show a list of pages similar to the page name given or the page from the render context.

allowed_context = ['wiki']

The render context this macro is allowed in. Restrictive by default

arguments = (('page', <class 'str'>, ''),)

the arguments this macro expects

build_node(context, format)

If this is a static macro this method has to return a node. If it’s a runtime node a context and format parameter is passed.

A static macro has to return a node, runtime macros can either have a look at the passed format and return a string for that format or return a normal node which is then rendered into that format.

is_block_tag = True

true if this macro returns a block level node in dynamic rendering. This does not affect static rendering.

names = ('SimilarPages', 'ÄhnlicheSeiten')

The canonical names for this macro. A macro may have multiple aliases e.g to support multiple languages.

class inyoka.wiki.macros.TagList(*args, **orig_kw)

Show a taglist.

allowed_context = ['wiki']

The render context this macro is allowed in. Restrictive by default

arguments = (('tag', <class 'str'>, ''),)

the arguments this macro expects

build_node(context, format)

If this is a static macro this method has to return a node. If it’s a runtime node a context and format parameter is passed.

A static macro has to return a node, runtime macros can either have a look at the passed format and return a string for that format or return a normal node which is then rendered into that format.

is_block_tag = True

true if this macro returns a block level node in dynamic rendering. This does not affect static rendering.

names = ('TagList', 'TagListe')

The canonical names for this macro. A macro may have multiple aliases e.g to support multiple languages.

class inyoka.wiki.macros.Template(args, kwargs)

Include a page as template and expand it.

allowed_context = ['forum', 'ikhaya', 'wiki']

The render context this macro is allowed in. Restrictive by default

build_node()

If this is a static macro this method has to return a node. If it’s a runtime node a context and format parameter is passed.

A static macro has to return a node, runtime macros can either have a look at the passed format and return a string for that format or return a normal node which is then rendered into that format.

has_argument_parser = True

set this to True if you want to do the argument parsing yourself.

is_static = True

if a macro is static this has to be true.

names = ('Template', 'Vorlage')

The canonical names for this macro. A macro may have multiple aliases e.g to support multiple languages.