Code Monkey home page Code Monkey logo

acronymsdown's Introduction

Remy Chaput

Hi, I'm Remy Chaput ๐Ÿ‘‹

PhD in Artificial Intelligence ๐Ÿค–

About me ๐Ÿ‘จโ€๐Ÿ’ป

  • I am a ๐Ÿ”จ software engineer, ๐Ÿ“ computer science researcher and ๐Ÿ“š teacher from Lyon, France.
  • My favourite languages are Python3 and Java, although I use many languages.
  • I mainly create projects that I find useful, but I also code for fun.

Read more on ๐Ÿ“ƒ rchaput.github.io

My stack ๐Ÿ’ป

Programming languages

Python
Java
Kotlin
Lua
Bash
Zsh
R
Prolog
JS
Vue.js
Vuetify
React

Tools ๐Ÿ”ง

Git
IntelliJ IDEA
PyCharm
macOS
Arch Linux
Debian
Docker
PostgreSQL
MongoDB

GitHub stats ๐Ÿ”ฅ

Account stats Top languages

Star History Chart

acronymsdown's People

Contributors

rchaput avatar zeigerpuppy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

acronymsdown's Issues

mispelling in README.md - `keys` instead of `key`

the acronyms definition shown in the README.md should be:

(keys instead of key)

---
acronyms:
  keys:
    - shortname: Rmd
      longname: RMarkdown
    - shortname: YAML
      longname: YAML Ain't Markup Language
---

NOT

---
acronyms:
  key:
    - shortname: Rmd
      longname: RMarkdown
    - shortname: YAML
      longname: YAML Ain't Markup Language
---

Mispelling will result in error when trying to use acronym:

[WARNING][acronymsdown] Acronym key Rmd not recognized

inline LaTeX math not parsed properly - how to quote literal for longname?

In the RMarkdown document, the following inline parses properly (in both HTML and PDF formats):

$\color{DarkGreen}{\text{Green Text}}$

However, when trying to use the same in an acronym:

---
acronyms:
  keys:
    - shortname: myacr
      longname: $\color{DarkGreen}{\text{Green Text}}$
---

\acr{myacr}

this gets parsed in LaTeX as:

\textbackslash color\{DarkGreen\}\{\textbackslash text\{Green Text\}\}

It looks like the backslash gets converted to a \textbackslash which results in the LaTex not working.

whereas it should be parsed as

\(\color{DarkGreen}{\text{Green Text}}\)

Also tried following without success

  • \color{DarkGreen}{\text{Green Text}}
  • "\color{DarkGreen}{\text{Green Text}}"
  • \\color{DarkGreen}{\text{Green Text}}
  • \(\color{DarkGreen}{\text{Green Text}}\)

Is there a way to force \acr{} to insert literal?

Use package with Quarto: `attempt to index a nil value (global 'Acronyms')`

I used acronymsdown without issues up until last week. Then something happened and now I cannot render my report. The yml is the following:

---
title: "Paper"
metadata-files:
  - ../../../all_phd/authors.yml
format:
  pdf:
    pdf-engine: pdflatex
    number-sections: true
    toc: false
    margin-left: 15mm
    margin-right: 15mm
    margin-bottom: 20mm
    margin-top: 15mm
    include-in-header:
      text: |
        \usepackage{rotating}
        \usepackage{float}
        \usepackage{typearea}
bibliography: ../../../PhD.bib
link-citations: true
linkcolor: blue
execute:
  echo: false
  warning: false
  error: false
  message: false
editor_options: 
  chunk_output_type: console
filters:
  - acronyms
  - ../../../all_phd/scholarly-metadata.lua
  - ../../../all_phd/author-info-blocks.lua
acronyms:
  fromfile: ../../../all_phd/acronyms.yml
  insert_links: false
  insert_loa: false
  sorting: alphabetical
---

This is what I obtain when trying to render it:

Error running filter /home/lorenzo/applications/quarto-cli/src/resources/filters/main.lua:
...lixSC-neuro/docs/_extensions/acronyms/parse-acronyms.lua:109: attempt to index a nil value (global 'Acronyms')
stack traceback:
	[C]: in ?
	[C]: in method 'walk'
	...s/quarto-cli/src/resources/filters/./ast/customnodes.lua:72: in function 'run_emulated_filter'
	.../quarto-cli/src/resources/filters/./ast/runemulation.lua:34: in local 'callback'
	[string "..."]:1875: in field 'withScriptFile'
	.../quarto-cli/src/resources/filters/./ast/runemulation.lua:43: in upvalue 'run_emulated_filter_chain'
	.../quarto-cli/src/resources/filters/./ast/runemulation.lua:78: in function <.../quarto-cli/src/resources/filters/./ast/runemulation.lua:75>
stack traceback:
	...s/quarto-cli/src/resources/filters/./ast/customnodes.lua:72: in function 'run_emulated_filter'
	.../quarto-cli/src/resources/filters/./ast/runemulation.lua:34: in local 'callback'
	[string "..."]:1875: in field 'withScriptFile'
	.../quarto-cli/src/resources/filters/./ast/runemulation.lua:43: in upvalue 'run_emulated_filter_chain'
	.../quarto-cli/src/resources/filters/./ast/runemulation.lua:78: in function <.../quarto-cli/src/resources/filters/./ast/runemulation.lua:75>
ERROR: Error
    at renderFiles (file:///home/lorenzo/applications/quarto-cli/src/command/render/render-files.ts:540:23)
    at eventLoopTick (ext:core/01_core.js:181:11)
    at async render (file:///home/lorenzo/applications/quarto-cli/src/command/render/render-shared.ts:98:18)
    at async renderForPreview (file:///home/lorenzo/applications/quarto-cli/src/command/preview/preview.ts:400:24)
    at async render (file:///home/lorenzo/applications/quarto-cli/src/command/preview/preview.ts:159:22)
    at async preview (file:///home/lorenzo/applications/quarto-cli/src/command/preview/preview.ts:176:18)
    at async Command.fn (file:///home/lorenzo/applications/quarto-cli/src/command/preview/cmd.ts:356:7)
    at async Command.execute (file:///home/lorenzo/applications/quarto-cli/src/vendor/deno.land/x/[email protected]/command/command.ts:1790:7)
    at async quarto (file:///home/lorenzo/applications/quarto-cli/src/quarto.ts:126:3)
    at async file:///home/lorenzo/applications/quarto-cli/src/quarto.ts:158:5

As of now, I tried to create a _extensions directory in the same folder of the Quarto document (not the root of the project, though), whitin which I created a directory named acronyms which contain the .lua filters and the file _extension.yml:

title: acronyms
author: rchaput
version: 1.0.0
quarto-required: ">=1.2.0"
contributes:
  filters:
    - parse-acronyms.lua

Other informations:

> R.version
               _                           
platform       x86_64-pc-linux-gnu         
arch           x86_64                      
os             linux-gnu                   
system         x86_64, linux-gnu           
status                                     
major          4                           
minor          1.2                         
year           2021                        
month          11                          
day            01                          
svn rev        81115                       
language       R                           
version.string R version 4.1.2 (2021-11-01)
nickname       Bird Hippie

I am using Quarto version 99.9.9. The output of quarto check is the following:

[โœ“] Checking versions of quarto binary dependencies...
      Pandoc version 3.1.2: OK
      Dart Sass version 1.55.0: OK
      Deno version 1.33.2: OK
[โœ“] Checking versions of quarto dependencies......OK
[โœ“] Checking Quarto installation......OK
      Version: 99.9.9
      Path: /home/lorenzo/applications/quarto-cli/package/dist/bin

[โœ“] Checking basic markdown render....OK

[โœ“] Checking Python 3 installation....OK
      Version: 3.10.6
      Path: /usr/bin/python3
      Jupyter: 5.2.0
      Kernels: python3

[โœ“] Checking Jupyter engine render....OK

[โœ“] Checking R installation...........OK
      Version: 4.1.2
      Path: /usr/lib/R
      LibPaths:
        - /home/lorenzo/Documents/edu/phd/papers/paper3_helixSC_neuro/paper-helixSC-neuro/renv/library/R-4.1/x86_64-pc-linux-gnu
        - /home/lorenzo/.cache/R/renv/sandbox/R-4.1/x86_64-pc-linux-gnu/9a444a72
      knitr: 1.42
      rmarkdown: 2.21

[โœ“] Checking Knitr engine render......OK

The version of acronymsdown is 0.11.1, and I downloaded the lua filters last Friday.

The content of acronyms.yml is of the form:

---
acronyms:
  keys:
    - key: edc
      shortname: EDC
      longname: endocrine disruptor
---

[Feature Request] Add a `long-long` style for simple substution of long text

It would be great to have access to a long-long style which could be used for a simple substitution of the shortname. This is useful, for instance, in a contract document where the user may want to have a shortcut for writing longer names:

---
acronyms:
  keys:
    - shortname: client
      longname: International Widgets and Spares Inc
---

e.g.

---
acronyms:
  keys:
    - shortname: Rmd
      longname: RMarkdown
   style: long-long
---

## long-long

First use: \acr{Rmd}

Next uses: \acr{Rmd}

Output:

long-long

First use: RMarkdown document

Next uses: RMarkdown document

Quarto

Does this package work with Quarto?

Use with Quarto

Not an bug or anything, just if you want to use this with Quarto:

  1. Copy the .lua files in /inst to _extensions folder in your quarto project.
  2. Add the file _extension.yml with contents:
title: acronyms
author: "Remy Chaput (https://github.com/rchaput/acronymsdown) GPL 3.0"
version: 1.0.0
quarto-required: ">=1.2.0"
contributes:
  filters:
    - parse-acronyms.lua
  1. Add the acronyms filter to your filters in _quarto.yml:
filters:
  - acronyms

side note: I was planning out how to do this and stumbled on this repo. It's exactly what I needed, and more of what I wanted. Nice work.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.