rstudio / rticles

LaTeX Journal Article Templates for R Markdown
https://pkgs.rstudio.com/rticles/
1.47k stars 518 forks source link

Feature Request: possibility of output to docx/html by Lua filters #347

Open mingsu opened 3 years ago

mingsu commented 3 years ago

Proper Rmarkdown YAML syntax of authors/institutes can perfectly output to word/html, such as:

---
title: "My title"
author: 
  - name: Katherine Lauck
    email: kslauck@ucdavis.edu
    institute: [davis, pi]
    correspondence: true
  - name: Sarah L. Carroll
    institute: colorado
  - name: Elly Mufliati
    institute: [untan, pi]
  - name: Sadtata Noor Adirahmanta
    institute: bksda
  - name: Novia Sagita
    institute: pi
  - name: Siti Kartikawati
    institute: [untan, pi]
  - name: Adam Miller
    institute: pi
institute:
  - davis: Graduate Group in Ecology, University of California, Davis
  - pi: Planet Indonesia
  - untan: Fakultas Kehutanan, Universitas Tanjungpura
  - bksda: Balai Konservasi Sumber Daya Alam
  - colorado: Graduate Degree Program in Ecology, Colorado State University
output: 
  word_document:
    pandoc_args:
      - '--lua-filter=scholarly-metadata.lua'
      - '--lua-filter=author-info-blocks.lua'
---

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

Abstract

blah blah


the above example file comes from [here](https://raw.githubusercontent.com/pandoc/lua-filters/master/author-info-blocks/author-info-blocks.lua)

the Lua filter files used here are from: 

[author-info-blocks.lua](https://github.com/pandoc/lua-filters/tree/master/author-info-blocks)
[scholarly-metadata.lua](https://github.com/pandoc/lua-filters/tree/master/scholarly-metadata)

Since the YAML syntax of authors/institutes in `rticles`  is different from the above example, author-info-blocks.lua and 
scholarly-metadata.lua are not working for `rticles`

title: Short Paper author:


## Expected

With follow output syntax, the Rmarkdown can render to docx/html with authors/institutes

title: Short Paper author:

journal: "An awesome journal" date: "r Sys.Date()" bibliography: mybibfile.bib

linenumbers: true

numbersections: true

csl: elsevier-harvard.csl output: bookdown::word_document2: pandoc_args:


Text based on elsarticle sample manuscript, see http://www.elsevier.com/author-schemas/latex-instructions#elsarticle



<!--
Please keep the below portion in your issue and delete the portion below. Your issue will be closed if any of the above boxes is not checked. In certain (rare) cases, you may be exempted if you give a brief explanation (e.g., you are only making a suggestion for improvement). Thanks!
-->

---

By filing an issue to this repo, I promise that

- [x] I have fully read the issue guide at https://yihui.name/issue/.
- [x] I have provided the necessary information about my issue.
    - If I'm asking a question, I have already asked it on Stack Overflow or RStudio Community, waited for at least 24 hours, and included a link to my question there.
    - If I'm filing a bug report, I have included a minimal, self-contained, and reproducible example, and have also included `xfun::session_info('rticles')`. I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version: `remotes::install_github('rstudio/rticles')`.
    - If I have posted the same issue elsewhere, I have also mentioned it in this issue.
- [x] I have learned the Github Markdown syntax, and formatted my issue correctly.

I understand that my issue may be closed if I don't fulfill my promises.