rstudio / rstudio/rticles

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

Open
#347 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

feature
Dominant language
TeX
Stars
1.5k
Forks
517
Avg merge
1d 8h
Merged PRs (30d)
5

Description

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

the Lua filter files used here are from:

author-info-blocks.lua
scholarly-metadata.lua

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:
  - name: Alice Anonymous
    email: alice@example.com
    affiliation: Some Institute of Technology
    footnote: 1
  - name: Bob Security
    email: bob@example.com
    affiliation: Another University
  - name: Cat Memes
    email: cat@example.com
    affiliation: Another University
    footnote: 2
  - name: Derek Zoolander
    email: derek@example.com
    affiliation: Some Institute of Technology
    footnote: 2
address:
  - code: Some Institute of Technology
    address: Department, Street, City, State, Zip
  - code: Another University
    address: Department, Street, City, State, Zip
footnote:
  - code: 1
    text: "Corresponding Author"
  - code: 2
    text: "Equal contribution"
...
---

Expected

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

---
title: Short Paper
author:
  - name: Alice Anonymous
    email: alice@example.com
    affiliation: Some Institute of Technology
    footnote: 1
  - name: Bob Security
    email: bob@example.com
    affiliation: Another University
  - name: Cat Memes
    email: cat@example.com
    affiliation: Another University
    footnote: 2
  - name: Derek Zoolander
    email: derek@example.com
    affiliation: Some Institute of Technology
    footnote: 2
address:
  - code: Some Institute of Technology
    address: Department, Street, City, State, Zip
  - code: Another University
    address: Department, Street, City, State, Zip
footnote:
  - code: 1
    text: "Corresponding Author"
  - code: 2
    text: "Equal contribution"

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:
        - --filter=pandoc-crossref
        - --lua-filter=UPDATED-scholarly-metadata.lua
        - --lua-filter=UPDATED-author-info-blocks.lua
    bookdown::html_document2:
      pandoc_args:
        - --filter=pandoc-crossref
        - --lua-filter=UPDATED-scholarly-metadata.lua
        - --lua-filter=UPDATED-author-info-blocks.lua

---

_Text based on elsarticle sample manuscript, see [http://www.elsevier.com/author-schemas/latex-instructions#elsarticle](http://www.elsevier.com/author-schemas/latex-instructions#elsarticle)_


By filing an issue to this repo, I promise that

  • I have fully read the issue guide at https://yihui.name/issue/.
  • 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.
  • 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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the rticles YAML author, affiliation, address, and footnote fields with author-info-blocks.lua and scholarly-metadata.lua from the linked pandoc/lua-filters examples. Check how the existing rticles output configuration passes pandoc arguments for word and HTML output. Done means the rticles metadata works with equivalent Lua filters in both requested output formats.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua, r
Domain
documentation
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.