From version 1.1 >
edited by Vincent Massol
on 2017/05/31
To version < 3.1 >
edited by Vincent Massol
on 2021/04/08
>
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -1,4 +1,4 @@
1 -{{include reference="ReleaseNotes.Code.ChangesVelocityMacros"/}}
1 +{{include reference="ReleaseNotes.Code.EntryVelocityMacros"/}}
2 2  
3 3  {{velocity}}
4 4  #set ($topSpace = $doc.documentReference.extractFirstReference('SPACE').getName())
... ... @@ -24,15 +24,16 @@
24 24   #set ($discard = $rnObject.set('date', ''))
25 25   ## Copy the template content + title
26 26   #set ($templateDoc = $xwiki.getDocument($defaultTemplateReferenceString))
27 - ## Run Velocity on the template to evaluate the velocity code in the template
28 - #define($evaluatedContent)
29 - #evaluate($templateDoc.content)
30 - #end
31 - #set ($discard = $rnDoc.setContent($evaluatedContent))
32 - #define($evaluatedTitle)
33 - #evaluate($templateDoc.title)
34 - #end
35 - #set ($discard = $rnDoc.setTitle($evaluatedTitle))
27 + ## Replace the following template variables in the template content and title by the product value.
28 + ## We do that here instead of using Velocity in the template content/title so that the generated RN page renders
29 + ## as fast as possible. We also use a template variavle format different than the velocity syntax so that the
30 + ## template page can use Velocity and any variable it wishes without a risk of clash.
31 + ## - "!!product!!" --> $product
32 + ## - "!!version!!" --> $version
33 + #set ($newContent = $stringtool.replaceEach($templateDoc.content, ['!!product!!', '!!version!!'], [$product, $version]))
34 + #set ($discard = $rnDoc.setContent($newContent))
35 + #set ($newTitle = $stringtool.replaceEach($templateDoc.title, ['!!product!!', '!!version!!'], [$product, $version]))
36 + #set ($discard = $rnDoc.setTitle($newTitle))
36 36   #set ($discard = $rnDoc.save('New Release note'))
37 37   ## Redirect in edit mode to edit the RN
38 38   $response.sendRedirect($xwiki.getURL($services.model.serialize($rnPageReference)))

Get Connected