Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
hdoc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Stephane Crozat
hdoc
Commits
6ecd9423
Commit
6ecd9423
authored
Dec 27, 2016
by
bperraud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add basic toc support
parent
9f80f7b0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
145 additions
and
1 deletion
+145
-1
hdoc_to_pdf/css/main.css
hdoc_to_pdf/css/main.css
+37
-0
hdoc_to_pdf/xsl/hdoc_flattenizer.xsl
hdoc_to_pdf/xsl/hdoc_flattenizer.xsl
+4
-0
hdoc_to_pdf/xsl/last_transformer.xsl
hdoc_to_pdf/xsl/last_transformer.xsl
+104
-1
No files found.
hdoc_to_pdf/css/main.css
View file @
6ecd9423
...
...
@@ -70,6 +70,12 @@ h4::before {counter-increment: h4; content: counter(h2) "." counter(h3) "." coun
h5
::before
{
counter-increment
:
h5
;
content
:
counter
(
h2
)
"."
counter
(
h3
)
"."
counter
(
h4
)
"."
counter
(
h5
)
".\0000a0\0000a0"
}
h6
::before
{
counter-increment
:
h6
;
content
:
counter
(
h2
)
"."
counter
(
h3
)
"."
counter
(
h4
)
"."
counter
(
h5
)
"."
counter
(
h6
)
".\0000a0\0000a0"
}
h2
.nocount
:before
,
h3
.nocount
:before
,
h4
.nocount
:before
,
h5
.nocount
:before
,
h6
.nocount
:before
{
content
:
""
;
counter-increment
:
none
}
/* Global lists styling */
...
...
@@ -92,6 +98,37 @@ ul > li::before {
}
/* ToC formatting */
h2
.toc-title
{
page-break-before
:
always
;
}
ul
.toc
{
counter-reset
:
toc
;
padding-left
:
0
;
}
ul
.toc
>
li
::before
{
left
:
0
;
position
:
absolute
;
content
:
counters
(
toc
,
"."
)
". "
;
counter-increment
:
toc
;
}
ul
.toc.level2
>
li
{
padding-left
:
8mm
;}
ul
.toc.level3
>
li
{
padding-left
:
11mm
;}
ul
.toc.level4
>
li
{
padding-left
:
13mm
;}
ul
.toc.level5
>
li
{
padding-left
:
15mm
;}
ul
.toc.level6
>
li
{
padding-left
:
17mm
;}
/* Title formatting */
h1
{
...
...
hdoc_to_pdf/xsl/hdoc_flattenizer.xsl
View file @
6ecd9423
...
...
@@ -39,6 +39,10 @@
<xsl:variable
name=
"level"
select=
"count(ancestor::section) + 2"
/>
<div>
<xsl:element
name=
"h{$level}"
>
<xsl:attribute
name=
"id"
>
<xsl:value-of
select=
"concat('h', $level, '-')"
/>
<xsl:number
level=
"any"
/>
</xsl:attribute>
<xsl:value-of
select=
"header/h1"
/>
</xsl:element>
<xsl:apply-templates/>
...
...
hdoc_to_pdf/xsl/last_transformer.xsl
View file @
6ecd9423
...
...
@@ -18,12 +18,115 @@
<body>
<h1><xsl:value-of
select=
"/html/head/title"
/></h1>
<p
class=
"authors"
><xsl:value-of
select=
"/html/head/meta[@name='author']/@content"
/></p>
<xsl:apply-templates
select=
"node()|@*"
/>
<xsl:call-template
name=
"toc"
/>
</body>
</xsl:template>
<!-- Cleaning des footers vides -->
<xsl:template
match=
"footer[not(node())]"
/>
<!-- Gestion de la table des matières -->
<xsl:template
name=
"toc"
>
<xsl:if
test=
"count(//h2) > 0"
>
<h2
class=
"nocount toc-title"
>
Table des matières
</h2>
<ul
class=
"toc level2"
>
<xsl:for-each
select=
"//h2"
>
<li>
<xsl:call-template
name=
"toc-a"
/>
<xsl:if
test=
"count(..//h3) > 0"
>
<ul
class=
"toc level3"
>
<xsl:for-each
select=
"..//h3"
>
<li>
<xsl:call-template
name=
"toc-a"
/>
<xsl:if
test=
"count(..//h4) > 0"
>
<ul
class=
"toc level4"
>
<xsl:for-each
select=
"..//h4"
>
<li>
<xsl:call-template
name=
"toc-a"
/>
<xsl:if
test=
"count(..//h5) > 0"
>
<ul
class=
"toc level5"
>
<xsl:for-each
select=
"..//h5"
>
<li>
<xsl:call-template
name=
"toc-a"
/>
<xsl:if
test=
"count(..//h6) > 0"
>
<ul
class=
"toc level6"
>
<xsl:for-each
select=
"..//h6"
>
<li>
<xsl:call-template
name=
"toc-a"
/>
</li>
</xsl:for-each>
</ul>
</xsl:if>
</li>
</xsl:for-each>
</ul>
</xsl:if>
</li>
</xsl:for-each>
</ul>
</xsl:if>
</li>
</xsl:for-each>
</ul>
</xsl:if>
</li>
</xsl:for-each>
</ul>
</xsl:if>
<!-- <li><a href="#">Introduction</a><span>1</span></li> -->
<!-- <li class="nested"> -->
<!-- <ul class="inner"> -->
<!-- <li><a href="#">Header 1</a><span>2</span> -->
<!-- </li> -->
<!-- <li><a href="#">Header 2</a><span>2</span> -->
<!-- </li> -->
<!-- </ul> -->
<!-- </li> -->
<!-- <li><a href="#">Header 2</a><span>3</span></li> -->
</xsl:template>
<xsl:template
name=
"toc-a"
>
<a>
<xsl:attribute
name=
"href"
>
<xsl:text>
#
</xsl:text>
<xsl:value-of
select=
"./@id"
/>
</xsl:attribute>
<xsl:value-of
select=
"."
/>
</a>
</xsl:template>
</xsl:stylesheet>
Write
Preview
Markdown
is supported
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