Syntaxe XWiki 2.1 » Programmer

Syntaxe XWiki 2.1: Programmer

Macros

2.0 Macros

En syntaxe XWiki 2.0, il y a aussi deux types de macros:

  • Les macros Velocity appelées en utilisant la syntaxe #macroname(param1 ... paramN) dans la Macro Velocity
  • Les macros XWiki appelées en utilisant la syntaxe{{macroname param1="value1" ... paramN="valueN"}}

Pour accéder à la liste de toutes les macros disponibles, allez à la page de référence des macros.

FonctionnalitéSyntaxe XWiki 2.1Résultat
Macro
{{code language="java"}}
System.out.println("Hello World!");
{{/code}}
System.out.println("Hello World!");

Les macros Radeox ne peuvent pas être utilisées en syntaxe XWiki 2.0. C'est la raison pour laquelle elles ont été ré-écrites comme des macros XWiki. 

Pour accéder à la liste de toutes les macros disponibles, allez sur Extensions wiki.

Macros dans ce wiki

IdNomCatégorieDescriptionVisiblité
tocTable Of ContentsNavigationGenerates a Table Of Contents.Global
iconPickerIcon PickerDevelopmentSelect an icon within the XWiki icon set.Wiki courant
formulaFormulaContentDisplays a mathematical formula.Global
wikimacrocontentWikiMacro ContentDevelopmentDisplay editable content of a wikimacro.Global
exampleExampleFormattingShows an example and its source code.Global
mentionUser MentionInsert a user mention.Wiki courant
asyncAsyncContentAsynchronous and cached execution of wiki content.Global
spaceindexSpace IndexDeprecatedLists documents in a space.Global
boxBoxFormattingDraw a box around provided content.Global
spacesSpacesDeprecatedDisplays all the spaces in this wiki.Global
errorError MessageFormattingDisplays an error message note.Global
warningWarning MessageFormattingDisplays a warning message note.Global
messageSenderMessage SenderSocialA control that allows users to enter messages that are handled by the MessageStream module.Global
childrenChildrenNavigationDisplays a tree of children pages of the current pageWiki courant
workspacesWorkspacesDeprecatedDeprecated macro that should not be used, here for compatibility reason. Please use the "wikis" macro instead.Global
displayDisplayContentDisplay other pages into the current page.Global
translationTranslationContentDisplay a translation message.Global
contextContextDevelopmentExecutes content in the context of the passed documentGlobal
infoInfo MessageFormattingDisplays an info message note.Global
treeTreeNavigationDisplays a tree hierarchy defined by the macro content or the source parameter.Global
liveDataLive DataContentDisplay dynamic lists of data.Global
rssRSSContentOutput latest feed entries from a RSS feed.Global
successSuccess MessageFormattingDisplays a success message note.Global
documentTreeDocument TreeNavigationDisplays the tree of XWiki documents.Wiki courant
templateTemplateDevelopmentInsert a template.Global
notificationsAutoWatchPreferencesNotifications Auto Watch PreferencesNotificationsWiki courant
chartChartContentDisplays a graphical chart generated from miscellaneous data sourcesGlobal
containerContainerLayoutA macro to enclose multiple groups and add decoration, such as layout.Global
todolistTodo ListcontentThis allows to list all the todos in a space or in the Wiki
notificationsEmailPreferencesNotifications Email PreferencesNotificationsDisplay the preferences of the current user about notification emails.Wiki courant
tagcloudTag CloudContentDisplays the cloud of tags in this wiki or in the specified space, if any.Wiki courant
activityActivity (legacy)NotificationsProvide a macro implemented with the Notifications Application to keep a backward compatibility with Activity Stream.Wiki courant
pythonPythonDevelopmentExecutes a python script.Global
commentCommentDevelopmentAllows putting comments in the source content. This macro doesn't output anything.Global
htmlHTMLDevelopmentInserts HTML or XHTML code into the page.Global
contentContentContentAllows writing content in any wiki markupGlobal
scriptScriptDevelopmentExecute script in provided script language.Global
useravatarUser AvatarContentAllows displaying the avatar for a specific user.Global
officeOffice Document ViewerContentView office attachments (doc, ppt, xls, odt, odp, ods etc.) inside wiki pages without downloading or importing them.Global
galleryGalleryLayoutDisplays the images found in the provided content using a slide-show view.Global
dashboardDashboardLayoutA macro to define a dashboard.Global
putFootnotesPut FootnoteContentDisplays the footnotes defined so far. If missing, all footnotes are displayed by default at the end of the page.Global
wikisWikisNavigationList all wikisGlobal
attachmentSelectorAttachment SelectorDevelopmentA control to be used for object properties of the current document that are supposed to contain the name of an attachment from the current (or target) document. Allows uploading new attachments, and deleting attachments from the target document.  If no target document is specified, the current document will be used. Object properties are only saved to the current document.Wiki courant
notificationsApplicationsPreferencesNotifications Applications PreferencesNotificationsDisplay the preferences of the current user about notification applications.Wiki courant
cacheCacheDevelopmentCaches content.Global
menuMenuNavigationDisplays a menu created using simple wiki syntax (nested lists and links).Globale
todotodocontentTODO Macro
documentsDocumentsContentDisplays a list of documents in a LivetableWiki courant
notificationsFiltersPreferencesNotifications Filters PreferencesNotificationsDisplay the preferences of the current user about notification filters.Wiki courant
notificationsNotificationsNotificationsWiki courant
velocityVelocityDevelopmentExecutes a Velocity script.Global
wikimacroparameterWikiMacro ParameterDevelopmentDisplay editable parameter of a wikimacro.Global
groovyGroovyDevelopmentExecute a groovy script.Global
footnoteFootnoteContentGenerates a footnote to display at the end of the page.Global
codeCodeFormattingHighlights code snippets of various programming languagesGlobal
spoilerspoilerGlobal
idIdNavigationAllows putting a reference/location in a page. In HTML for example this is called an Anchor. It allows pointing to that location, for example in links.Global
includeIncludeContentInclude other pages into the current page.Global

HTML

2.0 HTML

En syntaxe XWiki 2.1, le code HTML ou XHTML doit être écrit en utilisant la macro {{html}}.

Syntaxe XWiki 2.1Résultat
{{html}}<b>gras</b>{{/html}}gras

En syntaxe XWiki 2.1, par défaut, la macro {{html}} ne peut pas analyser la syntaxe wiki. Pour l'activer, utilisez {{html wiki="true"}}.

Scripts

2.0 Scripts

En syntaxe XWiki 1.0, il était possible d'inclure des scripts Velocity directement dans la page. Cela a créé quelques problèmes, par exemple, les cas où l'utilisateur avait inclus involontairement du contenu Velocity. Cela affectait aussi la performance des pages qui ne nécessitaient pas de contenu Velocity. Il y avait eu d'autres limitations techniques. Ainsi, en syntaxe XWiki 2.1, les scripts Velocity doivent être inclus en utilisant la macro velocity. En va de même pour l'inclusion des scripts Groovy.

FeatureSyntaxe XWiki 2.1
Script Velocity
{{velocity}}
#set ($var = "quelquechose")
{{/velocity}}
Script Groovy
{{groovy}}
def var = "quelquechose"
{{/groovy}}
Tags:
Créé par Administrator le 09-03-2021, 14:50