...
4) Fill in the code in the mandatory template field. The template content depends on what you like to include. The following examples show some possibilities. It is important to define the required parameters so that you can access them via the user macro.
4.a Define a template to include a
...
Bitbucket Server file path with User Macro Template Syntax
Code Block |
---|
## @param repoSlug|type=string|required=true
## @param branchId|type=string|required=true
## @param projectKey|type=string|required=true
## @param filepath|type=string|required=true
## @param showLineNumbers|type=boolean|required=false|default=true
## @param lineStart|type=int|required=false
## @param progLang|type=string|required=true
<ac:structured-macro ac:name="stashincludebyfilepath">
<ac:parameter ac:name="repoSlug">$paramrepoSlug</ac:parameter>
<ac:parameter ac:name="branchId">$parambranchId</ac:parameter>
<ac:parameter ac:name="projectKey">$paramprojectKey</ac:parameter>
<ac:parameter ac:name="filepath">$paramfilepath</ac:parameter>
<ac:parameter ac:name="showLineNumbers">$paramshowLineNumbers</ac:parameter>
<ac:parameter ac:name="lineStart">$paramlineStart</ac:parameter>
<ac:parameter ac:name="progLang">$paramprogLang</ac:parameter>
</ac:structured-macro> |
This definition of Wiki markup makes it possible:
And renders the following output:
4.b Define a template to include a branch list of a Bitbucket Server repository with User Macro Template Syntax
Code Block |
---|
## This is an example macro ## @param repoSlug=Name|type=string|required=true ## @param projectKey=Name|type=string|required=true <ac:structured-macro ac:name="stashbranches"> <ac:parameter ac:name="repoSlug">$paramrepoSlug</ac:parameter> <ac:parameter ac:name="projectKey">$paramprojectKey</ac:parameter> </ac:structured-macro> |
This definition of Wiki markup makes it now possible to access the Include for Bitbucket Server Macro parameters via Wiki markup syntax in the User Macro::
This renders the following output:
4.
...
c Define a Template to include the latest Commits from a Bitbucket Server project with User Macro Template Syntax
Code Block |
---|
## @param repoSlug:title=Repo Slug|required=true ## @param branchId:title=Branch Id|required=true ## @param projectKey:title=Project Key|required=true <ac:structured-macro ac:name="stashcommits"> <ac:parameter ac:name="repoSlug">$paramrepoSlug</ac:parameter> <ac:parameter ac:name="branchId">$parambranchId</ac:parameter> <ac:parameter ac:name="projectKey">$paramprojectKey</ac:parameter> </ac:structured-macro> |
Add user macro with wiki markup on a page:This definition of Wiki markup makes it possible:
This renders the following output:
...