<
From version < 45.3 >
edited by Manuel Smeria
on 2012/11/09
To version < 45.4 >
edited by Manuel Smeria
on 2013/01/17
>
Change comment: minor fixes

Summary

Details

Page properties
Content
... ... @@ -19,6 +19,7 @@
19 19  == Velocity ==
20 20  
21 21  The first thing to know is that Velocity is different from the other scripting languages on 2 aspects:
22 +
22 22  * It's a templating language rather than a pure scripting language, which means that its content is actually wiki markup interspersed with Velocity directives, whereas pure scripting languages are written in that language and they need to explicitly output wiki markup. For example:(((
23 23  Velocity:
24 24  
... ... @@ -76,7 +76,7 @@
76 76  
77 77  == [[XWiki Component>>extensions:Extension.Component Module]] Access ==
78 78  
79 -Since XWiki 4.1M2+ there's a Script Service to access the Component Manager (see also: [[Accessing components from Groovy>>DevGuide.WritingComponents#HAccessingacomponentfromgroovy]]).
80 +Since XWiki 4.1M2+ there's a Script Service to access the Component Manager (see also: [[Accessing components from Groovy>>DevGuide.WritingComponents#HFromwikipages]]).
80 80  
81 81  For example using Groovy you'd write:
82 82  
... ... @@ -130,7 +130,7 @@
130 130  
131 131  == Querying XWiki's Model ==
132 132  
133 -From your script you can query the full XWiki's Model. Check the [[Query Module>>extensions:Extension.Query Module]] for more information.
134 +From your script you can query the full XWiki Model. Check the [[Query Module>>extensions:Extension.Query Module]] for more information.
134 134  
135 135  {{id name="velocity"/}}
136 136  
... ... @@ -142,7 +142,7 @@
142 142  
143 143  In Velocity you can't import classes and as such you cannot gain direct access to XWiki components as shown [[above>>#HXWikiComponentAccess]]. This leaves you with the provided [[bindings>>#HBindings]] (NOTE: In Velocity, these bindings all start with **##$##** as with all other Velocity variables)
144 144  
145 -For more information about programming in the Velocity language, you can refer to the [[Velocity User Guide>>http://velocity.apache.org/engine/releases/velocity-1.6.2/user-guide.html]].
146 +For more information about programming in the Velocity language, you can refer to the [[Velocity User Guide>>http://velocity.apache.org/engine/releases/velocity-1.7/user-guide.html]].
146 146  
147 147  For more details on using Velocity check the [[Velocity Module Documentation>>extensions:Extension.Velocity Module]] which also contains the full list of Velocity Tools that you can use in your scripts.
148 148  
... ... @@ -158,11 +158,9 @@
158 158  These variables can be used but are subject to change in the future.
159 159  {{/warning}}
160 160  
161 -{{id name="HControllingwhethertodisplayCommentsHistoryAttachmentInformationsectionsornot"/}}
162 -
163 163  === Controlling Which Sections to Display ===
164 164  
165 -You can control whether to display Comments/History/Attachment/Information sections or not by setting some velocity variable to "no":
164 +You can control whether to display Comments/History/Attachment/Information sections or not by setting some velocity variables to "no":
166 166  
167 167  {{code language="velocity"}}
168 168  #set ($showcomments = "no")
... ... @@ -221,7 +221,7 @@
221 221  = Groovy Specific Information =
222 222  
223 223  {{info}}
224 -Currently all non Velocity scripting languages are only allowed users having Programming Rights.
223 +Currently all non Velocity scripting languages are only allowed to be used by users having Programming Rights.
225 225  {{/info}}
226 226  
227 227  * See Groovy snippets in the [[Extensions wiki>>extensions:Main.WebHome]] (click on the "Groovy" tag in the Tag Cloud)
... ... @@ -280,10 +280,6 @@
280 280  {{/python}}
281 281  {{/code}}
282 282  
283 -{{warning}}
284 -Versions prior to [[XWiki Enterprise 2.4>>xwiki:ReleaseNotes.ReleaseNotesXWikiEnterprise24]] have a bug which prevents you from having access to the default objects (doc, xcontext, request, etc.) a [[workaround is available in the Extensions wiki>>extensions:Extension.Access To Bindings In Python]]
285 -{{/warning}}
286 -
287 287  = Share variable between languages =
288 288  
289 289  Most JSR223 based scripting languages reinject the created variable in the current ScriptContext which means you can define a variable in a Groovy script and reuse it in a following Python script for example.
... ... @@ -302,7 +302,7 @@
302 302  
303 303  = Scripting In XWiki Syntax 1.0 =
304 304  
305 -XWiki Syntax 1.0 is rendered by an old rendering engine which still supported but for which no further development is planned (it will eventually be removed). Syntax 1.0 has some idiosyncrasies which were solved by syntax 2.0.
300 +XWiki Syntax 1.0 is rendered by an old rendering engine which is still supported but for which no further development is planned (it will eventually be removed). Syntax 1.0 has some idiosyncrasies which were solved by syntax 2.0.
306 306  
307 307  * The only scripting languages available to you are Velocity and Groovy.
308 308  * In Groovy, the context is known as: **##context##** not **##xcontext##**
... ... @@ -309,4 +309,4 @@
309 309  * The beginning and end of Groovy scripts are denoted by <% and %> rather than through the [[extensions:Extension.Groovy Macro]] (using ~{~{groovy}} and ~{~{/groovy}})
310 310  * Velocity is parsed in a page no matter what (there is no need to invoke the [[extensions:Extension.Velocity Macro]] using ~{~{velocity}} and ~{~{/velocity}})
311 311  
312 -The last part is important because it means you need to be careful of using $ and # in your document. This is still true inside of <% and %> so you have to be careful writing Groovy.
307 +The last part is important because it means you need to be careful when using **$** and **#** in your document. This is still true inside of **<%** and **%>** so you have to be careful when writing Groovy.

Get Connected