Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Stephane Crozat
hdoc
Commits
fd926056
Commit
fd926056
authored
Dec 22, 2016
by
Benoit Villain
Browse files
Passage de hdoc_to_canoprof à la V2 (vérif faites)
parent
314a360a
Changes
3
Hide whitespace changes
Inline
Side-by-side
hdoc_to_canoprof/README.md
View file @
fd926056
...
@@ -20,6 +20,10 @@ Dependencies
...
@@ -20,6 +20,10 @@ Dependencies
---
---
There's no particular dependencies needed to run the converter.
There's no particular dependencies needed to run the converter.
Conditions particulières
---
Pour le moment, il ne faut pas utilisé les "sous-Division" de Opale. Les divisions à la racine sont autorisées.
User Story
User Story
---
---
### Running the script
### Running the script
...
...
hdoc_to_canoprof/samples/Sample_V2.hdoc
0 → 100644
View file @
fd926056
File added
hdoc_to_canoprof/xsl/transformation2.xsl
View file @
fd926056
...
@@ -102,26 +102,6 @@
...
@@ -102,26 +102,6 @@
</sp:shortActivity>
</sp:shortActivity>
</xsl:template>
</xsl:template>
<!-- if Section has sub section(s), we create a real activity to print differents possible types of sub sections -->
<xsl:template
match=
"h:body/h:section/h:section"
>
<sp:textActivity>
<cp:textActivity>
<cp:activityM>
<sp:title>
<xsl:value-of
select=
"./h:header/h:h1"
/>
</sp:title>
</cp:activityM>
<xsl:if
test=
"./h:section"
>
<sp:body>
<cp:blocks>
<xsl:apply-templates
select=
"./*"
/>
</cp:blocks>
</sp:body>
</xsl:if>
</cp:textActivity>
</sp:textActivity>
</xsl:template>
<!-- Toutes les introductions de sections sont transformés en résumé. -->
<!-- Toutes les introductions de sections sont transformés en résumé. -->
<xsl:template
match=
"h:header/h:div[@data-hdoc-type = 'introduction']"
>
<xsl:template
match=
"h:header/h:div[@data-hdoc-type = 'introduction']"
>
<sp:abstract>
<sp:abstract>
...
@@ -133,27 +113,224 @@
...
@@ -133,27 +113,224 @@
</sp:abstract>
</sp:abstract>
</xsl:template>
</xsl:template>
<!-- Gestion des définitions. -->
<!-- CanoProf's Activite TetM = hdoc's body/Section/Section = Opale's Grain -->
<xsl:template
match=
"h:div[@data-hdoc-type = 'definition']|h:div[@data-hdoc-type = 'example']"
>
<xsl:template
match=
"h:body/h:section/h:section"
>
<!-- <xsl:variable name="vtype" select="./@data-hdoc-type/text()"/>
<xsl:if
test=
"./*"
>
<xsl:element name="{$vtype}">-->
<sp:textActivity>
<sp:definition>
<cp:textActivity>
<cp:block>
<cp:activityM>
<cp:blockM>
<sp:title>
<sp:title>
<xsl:if
test=
"not(./h:header/h:h1/text())"
>
Untitled
</xsl:if>
<xsl:value-of
select=
"./h:h6"
/>
<xsl:value-of
select=
"./h:header/h:h1"
/>
</sp:title>
</sp:title>
</cp:blockM>
<xsl:if
test=
"(./h:header/h:div[@data-hdoc-type = 'introduction']/text())"
>
<xsl:apply-templates
select=
"./h:header/h:div[@data-hdoc-type = 'introduction']"
/>
</xsl:if>
</cp:activityM>
<xsl:if
test=
"./h:div/*"
>
<sp:body>
<cp:blocks>
<xsl:apply-templates
select=
"./h:div"
/>
</cp:blocks>
</sp:body>
</xsl:if>
<xsl:if
test=
"./h:section/*"
>
<xsl:apply-templates
select=
"./h:section"
mode=
"CanoprofSection"
/>
</xsl:if>
</cp:textActivity>
</sp:textActivity>
</xsl:if>
</xsl:template>
<!-- CanoProf's Activite TetM (section) = hdoc's body/Section/Section/(Section...) = Opale's Grain (partie) -->
<!-- TODO -->
<xsl:template
match=
"h:section"
mode=
"CanoprofSection"
>
</xsl:template>
<!-- Div related templates -->
<!-- Formatting content based on @data-hdoc-type -->
<xsl:template
match=
"h:div"
>
<xsl:choose>
<!-- hdoc's explanation = canoprof's information (NOT EXPLICIT...) -->
<xsl:when
test=
"./@data-hdoc-type = 'explanation'"
>
<sp:info>
<cp:block>
<xsl:if
test=
"string-length(./h:h6/text()) > 0"
>
<cp:blockM>
<sp:title>
<xsl:value-of
select=
"./h:h6"
/>
</sp:title>
</cp:blockM>
</xsl:if>
<sp:body>
<cp:flow>
<xsl:apply-templates
select=
"./*"
/>
</cp:flow>
</sp:body>
</cp:block>
</sp:info>
</xsl:when>
<!-- hdoc's warning = canoprof's warning -->
<xsl:when
test=
"./@data-hdoc-type = 'warning'"
>
<sp:warning>
<cp:block>
<cp:blockM>
<xsl:if
test=
"string-length(./h:h6/text()) > 0"
>
<sp:title>
<xsl:value-of
select=
"./h:h6"
/>
</sp:title>
</xsl:if>
</cp:blockM>
<sp:body>
<cp:flow>
<xsl:apply-templates
select=
"./*"
/>
</cp:flow>
</sp:body>
</cp:block>
</sp:warning>
</xsl:when>
<!-- hdoc's complement = canoprof's complement (extra) -->
<xsl:when
test=
"./@data-hdoc-type = 'complement'"
>
<sp:extra>
<cp:block>
<cp:blockM>
<xsl:if
test=
"string-length(./h:h6/text()) > 0"
>
<sp:title>
<xsl:value-of
select=
"./h:h6"
/>
</sp:title>
</xsl:if>
</cp:blockM>
<sp:body>
<cp:flow>
<xsl:apply-templates
select=
"./*"
/>
</cp:flow>
</sp:body>
</cp:block>
</sp:extra>
</xsl:when>
<!-- hdoc's advice = canoprof's advice -->
<xsl:when
test=
"./@data-hdoc-type = 'advice'"
>
<sp:advice>
<cp:block>
<cp:blockM>
<xsl:if
test=
"string-length(./h:h6/text()) > 0"
>
<sp:title>
<xsl:value-of
select=
"./h:h6"
/>
</sp:title>
</xsl:if>
</cp:blockM>
<sp:body>
<cp:flow>
<xsl:apply-templates
select=
"./*"
/>
</cp:flow>
</sp:body>
</cp:block>
</sp:advice>
</xsl:when>
<!-- hdoc's definition = canoprof's definition -->
<xsl:when
test=
"./@data-hdoc-type = 'definition'"
>
<sp:definition>
<cp:block>
<cp:blockM>
<xsl:if
test=
"string-length(./h:h6/text()) > 0"
>
<sp:title>
<xsl:value-of
select=
"./h:h6"
/>
</sp:title>
</xsl:if>
</cp:blockM>
<sp:body>
<cp:flow>
<xsl:apply-templates
select=
"./*"
/>
</cp:flow>
</sp:body>
</cp:block>
</sp:definition>
</xsl:when>
<!-- hdoc's example = canoprof's example -->
<xsl:when
test=
"./@data-hdoc-type = 'example'"
>
<sp:example>
<cp:block>
<cp:blockM>
<xsl:if
test=
"string-length(./h:h6/text()) > 0"
>
<sp:title>
<xsl:value-of
select=
"./h:h6"
/>
</sp:title>
</xsl:if>
</cp:blockM>
<sp:body>
<cp:flow>
<xsl:apply-templates
select=
"./*"
/>
</cp:flow>
</sp:body>
</cp:block>
</sp:example>
</xsl:when>
<!-- hdoc's remark = canoprof's hypothesis (NOT EXPLICIT...) -->
<xsl:when
test=
"./@data-hdoc-type = 'remark'"
>
<sp:hypothesis>
<cp:block>
<cp:blockM>
<xsl:if
test=
"string-length(./h:h6/text()) > 0"
>
<sp:title>
<xsl:value-of
select=
"./h:h6"
/>
</sp:title>
</xsl:if>
</cp:blockM>
<sp:body>
<cp:flow>
<xsl:apply-templates
select=
"./*"
/>
</cp:flow>
</sp:body>
</cp:block>
</sp:hypothesis>
</xsl:when>
<!-- hdoc's emphasis = canoprof's method (NOT EXPLICIT...) -->
<xsl:when
test=
"./@data-hdoc-type = 'emphasis'"
>
<sp:method>
<cp:block>
<cp:blockM>
<xsl:if
test=
"string-length(./h:h6/text()) > 0"
>
<sp:title>
<xsl:value-of
select=
"./h:h6"
/>
</sp:title>
</xsl:if>
</cp:blockM>
<sp:body>
<cp:flow>
<xsl:apply-templates
select=
"./*"
/>
</cp:flow>
</sp:body>
</cp:block>
</sp:method>
</xsl:when>
<!-- hdoc's autres or no attribute = canoprof's information-->
<xsl:otherwise>
<sp:info>
<cp:block>
<xsl:if
test=
"string-length(./h:h6/text()) > 0"
>
<cp:blockM>
<sp:title>
<xsl:value-of
select=
"./h:h6"
/>
</sp:title>
</cp:blockM>
</xsl:if>
<sp:body>
<cp:flow>
<xsl:apply-templates
select=
"./*"
/>
</cp:flow>
</sp:body>
</cp:block>
</sp:info>
<!--
<sp:body>
<sp:body>
<cp:flow>
<cp:flow>
<xsl:if
test=
"./h:p/text()"
>
<xsl:apply-templates select="./*"/>
<xsl:apply-templates
select=
"./*"
/>
</xsl:if>
</cp:flow>
</cp:flow>
</sp:body>
</sp:body>
</cp:block
>
--
>
</sp:definition
>
</xsl:otherwise
>
<!--
</xsl:
element>--
>
</xsl:
choose
>
</xsl:template>
</xsl:template>
<!-- Text related templates -->
<!-- Text related templates -->
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment