Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
manuscrit
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alice Brenon
manuscrit
Commits
ecdeca89
Commit
ecdeca89
authored
9 months ago
by
Alice Brenon
Browse files
Options
Downloads
Patches
Plain Diff
Add support for LaTeX's \chaptermark in glossary and biblio filters
parent
35f3523d
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
filter/with-bibliography.lua
+15
-13
15 additions, 13 deletions
filter/with-bibliography.lua
filter/with-glossary.hs
+6
-1
6 additions, 1 deletion
filter/with-glossary.hs
with
21 additions
and
14 deletions
filter/with-bibliography.lua
+
15
−
13
View file @
ecdeca89
function
get
Number
(
field
,
default
)
function
get
Field
(
field
,
default
)
if
field
==
nil
then
if
field
==
nil
then
return
default
return
default
else
else
return
field
[
1
].
text
return
field
[
1
].
text
end
end
end
end
function
Pandoc
(
doc
)
function
Pandoc
(
doc
)
level
=
get
Number
(
doc
.
meta
[
'bibliography-level'
],
1
)
level
=
get
Field
(
doc
.
meta
[
'bibliography-level'
],
1
)
entry_spacing
=
get
Number
(
doc
.
meta
[
'bibliography-spacing'
],
0
)
entry_spacing
=
get
Field
(
doc
.
meta
[
'bibliography-spacing'
],
0
)
section_title
=
getField
(
doc
.
meta
[
'bibliography-title'
],
"Bibliography"
)
doc
.
blocks
:
extend
({
pandoc
.
Header
(
doc
.
blocks
:
extend
({
pandoc
.
Header
(
level
,
level
,
doc
.
meta
[
'bibliography-title'
]
or
"Bibliography"
,
section_title
,
{
id
=
'bibliography'
,
class
=
'unnumbered'
}
{
id
=
'bibliography'
,
class
=
'unnumbered'
}
),
pandoc
.
RawInline
(
"latex"
,
(
"
\\
chaptermark{"
..
section_title
..
"}"
)
),
pandoc
.
Div
(
),
pandoc
.
Div
(
{},
{},
{
id
=
'refs'
,
[
'entry-spacing'
]
=
entry_spacing
}
{
id
=
'refs'
,
[
'entry-spacing'
]
=
entry_spacing
}
)})
)})
return
pandoc
.
utils
.
citeproc
(
doc
)
return
pandoc
.
utils
.
citeproc
(
doc
)
end
end
This diff is collapsed.
Click to expand it.
filter/with-glossary.hs
+
6
−
1
View file @
ecdeca89
...
@@ -83,10 +83,11 @@ loadDef t _ = do
...
@@ -83,10 +83,11 @@ loadDef t _ = do
addGlossarySection
::
MonadReader
Config
m
=>
([
Block
],
Glossary
)
->
m
[
Block
]
addGlossarySection
::
MonadReader
Config
m
=>
([
Block
],
Glossary
)
->
m
[
Block
]
addGlossarySection
(
blocks
,
definitions
)
addGlossarySection
(
blocks
,
definitions
)
|
null
definitions
=
pure
$
blocks
|
null
definitions
=
pure
$
blocks
|
otherwise
=
(
blocks
<>
)
<$>
sequence
[
asks
header
,
body
]
|
otherwise
=
(
blocks
<>
)
<$>
sequence
[
asks
header
,
chaptermark
,
body
]
where
where
header
(
Config
{
level
,
title
})
=
header
(
Config
{
level
,
title
})
=
Header
level
(
"glossary"
,
[
"unnumbered"
],
[]
)
[
Str
title
]
Header
level
(
"glossary"
,
[
"unnumbered"
],
[]
)
[
Str
title
]
chaptermark
=
Plain
.
pure
<$>
(
raw
sectionTitle
=<<
asks
title
)
body
=
DefinitionList
<$>
(
mapM
entryOf
$
Map
.
toList
definitions
)
body
=
DefinitionList
<$>
(
mapM
entryOf
$
Map
.
toList
definitions
)
entryOf
(
key
,
definition
)
=
(,[
definition
])
<$>
sequence
[
raw
target
key
]
entryOf
(
key
,
definition
)
=
(,[
definition
])
<$>
sequence
[
raw
target
key
]
...
@@ -108,3 +109,7 @@ target t Html = ["<span id=\"", labelFor t, "\">", t, "</span>"]
...
@@ -108,3 +109,7 @@ target t Html = ["<span id=\"", labelFor t, "\">", t, "</span>"]
link
::
Text
->
KnownFormat
->
[
Text
]
link
::
Text
->
KnownFormat
->
[
Text
]
link
t
Latex
=
[
"
\\
hyperlink{"
,
labelFor
t
,
"}{"
,
t
,
"}"
]
link
t
Latex
=
[
"
\\
hyperlink{"
,
labelFor
t
,
"}{"
,
t
,
"}"
]
link
t
Html
=
[
"<a href=
\"
#"
,
labelFor
t
,
"
\"
>"
,
t
,
"</a>"
]
link
t
Html
=
[
"<a href=
\"
#"
,
labelFor
t
,
"
\"
>"
,
t
,
"</a>"
]
sectionTitle
::
Text
->
KnownFormat
->
[
Text
]
sectionTitle
t
Latex
=
[
"
\\
chaptermark{"
,
t
,
"}"
]
sectionTitle
_
Html
=
[]
-- does not apply so not implemented
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment