| ################################################################## |
| ## |
| ## 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. |
| ## |
| ################################################################## |
| |
| ## Context: |
| ## |
| ## - All SortedSets are copies, so in-place ops like remove, add, etc. are allowed |
| ## - Do not use $set2 = $set1 if you want to change only one of these. |
| ## Use $set2 = util.copySet($set1) instead. |
| ## |
| ## String odfName: Name of current ODF element (at the time of template initialization) |
| ## SortedSet<String> odfElementNames: Names of all ODF elements |
| ## SortedSet<String> odfElementBaseNames: Names of all ODF base elements |
| ## SortedSet<String> odfAttributeNames: Names of all ODF attributes |
| ## NamespaceDictionars nsdict: Utility to translate between NamespaceURI and local Namespace: |
| ## String nsdict.getLocalNamespace(String NamespaceURI) |
| ## String nsdict.getNamespaceURI(String LocalNamespace) |
| ## Expressions util: Utility to get and transform Expression names: |
| ## String util.extractLocalname(String name) |
| ## String util.extractNamespace(String name) |
| ## String util.getQName(Expression exp) |
| ## String util.camelCase(String raw): some-text-fragment -> SomeTextFragment |
| ## String util.javaCase(String raw): some-text-fragment -> someTextFragment |
| ## SortedSet<String> util.emptySet() |
| ## SortedSet<String> util.copySet(Set<String> original) |
| ## ExpressionViewByName nameView: Access to ODF element and attribute name hierarchy: |
| ## SortedSet<String> nameView.getElementChildNames(String parentelementname) |
| ## SortedSet<String> nameView.getElementParentNames(String elementchildname) |
| ## SortedSet<String> nameView.getAttributeChildNames(String parentelementname) |
| ## SortedSet<String> nameView.getAttributeParentNames(String attributechildname) |
| ## String nameView.getElementRename(String elementname) |
| ## String nameView.getElementBaseName(String elementname) |
| ## String nameView.getElementsByBaseName(String basename) |
| ## SortedSet<String> nameView.getElementStyleFamilies(String elementname) |
| ## |
| # /usr/bin/python |
| |
| CHILD_ELEMENTS = { |
| #foreach( $name in $odfElementNames ) |
| '$name' : ( \ |
| #set($sortedChildren = ${nameView.getElementChildNames($name)}) |
| #foreach($childname in $sortedChildren) |
| '$childname', \ |
| #end |
| ), |
| #end |
| } |
| |
| CHILD_ATTRIBUTES = { |
| #foreach( $name in $odfElementNames ) |
| '$name' : ( \ |
| #set($sortedAttributes = ${nameView.getAttributeChildNames($name)}) |
| #foreach( $attrname in $sortedAttributes) |
| '$attrname', \ |
| #end |
| ), |
| #end |
| } |
| |