Navigation Menu

Skip to content

Commit

Permalink
frontMatter + backMatter in LDF; better HTML rendering
Browse files Browse the repository at this point in the history
git-svn-id: https://slps.svn.sourceforge.net/svnroot/slps@672 ab42f6e0-554d-0410-b580-99e487e6eeb2
  • Loading branch information
grammarware committed Aug 2, 2009
1 parent 6e6a0e1 commit 80255d5
Show file tree
Hide file tree
Showing 9 changed files with 271 additions and 267 deletions.
25 changes: 21 additions & 4 deletions shared/python/xldfCommands.py
Expand Up @@ -284,7 +284,7 @@ def xldf_remove_section(localpath,cmd,tree):
def xldf_add_subsection(localpath,cmd,tree):
success = False
s = cmd.findall('*')[0]
if s.tag in ('foreword','designGoals','scope','conformance','compliance','compatibility','notation','normativeReferences','documentStructure','whatsnew'):
if s.tag in ('foreword','designGoals','scope','conformance','compliance','compatibility','notation','normativeReferences','documentStructure','whatsnew','placeholder'):
tree.findall('//frontMatter')[0].append(s)
print '[XLDF] add-subsection (',s.tag,', front matter, ...)'
success = True
Expand All @@ -306,19 +306,36 @@ def xldf_change_role(localpath,cmd,tree):
if not where:
print '[----] xldf:change-role failed, can''t find id',cmd.findtext('scope')
return
if cmd.findtext('from') == 'frontMatter' and cmd.findtext('to') == 'backMatter':
if tree.findall('backMatter'):
back = tree.findall('backMatter')[0]
else:
allNodes = tree.findall('*')
cores = False
for i in range(0,len(allNodes)):
if not cores and allNodes[i].tag == 'core':
cores = True
if cores and allNodes[i].tag != 'core':
break
back = ET.Element('backMatter')
tree.findall('/')[0].insert(i,back)
back.append(where)
tree.findall('frontMatter')[0].remove(where)
print '[XLDF] change-role moved',cmd.findtext('scope'),'from',cmd.findtext('from'),'to',cmd.findtext('to')
return
if not where.findall(cmd.findtext('from')):
print '[----] xldf:change-role failed,',cmd.findtext('scope'),'lacks any',cmd.findtext('from')
print '[----] change-role failed,',cmd.findtext('scope'),'lacks any',cmd.findtext('from')
return
if where.findall(cmd.findtext('to')):
# inline
for el in where.findall(cmd.findtext('from')+'/*'):
where.findall(cmd.findtext('to'))[0].append(el)
where.remove(where.findall(cmd.findtext('from'))[0])
print '[XLDF] xldf:change-role inlined',cmd.findtext('from'),'to',cmd.findtext('to'),'in',cmd.findtext('scope')
print '[XLDF] change-role inlined',cmd.findtext('from'),'to',cmd.findtext('to'),'in',cmd.findtext('scope')
else:
# rename
where.findall(cmd.findtext('from'))[0].tag = cmd.findtext('to')
print '[XLDF] xldf:change-role renamed',cmd.findtext('from'),'to',cmd.findtext('to'),'in',cmd.findtext('scope')
print '[XLDF] change-role renamed',cmd.findtext('from'),'to',cmd.findtext('to'),'in',cmd.findtext('scope')
return

def xldf_extract_subsection(localpath,cmd,tree):
Expand Down
31 changes: 27 additions & 4 deletions shared/xsd/ldf.xsd
Expand Up @@ -36,11 +36,10 @@
<xsd:complexType>
<xsd:sequence>
<xsd:element name="titlePage" type="ldf:titlePage"/>
<xsd:element name="placeholder" type="ldf:generated" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="frontMatter">
<xsd:complexType>
<xsd:sequence>
<xsd:group ref="ldf:frontSection" maxOccurs="unbounded"/>
<xsd:group ref="ldf:topSection" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
Expand All @@ -58,7 +57,23 @@
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="core" type="ldf:structuredSection" maxOccurs="unbounded"/>
<xsd:choice>
<xsd:element name="core" type="ldf:structuredSection" maxOccurs="unbounded"/>
<xsd:element name="part" maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="core" type="ldf:structuredSection" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:choice>
<xsd:element name="backMatter" minOccurs="0">
<xsd:complexType>
<xsd:sequence>
<xsd:group ref="ldf:topSection" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="annex" type="ldf:structuredSection" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
Expand Down Expand Up @@ -206,7 +221,7 @@
</xsd:restriction>
</xsd:simpleType>

<xsd:group name="frontSection">
<xsd:group name="topSection">
<xsd:choice>
<xsd:element name="foreword" type="ldf:simpleSection">
<xsd:annotation>
Expand Down Expand Up @@ -307,6 +322,14 @@
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="placeholder" type="ldf:generated">
<xsd:annotation>
<xsd:documentation>
Placeholders are used to designate places where generated content
should be inserted.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<!-- none of the above
<xsd:element name="core" type="ldf:simpleSection"/>
-->
Expand Down
24 changes: 12 additions & 12 deletions shared/xsd/xbgf.xsd
Expand Up @@ -6,14 +6,14 @@
targetNamespace="http://planet-sl.org/xbgf">

<xsd:annotation>
<xsd:documentation>
BGF transformation operator suite
</xsd:documentation>
<xsd:documentation>
This chapter describes the transformational suite for BGF and all the details about it.
</xsd:documentation>
<xsd:documentation>
BGF transformation operator suite
</xsd:documentation>
<xsd:documentation>
This chapter describes the transformational suite for BGF and all the details about it.
</xsd:documentation>
</xsd:annotation>

<xsd:import namespace="http://planet-sl.org/bgf" schemaLocation="bgf.xsd"/>

<xsd:element name="sequence">
Expand Down Expand Up @@ -45,7 +45,7 @@
<xsd:annotation>
<xsd:documentation>
A list of all the XBGF transformations is grouped in seven categories:
<ldf:keyword>folding-transformation</ldf:keyword> collects those commands
<ldf:keyword>folding-unfolding-transformation</ldf:keyword> collects those commands
that perform the well-known folding/unfolding operations in slightly varied
circumstances; <ldf:keyword>refactoring-transformation</ldf:keyword> contains
transformations that perform factoring and reorganising procedures that
Expand All @@ -58,11 +58,11 @@
<ldf:keyword>abstract-revising-transformation</ldf:keyword> change the language
generated by the grammar in a way that they cannot be a priori classified as any of
the above; <ldf:keyword>decorative-transformation</ldf:keyword> are special refactorings
that are used to make or destroy different annotations in BGF.
that are used to make or destroy labels and selectors in BGF.
</xsd:documentation>
</xsd:annotation>
<xsd:choice>
<xsd:group ref="xbgf:folding-transformation"/>
<xsd:group ref="xbgf:folding-unfolding-transformation"/>
<xsd:group ref="xbgf:refactoring-transformation"/>
<xsd:group ref="xbgf:increasing-transformation"/>
<xsd:group ref="xbgf:decreasing-transformation"/>
Expand All @@ -80,7 +80,7 @@
</xsd:choice>
</xsd:group>

<xsd:group name="folding-transformation">
<xsd:group name="folding-unfolding-transformation">
<xsd:annotation>
<xsd:documentation>
Folding and unfolding activities are the most basic ones in grammar
Expand Down Expand Up @@ -612,7 +612,7 @@
that is to be unfolded and stripped away from the grammar.
</xsd:documentation>
<xsd:documentation>
The impact of <ldf:keyword>inline</ldf:keyword> is that of a pair of
The semantics of <ldf:keyword>inline</ldf:keyword> is that of a sequential composition of
<ldf:keyword>unfold</ldf:keyword> and <ldf:keyword>eliminate</ldf:keyword>.
</xsd:documentation>
</xsd:annotation>
Expand Down
5 changes: 4 additions & 1 deletion shared/xsd/xldf.xsd
Expand Up @@ -98,7 +98,7 @@
</xsd:annotation>
<xsd:complexType>
<xsd:choice>
<xsd:group ref="ldf:frontSection"/>
<xsd:group ref="ldf:topSection"/>
<xsd:sequence>
<xsd:choice>
<xsd:group ref="ldf:normative"/>
Expand Down Expand Up @@ -364,6 +364,9 @@

<xsd:simpleType name="sectionRole">
<xsd:restriction base="xsd:token">
<xsd:enumeration value="frontMatter"/>
<xsd:enumeration value="backMatter"/>

<xsd:enumeration value="synopsis"/>
<xsd:enumeration value="description"/>
<xsd:enumeration value="syntax"/>
Expand Down
2 changes: 1 addition & 1 deletion shared/xsl/bgf2xhtml.xslt
Expand Up @@ -85,7 +85,7 @@
<span xmlns="http://www.w3.org/1999/xhtml" class="meta">
<xsl:choose>
<xsl:when test=". = 'string'">
<xsl:text>str</xsl:text>
<xsl:text>string</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>int</xsl:text>
Expand Down

0 comments on commit 80255d5

Please sign in to comment.