Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
XLDF and Languedoc progress
git-svn-id: https://slps.svn.sourceforge.net/svnroot/slps@578 ab42f6e0-554d-0410-b580-99e487e6eeb2
  • Loading branch information
grammarware committed Apr 10, 2009
1 parent ac18f99 commit ebadc1a
Show file tree
Hide file tree
Showing 10 changed files with 795 additions and 100 deletions.
11 changes: 5 additions & 6 deletions shared/xsd/xbgf.xsd
Expand Up @@ -55,6 +55,8 @@
<xsd:group ref="xbgf:concrete-revising-transformation"/>
<xsd:group ref="xbgf:abstract-revising-transformation"/>
<xsd:group ref="xbgf:decorative-transformation"/>
<!-- semantics unclear -->
<xsd:element ref="xbgf:rename"/>
<!-- status unclear -->
<xsd:element ref="xbgf:reroot"/>
<!-- deprecated -->
Expand Down Expand Up @@ -113,8 +115,6 @@
<xsd:element ref="xbgf:import"/>
<xsd:element ref="xbgf:vertical"/>
<xsd:element ref="xbgf:horizontal"/>
<!-- semantics unclear -->
<xsd:element ref="xbgf:rename"/>
<!-- do we need them? -->
<xsd:element ref="xbgf:rassoc"/>
<xsd:element ref="xbgf:lassoc"/>
Expand Down Expand Up @@ -452,8 +452,7 @@
<xsd:element name="dump">
<xsd:annotation>
<xsd:documentation>
Not so much of a decorative transformation, but more of a
debugging tool. When the dump command is encountered,
A debugging tool for XBGF. When the <ldf:keyword>dump</ldf:keyword> command is encountered,
the transformation sequence stops and the grammar in its
current state is dumped to the file xbgf.log.
</xsd:documentation>
Expand Down Expand Up @@ -644,7 +643,7 @@
with regard to the defined nonterminal. The argument production
replace a production with the same defined nonterminal and label,
if any, assuming that the defining expression uses an equivlent,
repeating expression form. The "l" in "lassoc" refers to the
repeating expression form. The `l' in `lassoc' refers to the
intended effect at the level of derivation trees: the list of
subtrees is to be converted into a nested binary tree in a
left-associative manner.
Expand Down Expand Up @@ -758,7 +757,7 @@
with regard to the defined nonterminal. The argument production
replace a production with the same defined nonterminal and label,
if any, assuming that the defining expression uses an equivlent,
repeating expression form. The "r" in "rassoc" refers to the
repeating expression form. The `r' in `rassoc' refers to the
intended effect at the level of derivation trees: the list of
subtrees is to be converted into a nested binary tree in a
right-associative manner.
Expand Down
19 changes: 19 additions & 0 deletions shared/xsd/xldf.xsd
Expand Up @@ -48,6 +48,7 @@
<xsd:element ref="xldf:add-figure"/>
<xsd:element ref="xldf:add-section"/>
<xsd:element ref="xldf:add-subsection"/>
<xsd:element ref="xldf:extract-subsection"/>
<xsd:element ref="xldf:transform-grammar"/>
<xsd:element ref="xldf:transform-document"/>
</xsd:choice>
Expand Down Expand Up @@ -162,6 +163,24 @@
</xsd:complexType>
</xsd:element>

<xsd:element name="extract-subsection">
<xsd:annotation>
<xsd:documentation>
TBD
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element name="from" type="xsd:string"/>
<xsd:element name="content" type="ldf:SimpleText"/>
<xsd:element name="title" type="xsd:string"/>
<xsd:element name="id" type="xsd:string"/>
<!--<xsd:element name="section" type="ldf:StructuredSection"/>-->
<xsd:element name="to" type="xsd:string" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>

<xsd:element name="add-figure">
<xsd:annotation>
<xsd:documentation>
Expand Down
75 changes: 40 additions & 35 deletions shared/xsl/ldf2tex.xslt
Expand Up @@ -31,11 +31,13 @@
add,addV,addH,appear,widen,upgrade,unite,
remove,removeV,removeH,disappear,narrow,downgrade,
abstractize,concretize,permute,
define,undefine,rederfine,inject,project,replace,
define,undefine,redefine,inject,project,replace,
designate,unlabel,deanonymize,anonymize,dump,reroot,in},
columns=fullflexible,
basicstyle=\tt,
}
\newcommand{\subsubsubsection}[1]{\paragraph{#1}}
\newcommand{\subsubsubsubsection}[1]{\subparagraph{#1}}
\begin{document}
</xsl:text>
<!-- title -->
Expand Down Expand Up @@ -251,9 +253,13 @@
</xsl:choose>
<xsl:text>}</xsl:text>
</xsl:template>

<xsl:template name="subsectionize">
<xsl:param name="target"/>
<xsl:text>\subsection{</xsl:text>
<xsl:param name="level"/>
<xsl:text>\sub</xsl:text>
<xsl:value-of select="$level"/>
<xsl:text>section{</xsl:text>
<xsl:choose>
<xsl:when test="$target/title">
<xsl:value-of select="$target/title"/>
Expand All @@ -266,22 +272,7 @@
</xsl:choose>
<xsl:text>}</xsl:text>
</xsl:template>
<xsl:template name="subsubsectionize">
<xsl:param name="target"/>
<xsl:text>\subsubsection{</xsl:text>
<xsl:choose>
<xsl:when test="$target/title">
<xsl:value-of select="$target/title"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="capitaliseLocalName">
<xsl:with-param name="section" select="$target"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
<xsl:text>}</xsl:text>
</xsl:template>


<xsl:template name="process-SimpleSection">
<xsl:param name="section"/>
<xsl:for-each select="$section/*">
Expand Down Expand Up @@ -313,14 +304,22 @@

<xsl:template name="process-StructuredSection">
<xsl:param name="section"/>
<xsl:param name="level"/>
<xsl:for-each select="$section/*">
<xsl:choose>
<xsl:when test="local-name() = 'subtopic'">
<xsl:call-template name="subsectionize">
<xsl:with-param name="target" select="."/>
<xsl:with-param name="level">
<xsl:value-of select="$level"/>
</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="process-StructuredSection">
<xsl:with-param name="section" select="."/>
<xsl:with-param name="level">
<xsl:text>sub</xsl:text>
<xsl:value-of select="$level"/>
</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:when test="local-name() = 'author'"/>
Expand All @@ -333,13 +332,19 @@
<xsl:otherwise>
<xsl:choose>
<xsl:when test="local-name($section) = 'subtopic'">
<xsl:call-template name="subsubsectionize">
<xsl:call-template name="subsectionize">
<xsl:with-param name="target" select="."/>
<xsl:with-param name="level">
<xsl:value-of select="$level"/>
</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="subsectionize">
<xsl:with-param name="target" select="."/>
<xsl:with-param name="level">
<xsl:value-of select="$level"/>
</xsl:with-param>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
Expand Down Expand Up @@ -387,7 +392,7 @@
</xsl:text>
</xsl:template>

<!--
<!--
\begin{figure}[t!]
\begin{center}
\includegraphics[width=0.85\textwidth]{convtree_jls_s.pdf}
Expand All @@ -401,24 +406,24 @@
<xsl:text>
\begin{figure}\begin{center}
</xsl:text>
<xsl:choose>
<xsl:when test="type = 'PDF'">
<xsl:text>\includegraphics[width=0.5\textwidth]{</xsl:text>
<xsl:value-of select="file"/>
<xsl:text>}</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>...don't know how to insert a figure...</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="type = 'PDF'">
<xsl:text>\includegraphics[width=0.5\textwidth]{</xsl:text>
<xsl:value-of select="file"/>
<xsl:text>}</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>...don't know how to insert a figure...</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:text>\end{center}\caption{</xsl:text>
<xsl:value-of select="caption"/>
<xsl:text>}</xsl:text>
<xsl:if test="@id">
<xsl:text>\caption{</xsl:text>
<xsl:value-of select="@id"/>
<xsl:text>}</xsl:text>
</xsl:if>
<xsl:if test="@id">
<xsl:text>\caption{</xsl:text>
<xsl:value-of select="@id"/>
<xsl:text>}</xsl:text>
</xsl:if>
<xsl:text>\end{figure}

</xsl:text>
Expand Down
4 changes: 4 additions & 0 deletions topics/languedoc/languedoc.csproj
Expand Up @@ -69,6 +69,9 @@
<None Include="..\presentation\prettyprint\xbgf\refactorBnf.xbgf">
<Link>xbgf\bnf\xbgf\refactorBnf.xbgf</Link>
</None>
<None Include="..\presentation\prettyprint\xbgf\renameBgf.xbgf">
<Link>xbgf\bnf\xbgf\renameBgf.xbgf</Link>
</None>
<None Include="..\presentation\prettyprint\xbgf\stripTerminals.xbgf">
<Link>xbgf\bnf\xbgf\stripTerminals.xbgf</Link>
</None>
Expand All @@ -82,6 +85,7 @@
<None Include="xbgf\xldf\completeFoldSection.xldf" />
<None Include="xbgf\xldf\completeIncSection.xldf" />
<None Include="xbgf\xldf\completeIntro.xldf" />
<None Include="xbgf\xldf\completeMiscSection.xldf" />
<None Include="xbgf\xldf\completeRefSection.xldf" />
<None Include="xbgf\xldf\completeRevSections.xldf" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion topics/languedoc/xbgf/xldf/completeFoldSection.xldf
Expand Up @@ -157,7 +157,7 @@
<xldf:add-subsection>
<example id="fold-example">
<content>
<text>Very much like unfolding, folding can take place locally. For example,</text>
<text>Very much like unfolding, folding can take place locally. For instance,</text>
</content>
</example>
<to>element-fold</to>
Expand Down

0 comments on commit ebadc1a

Please sign in to comment.