## Licensed to the Apache Software Foundation (ASF) under one ## or more contributor license agreements. See the NOTICE file ## distributed with this work for additional information ## regarding copyright ownership. The ASF licenses this file ## to you under the Apache License, Version 2.0 (the ## "License"); you may not use this file except in compliance ## with the License. You may obtain a copy of the License at ## ## http://www.apache.org/licenses/LICENSE-2.0 ## ## Unless required by applicable law or agreed to in writing, ## software distributed under the License is distributed on an ## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY ## KIND, either express or implied. See the License for the ## specific language governing permissions and limitations ## under the License. #** * Sets the $page_title key, so if it ever changes, * it need only be changed here. *# #macro( title $string ) #set( $page_title = $string )#end #** * Creates a link to the javadoc for the specified tool. *# #macro( doclink $toolname $generic ) #set( $doclink = "http://velocity.apache.org/tools/devel/javadoc/org/apache/velocity/tools/## #if( $generic )generic/#else#**#view/#end## ${toolname}.html" )## $toolname#end #** * Creates a list item for the toolmenu. *# #macro( toolMenuItem $menulink $tool )
  • $text.tools.get($tool)
  • #end #** * Creates a smart default value for a demo field. *# #macro( demoDefault $valuetype ) #if( $valuetype.simpleName ) #set( $valuetype = $valuetype.simpleName ) #end #if( $valuetype eq 'String' ) 'test'## #elseif( $valuetype eq 'int' or $valuetype eq 'Integer' or $valuetype eq 'long' or $valuetype eq 'Long' ) 1## #elseif( $valuetype eq 'double' or $valuetype eq 'Double' or $valuetype eq 'float' or $valuetype eq 'Float' ) 1.1## #elseif( $valuetype eq 'boolean' or $valuetype eq 'Boolean' ) true## #elseif( $valuetype eq 'Class' ) ${esc.d}class.class## #end## #end #** * Creates the start tag and header row for a function demonstration table. *# #macro( demoTableStart ) #set( $demo = $text.demo ) #if( $params.layout ) #end #end #** * Creates a demonstration row of a tool method that takes no parameters. *# #macro( demo $toolname $method $description ) #end #** * Creates a faux demonstration row of a tool method that takes no parameters. *# #macro( demoAlt $toolname $method $result $description ) #end #** * Creates an interactive demonstration row for a tool method that takes one parameter. *# #macro( demo1 $toolname $method $size $description ) #if( !$quote ) #set( $quote = $esc.q ) #end ## HttpUnit doesn't like anchor-only links #end #** * Creates an interactive demonstration row for a tool method that takes two parameters. *# #macro( demo2 $toolname $method $size $description ) #if( !$quote ) #set( $quote = $esc.q ) #end #set( $method1 = "${method}1" ) #set( $method2 = "${method}2" ) ## HttpUnit doesn't like anchor-only links #end #** * Creates an interactive demonstration row for a tool method that takes three parameters. *# #macro( demo3 $toolname $method $size $description ) #if( !$quote ) #set( $quote = $esc.q ) #end #set( $method1 = "${method}A" ) #set( $method2 = "${method}B" ) #set( $method3 = "${method}C" ) ## HttpUnit doesn't like anchor-only links #end #** * Creates a free-form interactive demonstration row. *# #macro( demoCustom $toolname ) #end
    $demo.function
    $demo.result
    $demo.description
    ${esc.d}${toolname}.${method} $render.eval("${esc.d}${toolname}.${method}") $description
    ${esc.d}${toolname}.${method} $!result $description
    ${esc.d}${toolname}.$method(${quote}${quote}) #if( $params.get($method) ) ${esc.d}${toolname}.${method}(${quote}$params.get($method)${quote}) =
    $render.eval("${esc.d}${toolname}.${method}(${quote}$params.get($method)${quote})")
    #else #end #foreach( $param in $request.parameterMap.keySet() ) #foreach( $value in $params.getStrings($param) ) #if( $param != $method ) #end #end #end
    $description
    ${esc.d}${toolname}.$method(${quote}${quote}, ${quote}${quote}) #if( $params.get(${method1}) ) ${esc.d}${toolname}.${method}(${quote}$!params.get(${method1})${quote}, ${quote}$!params.get(${method2})${quote}) =
    $render.eval("${esc.d}${toolname}.${method}(${quote}$!params.get(${method1})${quote}, ${quote}$!params.get(${method2})${quote})")
    #else #end #foreach( $param in $request.parameterMap.keySet() ) #foreach( $value in $params.getStrings($param) ) #if( $param != $method1 && $param != $method2 ) #end #end #end
    $description
    ${esc.d}${toolname}.$method(${quote}${quote}, ${quote}${quote}, ${quote}${quote}) #if( $params.get(${method1}) ) ${esc.d}${toolname}.${method}(${quote}$!params.get(${method1})${quote}, ${quote}$!params.get(${method2})${quote}, ${quote}$!params.get(${method3})${quote}) =
    $render.eval("${esc.d}${toolname}.${method}(${quote}$!params.get(${method1})${quote}, ${quote}$!params.get(${method2})${quote}, ${quote}$!params.get(${method3})${quote})")
    #else #end #foreach( $param in $request.parameterMap.keySet() ) #foreach( $value in $params.getStrings($param) ) #if( $param != $method1 && $param != $method2 && $param != $method3 ) #end #end #end
    $description
    #if( $params.custom ) $params.custom = $render.eval($params.custom) #else #end #foreach( $param in $request.parameterMap.keySet() ) #foreach( $value in $params.getStrings($param) ) #if( $param != 'custom' ) #end #end #end $text.demo.tryAnything