-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathREADME.txt
106 lines (82 loc) · 4.55 KB
/
README.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/*********************************************************************************************************************************/
/** ${project.name} version ${project.version} (${currentDate}) **/
/** by Alex Ciobanu **/
/*********************************************************************************************************************************/
Copyright 2008 - 2009 Alex Ciobanu (http://code.google.com/p/flexxb)
CONTENTS
${project.name}-${release.version}-${today}-bin.zip - contains the ${project.name} library along with the test
application
/bin/ - SWC file and test application directory
/bin/test/ - the test application
/bin/flexunit - flexunit automated test reports
/doc/ - ASDOC
/samples/ - samples showing ${project.name}'s features
/README.txt - version release notes
${project.name}-${release.version}-${today}-src.zip - contains source files
/${project.name}/ - ${project.name} project sources
/${project.name}Test - ${project.name} test application sources
DESCRIPTION
FxMarker is a templating engine similar with the Freemarker java library. It generates text output based on templates and context objects provided as input. It is a Flex library providing content generation features to ActionScript? community.
FEATURES
* FXK-001 - Template parsing
* FXK-002 - Execution directives
* FXK-003 - Expression parsing
* FXK-004 - Data model
* FXK-005 - Data formatting
* FXK-006 - Template caching
USAGE
To compile a template from a string source:
com.fxmarker.FxMarker.instance.getTemplate(source))
To get the canonical form of the compiled template (reverse engineer the string source from the compiled template):
template.getRootElement().getCanonicalForm()
To populate the data model instance:
com.fxmarker.dataModel.DataModel.putValue(name_or_dot_separated_path, value)
Value can be a regular instance or one can use the wrapper objects, implementors of com.fxmarker.dataModel.IDataItemModel
To process the template against a data model and produce the generated content:
var writer : com.fxmarker.writer.Writer = new com.fxmarker.writer.Writer();
template.process(dataModel, writer);
The generated content is accesible via writer.writtenData field.
Template execution directives
* Interpolation: Evaluate an expression and print the result.
Usage: ${expression}
* Switch: Control flow execution via multiway branch.
Usage:
<#switch expression>
<#case expression or constant>
... content
<#break> //optional
<#default>
...content
</#switch>
* If: You can use if, elseif and else directives to conditionally skip a section of the template. The condition-s must evaluate to a boolean value, or else an error will abort template processing. The elseif-s and else-s must occur inside if (that is, between the if start-tag and end-tag). The if can contain any number of elseif-s (including 0) and at the end optionally one else.
Usage:
<#if>
...content
<elseif>
...content
<else>
...content
</#if>
* List: Process a section of template for each variable contained within a sequence. For each iteration the loop variable will contain the current subvariable. There one special loop variable available inside the list loop: item_index, a numerical value that contains the index of the current item being stepped over in the loop.
Usage:
<#list collectionName as indexName>
...content
<#break>//optional
</#list>
* ForEach: Process a section of template for each variable contained within a sequence. For each iteration the loop variable will contain the current subvariable. There one special loop variable available inside the list loop: item_index, a numerical value that contains the index of the current item being stepped over in the loop.
Usage:
<#foreach indexName in collectionName>
...content
<#break>//optional
</#foreach>
* CsList: Adds a comma "," after each item written to the generated content. Binds by the same execution rules as list and forEach.
Usage:
<#csList indexName in collectionName>
...content
<#break>//optional
</#csList>
KNOWN LIMITATIONS
None so far
RELEASE NOTES
1.0 alpha - 14-11-2010
- First alpha release