XWiki Syntax Guide
Moris Chao 於 2025/04/21 11:03 最後修改
XWiki Syntax 2.1 » Programming » Macros
XWiki Syntax 2.1: Macros
2.0 Macros
There is only one kind of macro in XWiki Syntax 2.1, which is called by the syntax: {{macroname param1="value1" ... paramN="valueN"}}...{{/macroname}}. For macros without content there's a short notation: {{macroname param1="value1" ... paramN="valueN"/}}
| Feature | XWiki Syntax 2.1 | Result |
|---|---|---|
| Rendering Macro with a content | {{code language="java"}}
System.out.println("Hello World!");
{{/code}}
| System.out.println("Hello World!"); |
| Rendering Macro without content | {{include reference="Space.Page"/}} | The referenced page is included in the current page |
Macros in this wiki
| Id | 名称 | 类别 | 描述 | 可见性 |
|---|---|---|---|---|
| activity | 活动 | Notifications | Provide a macro implemented with the Notifications Application to keep a backward compatibility with Activity Stream. | 在当前维基可见 |
| async | 异步宏 | 內容 | 异步执行和/或缓存宏内容。 | 对本服务器上的所有维基可见 |
| attachmentGalleryPicker | Attachment Picker | 開發 | Grid based attachment picker. | 对本服务器上的所有维基可见 |
| attachmentSelector | 附件选择器 | 開發 | 用于当前页的对象属性的控件,这些属性应该包含来自当前(或目标)页的附件的名称。允许上传新附件和从目标页面删除附件。如果没有指定目标页,则将使用当前页。对象属性仅保存到当前页。 | 在当前维基可见 |
| box | 方框 | 格式化 | 拉取一個方框將內容框起 | 对本服务器上的所有维基可见 |
| cache | 缓存 | 開發 | 缓存的内容。 | 对本服务器上的所有维基可见 |
| chart | 圖表 | 內容 | 顯示混雜資料來源產生的圖形圖表 | 对本服务器上的所有维基可见 |
| children | Children | 導覽 | Displays a tree of children pages of the current page | 在当前维基可见 |
| code | 程式碼 | 格式化 | 高亮度顯示多種程式語言的程式片斷 | 对本服务器上的所有维基可见 |
| comment | 评论 | 開發 | 允许在源内容中添加注释。这个宏不输出任何东西。 | 对本服务器上的所有维基可见 |
| container | 容器 | 布局 | 用于包围多个分组并添加装饰,例如布局。 | 对本服务器上的所有维基可见 |
| content | 内容 | 內容 | 允许在已标记的wiki编辑内容 | 对本服务器上的所有维基可见 |
| context | 上下文 | 開發 | 在指定的页面上下文中执行内容 | 对本服务器上的所有维基可见 |
| dashboard | 仪表盘 | 布局 | 定义一个仪表板的宏,用来填充小工具。 | 对本服务器上的所有维基可见 |
| display | 显示 | 內容 | 显示其他页面到当前页面。 | 对本服务器上的所有维基可见 |
| displayIcon | Icon | 內容 | Display an icon. | 对本服务器上的所有维基可见 |
| documents | 页 | 內容 | 在 Livetable 中显示页面列表 | 在当前维基可见 |
| documentTree | 页面树 | 導覽 | 显示XWiki页面树。 | 在当前维基可见 |
| error | 錯誤訊息 | 格式化 | 顯示錯誤訊息 | 对本服务器上的所有维基可见 |
| example | Example | 格式化 | Shows an example and its source code. | 在当前维基可见 |
| footnote | 註腳 | 內容 | 產生頁面最下方的註腳 | 对本服务器上的所有维基可见 |
| gallery | 图库 | 布局 | 使用幻灯片放映在提供的内容中找到的图片。 | 对本服务器上的所有维基可见 |
| groovy | Groovy | 開發 | 執行 Groovy 腳本 | 对本服务器上的所有维基可见 |
| html | HTML | 開發 | 將 HTML 及 XHTML 代碼插入頁面中 | 对本服务器上的所有维基可见 |
| iconPicker | 图标选择器 | 開發 | 在XWiki图标集中选择一个图标。 | 在当前维基可见 |
| id | 識別代碼 | 導覽 | 允許放置 關聯/位置 在頁面中。在 HTML 裡這叫做 Anchor,它可以讓超鏈結指向該位置。 | 对本服务器上的所有维基可见 |
| include | 包含 | 內容 | 將其他頁面包含至目前頁面中 | 对本服务器上的所有维基可见 |
| info | Info Message | 格式化 | Displays an info message note. | 对本服务器上的所有维基可见 |
| liveData | Live Data | 內容 | Display dynamic lists of data. | 对本服务器上的所有维基可见 |
| mention | User Mention | Notifications | Insert a user mention. | 在当前维基可见 |
| menu | 菜单 | 導覽 | 显示使用简单Wiki语法(嵌套列表和链接)创建的菜单。 | 对本服务器上的所有维基可见 |
| notifications | 通知 | Notifications | 显示wiki中发生的事件的通知。 | 在当前维基可见 |
| notificationsApplicationsPreferences | 通知应用程序偏好 | Notifications | 显示当前用户关于通知应用程序的偏好。 | 在当前维基可见 |
| notificationsAutoWatchPreferences | 通知自动监视偏好 | Notifications | 显示当前用户关于自动监视页面的偏好。 | 在当前维基可见 |
| notificationsCustomFiltersPreferences | Notifications Custom Filters Preferences | Notifications | Display the preferences of the given user about custom notification filters. | 在当前维基可见 |
| notificationsEmailPreferences | Notifications Email Preferences | Notifications | Display the preferences of the current user about notification emails. | 在当前维基可见 |
| notificationsFiltersPreferences | Notifications Filters Preferences (deprecated) | Notifications | Display the preferences of the current user about notification filters. This macro is now deprecated in favor of Custom Notifications Filters Preferences or System Notifications Filters Preferences. | 在当前维基可见 |
| notificationsSystemFiltersPreferences | Notifications System Filters Preferences | Notifications | Display the preferences of the given user about system notification filters. | 在当前维基可见 |
| office | Office 文件檢視器 | 內容 | 直接檢視 office 附件檔 (doc, ppt, xls, odt, odp, ods 等) | 对本服务器上的所有维基可见 |
| pdftoc | PDF Table of Contents | 内部 | Generates the table of contents for the PDF export. | 对本服务器上的所有维基可见 |
| putFootnotes | 顯示註腳 | 內容 | 顯示已定義的註腳. 若無則所有註腳都會被顯示在頁面的最下方 | 对本服务器上的所有维基可见 |
| python | Python | 開發 | 執行 Python 腳本 | 对本服务器上的所有维基可见 |
| script | 腳本語言 | 開發 | 執行提供的腳本語言 | 对本服务器上的所有维基可见 |
| success | 成功消息 | 格式化 | 显示一个成功消息。 | 对本服务器上的所有维基可见 |
| tagcloud | Tag Cloud | 內容 | Displays the cloud of tags in this wiki or in the specified space, if any. | 在当前维基可见 |
| template | 模板 | 開發 | 插入模板。 | 对本服务器上的所有维基可见 |
| toc | 目錄 | 導覽 | 產生目錄 | 对本服务器上的所有维基可见 |
| translation | 翻译 | 內容 | 显示一条翻译消息。 | 对本服务器上的所有维基可见 |
| tree | Tree | 導覽 | Displays a tree hierarchy defined by the macro content or the source parameter. | 在当前维基可见 |
| uiextension | UI 扩展 | 開發 | 插入 UI 扩展。 | 对本服务器上的所有维基可见 |
| uiextensions | UI 扩展 | 開發 | 插入 UI 扩展。 | 对本服务器上的所有维基可见 |
| useravatar | 使用圖像 | 內容 | 允許顯示特定使用者的圖像 | 对本服务器上的所有维基可见 |
| velocity | Velocity | 開發 | 執行 Velocity 腳本 | 对本服务器上的所有维基可见 |
| warning | 警告訊息 | 格式化 | 顯示警告訊息 | 对本服务器上的所有维基可见 |
| wikimacrocontent | WikiMacro Content | 開發 | Display editable content of a wikimacro. | 对本服务器上的所有维基可见 |
| wikimacroparameter | WikiMacro Parameter | 開發 | Display editable parameter of a wikimacro. | 对本服务器上的所有维基可见 |
| wikis | Wikis | 導覽 | List all wikis | 在当前维基可见 |
| workspaces | Workspaces (Legacy) | 已过时 | Deprecated macro that should not be used here for compatibility reasons. Please use the "wikis" macro instead. | 在当前维基可见 |