C# (CSharp) NVelocity.Runtime.Directive 네임스페이스

클래스들

이름 설명
AbstractForeachSection
BlockComponent
Component
Directive Base class for all directives used in Velocity.
DirectiveManager
Foreach Foreach directive used for moving through arrays, or objects that provide an Iterator.
ForeachAfterAllSection
ForeachAfterSection
ForeachBeforeAllSection
ForeachBeforeSection
ForeachBetweenSection
ForeachEachSection
ForeachEvenSection
ForeachNoDataSection
ForeachOddSection
Include Pluggable directive that handles the #include() statement in VTL. This #include() can take multiple arguments of either StringLiteral or Reference. * Notes: ----- 1) The included source material can only come from somewhere in the TemplateRoot tree for security reasons. There is no way around this. If you want to include content from elsewhere on your disk, use a link from somwhere under Template Root to that content. * 2) By default, there is no output to the render stream in the event of a problem. You can override this behavior with two property values : include.output.errormsg.start include.output.errormsg.end If both are defined in velocity.properties, they will be used to in the render output to bracket the arg string that caused the problem. Ex. : if you are working in html then include.output.errormsg.start= might be an excellent way to start... * 3) As noted above, #include() can take multiple arguments. Ex : #include( "foo.vm" "bar.vm" $foo ) will simply include all three if valid to output w/o any special separator. *
Literal A very simple directive that leverages the Node.literal() to grab the literal rendition of a node. We basically grab the literal value on init(), then repeatedly use that during render().
Parse Pluggable directive that handles the #parse() statement in VTL. Notes: ----- 1) The parsed source material can only come from somewhere in the TemplateRoot tree for security reasons. There is no way around this. If you want to include content from elsewhere on your disk, use a link from somwhere under Template Root to that content. 2) There is a limited parse depth. It is set as a property "parse_directive.maxdepth = 10" for example. There is a 20 iteration safety in the event that the parameter isn't set.
VMProxyArg The function of this class is to proxy for the calling parameter to the VM. * This class is designed to be used in conjunction with the VMContext class which knows how to get and set values via it, rather than a simple get() or put() from a hashtable-like object. * There is probably a lot of undocumented subtlty here, so step lightly. * We rely on the observation that an instance of this object has a constant state throughout its lifetime as it's bound to the use-instance of a VM. In other words, it's created by the VelocimacroProxy class, to represent one of the arguments to a VM in a specific template. Since the template is fixed (it's a file...), we don't have to worry that the args to the VM will change. Yes, the VM will be called in other templates, or in other places on the same template, bit those are different use-instances. * These arguments can be, in the lingo of the parser, one of :
  • Reference() : anything that starts with '$'
  • StringLiteral() : something like "$foo" or "hello geir"
  • NumberLiteral() : 1, 2 etc
  • IntegerRange() : [ 1..2] or [$foo .. $bar]
  • ObjectArray() : [ "a", "b", "c"]
  • True() : true
  • False() : false
  • Word() : not likely - this is simply allowed by the parser so we can have syntactical sugar like #foreach($a in $b) where 'in' is the Word
Now, Reference(), StringLit, NumberLit, IntRange, ObjArr are all dynamic things, so their value is gotten with the use of a context. The others are constants. The trick we rely on is that the context rather than this class really represents the state of the argument. We are simply proxying for the thing, returning the proper value when asked, and storing the proper value in the appropriate context when asked. * So, the hope here, so an instance of this can be shared across threads, is to keep any dynamic stuff out of it, relying on trick of having the appropriate context handed to us, and when a constant argument, letting VMContext punch that into a local context.
VelocimacroProxy VelocimacroProxy a proxy Directive-derived object to fit with the current directive system