Skip to content

Commit

Permalink
Lettre word (#52)
Browse files Browse the repository at this point in the history
* Ajout template lettre docx

* create function lettre_word for new output_format

* documentation of lettre_word

* create template for output format lettre_word

* test of template lettre_word

* Update readme and news for new word output_format

* maj du fichier d'exemple pour la  création d'une lettre word

* maj du template lettre word

* Modification du template pour la prise en compte de la police pour les titres

Co-authored-by: cdugeai <colin.dugeai@modernisation.gouv.fr>
  • Loading branch information
cdugeai and cdugeai authored Sep 20, 2022
1 parent 22e0008 commit d43ff2b
Show file tree
Hide file tree
Showing 28 changed files with 182 additions and 59 deletions.
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Remotes:
Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.1.2
RoxygenNote: 7.2.1
Collate:
'colors.R'
'fonts.R'
Expand All @@ -69,4 +69,5 @@ Collate:
'logo.R'
'skeleton.R'
'utils.R'
'word.R'
'zzz.R'
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export(gglogo)
export(gitbook_gouv)
export(gouv_colors)
export(html_gouv)
export(lettre_word)
export(list_logos)
export(load_fonts)
export(logo_file_path)
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# gouvdown 0.0.0.9000

* Add new output_format and template for creating docx letter

* Add logos for regional prefecture and 3 ministries

* Added `Book project using gouvdown` template
Expand Down
28 changes: 28 additions & 0 deletions R/word.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright 2020 République Française
#
# Licensed under the EUPL, Version 1.2 or – as soon they will be approved by
# the European Commission - subsequent versions of the EUPL (the "Licence");
# You may not use this work except in compliance with the Licence.
# You may obtain a copy of the Licence at:
#
# https://joinup.ec.europa.eu/software/page/eupl
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the Licence is distributed on an "AS IS" basis,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the Licence for the specific language governing permissions and
# limitations under the Licence.

#' Word output format for creating a docx letter
#'
#' @inheritParams rmarkdown::word_document
#' @param ... Additional arguments passed to \code{rmarkdown::\link{word_document}()}.
#'
#' @return An R Markdown output format object to be passed to
#' \code{rmarkdown::\link{render}()}.
#' @export
#'
#' @examples
lettre_word <- function(reference_docx = pkg_resource("docx", "template_lettre.docx"), ...){
rmarkdown::word_document(reference_docx = reference_docx, ...)
}
4 changes: 4 additions & 0 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ ggplot(data = iris, aes(x = Sepal.Length, y = Sepal.Width)) +

![](man/figures/gouvbook.png)

### Word output format

**gouvdown** provides a word template for `{Rmarkdown}` for writing an official letter.

## References

+ Design system: <https://www.gouvernement.fr/charte/charte-graphique-les-fondamentaux/introduction>
Expand Down
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ remotes::install_github("spyrales/gouvdown")

## Rmarkdown

### html\_document
### html_document

**gouvdown** provides a html template for `{Rmarkdown}`

Expand All @@ -50,9 +50,14 @@ remotes::install_github("spyrales/gouvdown")

![](man/figures/gouvbook.png)

### Word output format

**gouvdown** provides a word template for `{Rmarkdown}` for writing an
official letter.

## References

- Design system:
- Design system:
<https://www.gouvernement.fr/charte/charte-graphique-les-fondamentaux/introduction>
- Example:
- Example:
<https://github.com/DISIC/design.numerique.gouv.fr/tree/master/src/assets>
Binary file added inst/resources/docx/template_lettre.docx
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
---
#title: "Exemple lettre Word"
output: gouvdown::lettre_word
params:
lettre_date: "01/01/2022"
lettre_lieu: "Paris"

---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

::: {custom-style="Date"}
`r params$lettre_lieu`, le `r params$lettre_date`
:::


::: {custom-style="header-letter"}
Je ne sais plus à quoi doit servir ce style
:::


::: {custom-style="header-letter-naming"}
Madame la préfête de la Loire-Atlantique
:::

::: {custom-style="objet-title"}
Objet: Informations sur ...
:::


## Un titre de niveau 2

"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."


::: {custom-style="header-annexes"}
Annexes
:::


Le titre au dessus marque le début de la section des annexes.


Listes à puces:

::: {custom-style="Compact"}
- le style
- "Compact"
- est utilisé pour
- les listes à puces
:::



::: {custom-style="header-annexeN"}
Annexe 1: Première annexe
:::


::: {custom-style="subheader-annexe"}
Sous-titre de la première annexe
:::

Contenu de l'annexe 1

4 changes: 4 additions & 0 deletions inst/rmarkdown/templates/gouvdown-lettre-word/template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
name: gouvdown lettre Word
description: >
Un document word au format lettre
create_dir: FALSE
2 changes: 1 addition & 1 deletion man/add_plot_header.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 5 additions & 12 deletions man/check_fonts_in_r.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/create_header_html_gouv.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions man/fonts-dependencies.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions man/gglogo.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions man/gitbook_gouv.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/gouv_colors.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/gouv_pal_inter.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion man/gouv_palettes.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions man/html_gouv.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions man/lettre_word.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/scale_color_gouv_continuous.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/scale_color_gouv_discrete.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/scale_fill_gouv_continuous.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/scale_fill_gouv_discrete.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 4 additions & 9 deletions man/theme_gouv.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 3 additions & 5 deletions man/theme_gouv_map.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d43ff2b

Please sign in to comment.