Giter VIP home page Giter VIP logo

luarefnos's People

Contributors

tstenner avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

luarefnos's Issues

Suggest to support "clever references" with "+"

Since pandoc-xnos seems to be dead for now and it doesn't really support pandoc 3.x (e.g. pandoc-fignos is broken due to the new AST format), migrating to this native LUA implementation sounds like a good idea. But it would be beneficial if we could keep the documents written for pandoc-xnos...

So one of the differences is the "clever references" feature available in pandoc-xnos. The difference is the following:

  • pandoc-xnos:

    • @fig:myfigure is simply replaced with the number of the figure (e.g. 1).
    • +@fig:myfigure is replaced with the caption + number (e.g. Figure 1)
  • luarefnos:

    • @fig:myfigure is replaced with the caption + number (e.g. Figure 1)

Ideally, my suggestion is to implement exactly the same syntax as pandoc-xnos.
But if that is too complex, maybe it is possible to implement deletion of the + sign right before the reference.

Explanation:

  • Today @fig:myfigure in luarefnos does the same as +@fig:myfigure in pandoc-xnos. Namely, it emits caption + number (e.g. Figure 1)
  • If someone has a document written for pandoc-xnos, they are likely to have something like:
    Please see +@fig:myfigure for more details.
    
  • If they migrate to luarefnos, this line will be rendered as:
    Please see +Figure 1 for more details.
    
  • So it is almost like the clever reference, but there is this + that should not be there...

Suggest to support "tbl:" syntax for tables, for compatibility with pandoc-xnos users

Since pandoc-xnos seems to be dead for now and it doesn't really support pandoc 3.x (e.g. pandoc-fignos is broken due to the new AST format), migrating to this native LUA implementation sounds like a good idea. But it would be beneficial if we could keep the documents written for pandoc-xnos...

So one of the differences is the fact that tables in pandoc-xnos are abbreviates with tbl:, while luarefnos uses tab: by default. I fixed it for myself, by adding a duplicate line for tbl here:

luarefnos/refnos.lua

Lines 367 to 381 in 4ae8fbc

function SetStrings(opts, lang)
local Localized = {
de = {
tab = {ref = 'Tabelle', plural = 'Tabellen', abbrev = 'Tab.'},
fig = {ref = 'Abbildung', plural = 'Abbildungen', abbrev = 'Abb.'},
eq = {ref = 'Gleichung', plural = 'Gleichungen', abbrev = 'Gl.'},
sec = {ref = 'Abschnitt', plural = 'Abschnitte', abbrev = 'Abs.'}
},
en = {
tab = {ref = 'Table', plural = 'Tables', abbrev = 'Tab.'},
fig = {ref = 'Figure', plural = 'Figures', abbrev = 'Fig.'},
eq = {ref = 'Equation', plural = 'Equations', abbrev = 'Eq.'},
sec = {ref = 'Section', plural = 'Sections', abbrev = 'Sec.'}
}
}

E.g.:

en = {
   tab = {ref = 'Table', plural = 'Tables', abbrev = 'Tab.'},
   tbl = {ref = 'Table', plural = 'Tables', abbrev = 'Tab.'},

With this change, I can render the documents that have links like @tbl:silly
Apparently, I couldn't just replace "tab" with "tbl", because is some other places it is used...

I suggest adding "official" support for this.

Fail with "nil value" when rendering tables without ID on pandoc 3.1.x

On pandoc 3.1.11.1:

% pandoc --version
pandoc 3.1.11.1
Features: +server +lua
Scripting engine: Lua 5.4

Trying to render a simple table without ID (the filter is not expected to do anything here):

% cat table.md 
 Revision        Date       Change Description
----------   ------------   --------------------
0.5           2022-07-05    Initial Draft

This results in failure:

% pandoc table.md --lua-filter refnos.lua -o table.html 
Error running filter refnos.lua:
refnos.lua:71: attempt to index a nil value (field 'integer index')
stack traceback:
	refnos.lua:247: in function <refnos.lua:244>

The problem seems to be here:

if tbl.attr.identifier then

I fixed it by replacing this line with:

if tbl.attr.identifier ~= "" then

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.