Skip to content

Commit

Permalink
use colophon for internal reports
Browse files Browse the repository at this point in the history
  • Loading branch information
ThierryO committed Nov 24, 2023
1 parent e7ee320 commit 7cdfac4
Show file tree
Hide file tree
Showing 16 changed files with 161 additions and 84 deletions.
16 changes: 9 additions & 7 deletions R/ebook.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,15 @@ epub_book <- function() {
system.file(file.path("pandoc", "translations.lua"), package = "INBOmd")
)
validate_doi(ifelse(has_name(fm, "doi"), fm$doi, "1.1/1"))
if (has_name(fm, "public_report") && !fm$public_report) {
c(
nl = "onuitgeven rapport", en = "unpublished report",
fr = "rapport non publi\u00e9"
)[lang] |>
pandoc_variable_arg(name = "doi") |>
c(pandoc_variable_arg("nocolophon", "true")) |>
if (
!has_name(fm, "doi") && has_name(fm, "public_report") && !fm$public_report
) {
Sys.time() |>
format("%Y-%m-%d %H:%M:%S") |>
c(fm$reportnr) |>
tail(1) |>
pandoc_variable_arg(name = "pagefootmessage") |>
c(pandoc_variable_arg("internal", "true")) |>
c(pandoc_args) -> pandoc_args
} else {
c(fm$doi, "!!! missing DOI !!!") |>
Expand Down
23 changes: 13 additions & 10 deletions R/gitbook.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ gitbook <- function(code_folding = c("none", "show", "hide")) {
yaml_front_matter() |>
validate_persons(reviewer = TRUE) |>
validate_rightsholder() -> fm
assert_that(
!has_name(fm, "nocolophon"), msg = "Legacy option `nocolophon` detected.
Please use the `public_report` option."
)
style <- ifelse(has_name(fm, "style"), fm$style, "INBO")
assert_that(length(style) == 1)
assert_that(
Expand Down Expand Up @@ -67,13 +63,20 @@ gitbook <- function(code_folding = c("none", "show", "hide")) {
system.file(file.path("pandoc", "translations.lua"), package = "INBOmd")
)
validate_doi(ifelse(has_name(fm, "doi"), fm$doi, "1.1/1"))
if (has_name(fm, "public_report") && !fm$public_report) {
c(
nl = "onuitgeven rapport", en = "unpublished report",
fr = "rapport non publi\u00e9"
)[lang] |>
if (
!has_name(fm, "doi") && has_name(fm, "public_report") && !fm$public_report
) {
Sys.time() |>
format("%Y-%m-%d %H:%M:%S") |>
c(fm$reportnr) |>
tail(1) |>
pandoc_variable_arg(name = "pagefootmessage") |>
c(pandoc_variable_arg("internal", "true")) |>
c(pandoc_args) -> pandoc_args
} else {
c(fm$doi, "!!! missing DOI !!!") |>
head(1) |>
pandoc_variable_arg(name = "doi") |>
c(pandoc_variable_arg("nocolophon", "true")) |>
c(pandoc_args) -> pandoc_args
}

Expand Down
24 changes: 13 additions & 11 deletions R/pdf_report.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ pdf_report <- function(
yaml_front_matter() |>
validate_persons(reviewer = TRUE) |>
validate_rightsholder() -> fm
assert_that(
!has_name(fm, "nocolophon"), msg = "Legacy option `nocolophon` detected.
Please use the `public_report` option."
stopifnot(
"`internal` option in yaml is not allowed" = !has_name(fm, "internal"),
"`pagefootmessage` option in yaml is not allowed" =
!has_name(fm, "pagefootmessage")
)
floatbarrier <- ifelse(has_name(fm, "floatbarrier"), fm$floatbarrier, NA)
assert_that(length(floatbarrier) == 1)
Expand Down Expand Up @@ -104,13 +105,15 @@ pdf_report <- function(
)
args <- args[args != ""]
validate_doi(ifelse(has_name(fm, "doi"), fm$doi, "1.1/1"))
if (has_name(fm, "public_report") && !fm$public_report) {
c(
nl = "onuitgeven rapport", en = "unpublished report",
fr = "rapport non publi\u00e9"
)[lang] |>
pandoc_variable_arg(name = "doi") |>
c(pandoc_variable_arg("nocolophon", "true")) |>
if (
!has_name(fm, "doi") && has_name(fm, "public_report") && !fm$public_report
) {
Sys.time() |>
format("%Y-%m-%d %H:%M:%S") |>
c(fm$reportnr) |>
tail(1) |>
pandoc_variable_arg(name = "pagefootmessage") |>
c(pandoc_variable_arg("internal", "true")) |>
c(args) -> args
} else {
c(fm$doi, "!!! missing DOI !!!") |>
Expand All @@ -119,7 +122,6 @@ pdf_report <- function(
c(args) -> args
}


if (has_name(fm, "lof") && isTRUE(fm$lof)) {
args <- c(args, pandoc_variable_arg("lof", TRUE))
}
Expand Down
16 changes: 12 additions & 4 deletions inst/local_tex/tex/latex/inborapport_2015/flanders_report.sty
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@
\fancyhead{}
\fancyfoot{}
\fancyfoot[LO, RE]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \mainColourURL{\href{https://www.vlaanderen.be/en}{www.vlaanderen.be}}}}
\fancyfoot[LE, RO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \pagename \textbf{ \thepage} / \textbf{\pageref*{LastPage}}}}
\fancyfoot[CE, CO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \mainColourURL{\@doi}}}
\fancyfoot[LE, RO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \pagename~\textbf{\thepage}~/~\textbf{\pageref*{LastPage}}}}
\ifnum \@public = 0
\fancyfoot[CE, CO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \@pagefootmessage}}
\else
\fancyfoot[CE, CO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \@doi}}
\fi
\renewcommand{\footrule}{\vbox to 8pt{\hbox
to\headwidth{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont\leaders\hbox{/}\hfill}\vss}}
\renewcommand{\headrulewidth}{0pt}
Expand All @@ -25,8 +29,12 @@ to\headwidth{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}
\fancyhead{}
\fancyfoot{}
\fancyfoot[LO, RE]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \mainColourURL{\href{https://www.vlaanderen.be/en}{www.vlaanderen.be}}}}
\fancyfoot[CE, CO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \mainColourURL{\@doi}}}
\fancyfoot[LE, RO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \pagename \textbf{ \thepage} / \textbf{\pageref*{LastPage}}}}
\ifnum \@public = 0
\fancyfoot[CE, CO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \@pagefootmessage}}
\else
\fancyfoot[CE, CO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \@doi}}
\fi
\fancyfoot[LE, RO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \pagename~\textbf{ \thepage}~/~\textbf{\pageref*{LastPage}}}}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,15 @@
\def\subtitle#1{\def\@subtitle{#1}}
\subtitle{}

\def\pagefootmessage#1{\def\@pagefootmessage{#1}}
\pagefootmessage{}

\def\colophon#1{\def\@colophon{#1}}
\colophon{1}

\def\public#1{\def\@public{#1}}
\public{1}

\def\colofonauthor#1{\def\@colofonauthor{#1}}
\colofonauthor{}

Expand Down Expand Up @@ -501,6 +507,15 @@
\addto\extrasfrench{%
\def\cfseries{Rapports de \cfinbo}%
}
\addto\extrasdutch{%
\def\cfiseries{Interne rapporten van het \cfinbo}%
}
\addto\extrasenglish{%
\def\cfiseries{Internal reports of the \cfinbo}%
}
\addto\extrasfrench{%
\def\cfiseries{Rapports internes de \cfinbo}%
}
\addto\extrasdutch{%
\def\cfcity{Brussel}%
}
Expand Down Expand Up @@ -591,11 +606,18 @@

\textbf{e-mail:} \\ \@corresponding

\ifnum \@public = 0
\textbf{\cfcitation} \\ \@shortauthor~(\@year). \@citetitle. \cfiseries~\@year~(\@reportnr). \cfinbo, \cfcity.

\textbf{\cfiseries~\@year~(\@reportnr)}
\else
\textbf{\cfcitation} \\ \@shortauthor~(\@year). \@citetitle. \cfseries~\@year~(\@reportnr). \cfinbo, \cfcity. DOI: \@doi

\textbf{\@depotnr} \\
\textbf{\cfseries~\@year~(\@reportnr)} \\
\textbf{ISSN: 1782-9054}
\fi


\textbf{\cfvu} \\ Maurice Hoffmann

Expand Down Expand Up @@ -635,7 +657,9 @@
\vspace{144pt}

\hspace{10mm}\parbox[t]{140mm}{
\fontsize{\fontsizeordernr}{\fontsizeordernrinter}\selectfont \raggedright \mainColourURL{\@doi} \\ \@ordernumber
\fontsize{\fontsizeordernr}{\fontsizeordernrinter}\selectfont \raggedright
\ifnum \@public > 1 \@doi \\ \fi
\@ordernumber
}

\vfill
Expand Down
16 changes: 12 additions & 4 deletions inst/local_tex/tex/latex/inborapport_2015/flandre_report.sty
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@
\fancyhead{}
\fancyfoot{}
\fancyfoot[LO, RE]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \mainColourURL{\href{https://www.vlaanderen.be/fr}{www.vlaanderen.be}}}}
\fancyfoot[LE, RO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \pagename \textbf{ \thepage} / \textbf{\pageref*{LastPage}}}}
\fancyfoot[CE, CO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \mainColourURL{\@doi}}}
\fancyfoot[LE, RO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \pagename~\textbf{\thepage}~/~\textbf{\pageref*{LastPage}}}}
\ifnum \@public = 0
\fancyfoot[CE, CO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \@pagefootmessage}}
\else
\fancyfoot[CE, CO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \@doi}}
\fi
\renewcommand{\footrule}{\vbox to 8pt{\hbox
to\headwidth{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont\leaders\hbox{/}\hfill}\vss}}
\renewcommand{\headrulewidth}{0pt}
Expand All @@ -25,8 +29,12 @@ to\headwidth{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}
\fancyhead{}
\fancyfoot{}
\fancyfoot[LO, RE]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \mainColourURL{\href{https://www.vlaanderen.be/fr}{www.vlaanderen.be}}}}
\fancyfoot[CE, CO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \mainColourURL{\@doi}}}
\fancyfoot[LE, RO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \pagename \textbf{ \thepage} / \textbf{\pageref*{LastPage}}}}
\ifnum \@public = 0
\fancyfoot[CE, CO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \@pagefootmessage}}
\else
\fancyfoot[CE, CO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \@doi}}
\fi
\fancyfoot[LE, RO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \pagename~\textbf{\thepage}~/~\textbf{\pageref*{LastPage}}}}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
}
Expand Down
16 changes: 12 additions & 4 deletions inst/local_tex/tex/latex/inborapport_2015/inbo_report.sty
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@
\fancyhead{}
\fancyfoot{}
\fancyfoot[LO, RE]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \mainColourURL{\href{https://www.vlaanderen.be/inbo}{vlaanderen.be/inbo}}}}
\fancyfoot[LE, RO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont Pagina \textbf{\thepage} van \textbf{\pageref*{LastPage}}}}
\fancyfoot[CE, CO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \mainColourURL{\@doi}}}
\fancyfoot[LE, RO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont Pagina~\textbf{\thepage}~van~\textbf{\pageref*{LastPage}}}}
\ifnum \@public = 0
\fancyfoot[CE, CO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \@pagefootmessage}}
\else
\fancyfoot[CE, CO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \@doi}}
\fi
\renewcommand{\footrule}{\vbox to 8pt{\hbox
to\headwidth{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont\leaders\hbox{/}\hfill}\vss}}
\renewcommand{\headrulewidth}{0pt}
Expand All @@ -25,8 +29,12 @@ to\headwidth{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}
\fancyhead{}
\fancyfoot{}
\fancyfoot[LO, RE]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \mainColourURL{\href{https://www.vlaanderen.be/inbo}{vlaanderen.be/inbo}}}}
\fancyfoot[CE, CO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \mainColourURL{\@doi}}}
\fancyfoot[LE, RO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont Pagina \textbf{\thepage} van \textbf{\pageref*{LastPage}}}}
\ifnum \@public = 0
\fancyfoot[CE, CO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \@pagefootmessage}}
\else
\fancyfoot[CE, CO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \@doi}}
\fi
\fancyfoot[LE, RO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont Pagina~\textbf{\thepage}~van~\textbf{\pageref*{LastPage}}}}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
}
Expand Down
16 changes: 12 additions & 4 deletions inst/local_tex/tex/latex/inborapport_2015/vlaanderen_report.sty
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,12 @@
\fancyhead{}
\fancyfoot{}
\fancyfoot[LO, RE]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \mainColourURL{\href{https://www.vlaanderen.be}{www.vlaanderen.be}}}}
\fancyfoot[LE, RO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont Pagina \textbf{\thepage} van \textbf{\pageref*{LastPage}}}}
\fancyfoot[CE, CO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \mainColourURL{\@doi}}}
\fancyfoot[LE, RO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont Pagina~\textbf{\thepage}~van~\textbf{\pageref*{LastPage}}}}
\ifnum \@public = 0
\fancyfoot[CE, CO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \@pagefootmessage}}
\else
\fancyfoot[CE, CO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \@doi}}
\fi
\renewcommand{\footrule}{\vbox to 8pt{\hbox
to\headwidth{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont\leaders\hbox{/}\hfill}\vss}}
\renewcommand{\headrulewidth}{0pt}
Expand All @@ -24,8 +28,12 @@ to\headwidth{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}
\fancyhead{}
\fancyfoot{}
\fancyfoot[LO, RE]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \mainColourURL{\href{https://www.vlaanderen.be}{www.vlaanderen.be}}}}
\fancyfoot[CE, CO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \mainColourURL{\@doi}}}
\fancyfoot[LE, RO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont Pagina \textbf{\thepage} van \textbf{\pageref*{LastPage}}}}
\ifnum \@public = 0
\fancyfoot[CE, CO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \@pagefootmessage}}
\else
\fancyfoot[CE, CO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont \@doi}}
\fi
\fancyfoot[LE, RO]{{\color{main.colour}\fontsize{\fontsizefooter}{\fontsizefooterinter}\selectfont Pagina~\textbf{\thepage}~van~\textbf{\pageref*{LastPage}}}}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
}
Expand Down
2 changes: 2 additions & 0 deletions inst/pandoc/inbo_rapport.tex
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@
$if(hyphentation)$\hyphenation{$hyphentation$}$endif$
$if(nocolophon)$\colophon{0}$else$\colophon{1}$endif$
$if(internal)$\public{0}$else$\public{1}$endif$
$if(pagefootmessage)$\pagefootmessage{$pagefootmessage$}$endif$
$for(header-includes)$
$header-includes$
Expand Down
6 changes: 3 additions & 3 deletions inst/pandoc/translations.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ local function translation(lang)
cover = "Foto cover",
depotnr = "Depotnummer",
export = "Exporteer referentie als",
iseries = "Interne rapporten van het",
license_pre = "Dit werk valt onder een",
license = "Creative Commons Naamsvermelding 4.0 Internationaal-licentie",
location = "Vestiging",
Expand All @@ -20,7 +21,6 @@ local function translation(lang)
ordernr = "Opdrachtnummer",
reviewer = "Nagelezen door",
series = "Rapporten van het",
unpublished = "Onuitgegeven rapport",
vu = "Verantwoordelijke uitgever",
year = "Gepubliceerd in"
}
Expand All @@ -35,6 +35,7 @@ local function translation(lang)
country = ", Belgique",
cover = "Photo de couverture",
depotnr = "Numéro de dépôt",
iseries = "Rapports internes de",
export = "Exporter la référence à",
license_pre = "Ce rapport est sous licence",
license = "Creative Commons Attribution 4.0 International Licence",
Expand All @@ -44,7 +45,6 @@ local function translation(lang)
ordernr = "Numéro de commande",
reviewer = "Examiné par",
series = "Rapports de",
unpublished = "Rapport non publié",
vu = "Éditeur responsable",
year = "Publié en"
}
Expand All @@ -60,6 +60,7 @@ local function translation(lang)
country = ", Belgium",
depotnr = "Deposit number",
export = "Export reference to",
iseries = "Internal reports of the",
license_pre = "This work is licensed under a",
license = "Creative Commons Attribution 4.0 International License",
location = "Location",
Expand All @@ -68,7 +69,6 @@ local function translation(lang)
ordernr = "Order number",
reviewer = "Reviewed by",
series = "Reports of the",
unpublished = "Unpublished report",
vu = "Responsible publisher",
year = "Published during"
}
Expand Down
Loading

0 comments on commit 7cdfac4

Please sign in to comment.