Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Propre #34

Open
wants to merge 47 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
293474c
Integration brute de propre.brochure
tvroylandt Feb 13, 2021
ac32e2a
Ajout template Pandoc a blanc
tvroylandt Feb 13, 2021
120728a
Gestion des fonts selon le systeme gouvdown
tvroylandt Feb 13, 2021
df89c78
Gestion blocs marques
tvroylandt Feb 13, 2021
3222cab
Skeleton YAML propre brochure
tvroylandt Feb 13, 2021
b261b7b
Plan vignette propre
tvroylandt Feb 18, 2021
758c6fe
Deplacement de la brochure vers spyrales/propre.brochure
tvroylandt Feb 18, 2021
243c0e8
Squelette PROPRE version Descartes
tvroylandt Feb 19, 2021
63f4ea0
Ajout width-main-column
tvroylandt Feb 28, 2021
5b663b7
Ajout des divs dans le skeleton
tvroylandt Feb 28, 2021
9dcd862
Refined vignette brochure
tvroylandt Feb 28, 2021
5117988
Images dans la vignette v1
tvroylandt Feb 28, 2021
cfc6503
première refactorisation des css
julientaq Mar 11, 2021
af1c91f
Ajout div et variable CSS width
tvroylandt Mar 14, 2021
73d65f0
MAJ vignette de doc avec ajouts CSS
tvroylandt Mar 14, 2021
5bc7a9a
enlever les css non utilisées
julientaq Mar 16, 2021
a3242a3
fix inline dans le #header
julientaq Mar 16, 2021
10f7f66
nettoyage book.css
julientaq Mar 16, 2021
865cec7
couleur bleue sur les titres
julientaq Mar 16, 2021
a457b71
remove blockquote basic styles
julientaq Mar 17, 2021
47fca4c
Typo solced
tvroylandt Mar 21, 2021
840a145
Remove Pandoc template
tvroylandt Mar 21, 2021
eb61e92
Misc changes
tvroylandt Mar 21, 2021
a807b40
Attempt at GHA rmd 1
tvroylandt Mar 21, 2021
6c9fbc0
Attempt at GHA rmd 2
tvroylandt Mar 21, 2021
d0ddde7
Attempt at GHA rmd 3
tvroylandt Mar 21, 2021
f5a9c48
Attempt at GHA rmd 4
tvroylandt Mar 21, 2021
06da786
Attempt at GHA rmd 5
tvroylandt Mar 21, 2021
fa5d42b
Attempt at GHA rmd 6
tvroylandt Mar 21, 2021
dc307f1
Attempt at GHA rmd 7
tvroylandt Mar 21, 2021
6a7e635
Attempt at GHA rmd 8
tvroylandt Mar 21, 2021
3093957
Attempt at GHA rmd 9
tvroylandt Mar 21, 2021
450b206
Attempt at GHA rmd 10
tvroylandt Mar 21, 2021
e22cf84
GHA Rmd final
tvroylandt Mar 21, 2021
294236b
Ajout captures écran vignette
tvroylandt Mar 21, 2021
871c16f
Ajout made_with
tvroylandt Mar 29, 2021
770f747
Repalce logo prefecture_r24
Mar 1, 2022
b2001e1
Mise à jour du logo de la Corse et mise à jour de la doc (juste par l…
jengelaere Dec 12, 2022
caa5ba4
Update CI : no more master branch in r-lib/actions
jengelaere Dec 12, 2022
42bea74
Merge pull request #47 from MurielleDelmotte/change_logo_R24
jengelaere Dec 12, 2022
7ca4132
Merge branch '56-maj-logo-prefecture-de-corse' into 46-maj-logo-préfè…
jengelaere Dec 12, 2022
df084b8
lise à jour doc suite checks
jengelaere Dec 12, 2022
ae85117
maj de la branche (master + logos CvL Corse)
jengelaere Dec 12, 2022
46eb92a
Mise à niveau de la branche
jengelaere Dec 12, 2022
db72d80
feat : propre.brochure (WIP) :
jengelaere Dec 14, 2022
01d4b1a
Update R-CMD-check.yaml
jengelaere Nov 17, 2023
7d023a5
Update R-CMD-check.yaml
jengelaere Nov 17, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ Imports:
rmarkdown,
systemfonts,
utils,
xfun
xfun,
pagedown
Suggests:
pals,
scales,
Expand All @@ -63,6 +64,7 @@ Collate:
'gitbook_gouv.R'
'gouv_palettes.R'
'logo.R'
'propre_brochure.R'
'skeleton.R'
'utils.R'
'zzz.R'
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export(list_logos)
export(load_fonts)
export(logo_file_path)
export(marianne_font_dep)
export(propre_brochure)
export(scale_color_gouv_continuous)
export(scale_color_gouv_discrete)
export(scale_fill_gouv_continuous)
Expand Down
10 changes: 6 additions & 4 deletions R/html_gouv.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,21 @@ create_header_html_gouv <- function(logo = NULL,
stop("please select only one file")
}
logo_name <- basename(file)
if (!dir.exists(here::here("www"))) {dir.create(here::here("www"))}
file.copy(file,'www')
path_here_www <- here::here("www")
if (!dir.exists(path_here_www)) {dir.create(path_here_www)}
file.copy(file, paste0(path_here_www, "/", logo_name))
writeLines(
glue(
"<div class=\"row\">

<div class=\"col-md-4\">
<a>
<img src=\"www/{logo_name}\" width=\"215px\">
<img src=\"{path_here_www}/{logo_name}\" width=\"215px\">
</a>
</div>

</div>"),
</div>"
),
output
)

Expand Down
66 changes: 66 additions & 0 deletions R/propre_brochure.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#' gouvdown PDF brochure - PROPRE style
#'
#' @inheritParams html_gouv
#' @param ... Additional arguments passed to \code{bookdown::\link{html_document2}()}.
#' @param css A character vector of additionnal CSS file paths.
#' @param width_main_column Width of the main text column (in %)
#'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#'
#' @param made_with Character. Add extra information to show how the document was made.
#'

Je pense qu'il manque cette documentation de fonction et le passage de roxygen2::roxygenise() pour que ce soit fonctionnel

#' @return An R Markdown output format object to be passed to
#' \code{rmarkdown::\link{render}()}.
#' @export
propre_brochure <- function(extra_dependencies = list(),
includes = NULL,
...,
logo = NULL,
css = NULL,
use_gouvdown_fonts = TRUE,
width_main_column = 15) {
# init variable
logo_html_fragment <- NULL

# create HTML fragment for logo
if (!is.null(logo)) {
if (xfun::file_ext(logo) == "") {
logo_html_fragment <- create_header_html_gouv(logo = logo)
}
else {
match.arg(xfun::file_ext(logo), c("png", "svg", "jpg", "gif"))
logo_html_fragment <- create_header_html_gouv(file = logo)
}
}

includes <- as.list(includes)
includes$before_body <-
c(includes$before_body, logo_html_fragment)

# custom css
book_css <- pkg_resource("css/propre", "book.css")

# custom Pandoc template
brochure_html <- pkg_resource("html", "propre_brochure.html")

# fonts dependencies - taken from html_gouv
extra_dependencies <- c(gouvdown_dependencies(use_gouvdown_fonts),
extra_dependencies)

# width of main column - write css
width_css <- tempfile(fileext = ".css")

writeLines(paste(
paste0(":root {--main-column-width:", width_main_column , "%;}"),
paste0(":root {--secondary-column-width:", 100 - width_main_column - 5, "%;}"), sep = "\n"
),
con = width_css)

# render
pagedown::html_paged(
extra_dependencies = extra_dependencies,
includes = includes,
number_sections = FALSE,
# self_contained = FALSE,
toc = FALSE,
css = c(css, book_css, width_css),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

L'utilisation de l'argument css empêche de travailler avec self_contained = FALSE. Ce serait mieux de travailler avec des html_dependencies.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ca me semble être le point principal ici. Faut que je regarde comment faire (pas trop à l'aise avec les html_dependecies) et je m'en occupe derrière

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Je peux m'en occuper, je l'ai fait des dizaines de fois

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Si ça te dérange pas je veux bien. Comme ça la prochaine fois je saurai. Merci =)

template = brochure_html,
...
)
}
41 changes: 41 additions & 0 deletions inst/resources/css/propre/book.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/* import your fonts if you have some in the src/fonts folder */
/* @import "modules/fonts.css"; */

/* theming of the book */
@import url('https://fonts.googleapis.com/css2?family=Caveat&display=swap');
jengelaere marked this conversation as resolved.
Show resolved Hide resolved

@import 'modules/reset.css';
/* @import "modules/fonts.css"; */
@import "modules/colors.css";
@import "modules/vars.css";
@import "modules/body.css";
@import "modules/header.css";
@import "modules/pictures.css";
@import "modules/list.css";
@import "modules/table.css";
@import "modules/numbering.css";
@import "modules/notes.css";
@import "modules/title.css";
/* @import "modules/page2.css";
@import "modules/page3.css";
@import "modules/page4.css"; */
/* @import "modules/title.css"; */


/* css for the layouts */
/* paged.js tool import */

/* paged js interface and screen view css */
@import "interface/interface.css";

/* baseline helper */
@import "interface/baseline.css";

/* the book */
@import "modules/layout.css";

/* hack for stuff not implemented yet */
@import "interface/hack.css";



25 changes: 25 additions & 0 deletions inst/resources/css/propre/interface/baseline.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/* adding a visual helper for the baseline grid */

:root {
/* you can change the line-height step for the grid here (as it may not be the same that the lineheight) */
--baseline: 18px;
--baseline-color: red;
}

@media screen {

.pagedjs_page {
/* grid baseline */
background:
repeating-linear-gradient(
white 0,
white calc(var(--baseline) - 1px),
var(--baseline-color) calc(var(--baseline)));
background-size: cover;
background-repeat: repeat-y;
background-position-y: -15px;
}

}


2 changes: 2 additions & 0 deletions inst/resources/css/propre/interface/hack.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/* here come some simple hacks for features that are not yet in paged js */
julientaq marked this conversation as resolved.
Show resolved Hide resolved

53 changes: 53 additions & 0 deletions inst/resources/css/propre/interface/interface.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/* To define how the book look on the screen: */

@media screen {
body {
background-color: var(--color-background);
}

.pagedjs_pages {
display: flex;
width: calc(var(--pagedjs-pagebox-width) * 2);
flex: 0;
flex-wrap: wrap;
margin: 0 auto;
margin-bottom: 3em;
}

.pagedjs_page {
background-color: var(--color-paper);
box-shadow: 0 0 0 2px var(--color-pageBox);
margin: 0;
flex-shrink: 0;
flex-grow: 0;
margin-top: 10mm;
}

.pagedjs_first_page {
margin-left: var(--pagedjs-pagebox-width);
}

.pagedjs_page > [class*="pagedjs_margin"] {
box-shadow: 0 0 0 1px var(--color-marginBox);
}

[class*="pagedjs_margin"] {
box-shadow: 0 0 0 1px inset orange;
}

/* uncomment for recto/verso book.
--------------------------------------------------- */
/* .pagedjs_pages {
flex-direction: column;
width: 100%;
}

.pagedjs_first_page {
margin-left: 0;
}

.pagedjs_page {
margin: 0 auto;
margin-top: 20mm;
} */
}
Loading