Giter Club home page Giter Club logo

pandoc-list-table's People

Contributors

bpj avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar

pandoc-list-table's Issues

migration to 2.10+

Moved this comment here from pandoc issues:

Note that it currently only works with pandoc < 2.10 (if anybody understands the pandoc 2.10 table model a pull request is most welcome! :-)

Check the latest pandoc nightly for SimpleTable support by tarleb, or next pandoc 2.11.

In your table2lol function, at line 233, use something like:

--local tab = div.content[1]
local tab = pandoc.utils.to_simple_table(div.content[1])

And in your lol2table function, at line 185, use something like:

--local ok, res = pcall(pandoc.Table, caption, aligns, widths, headers, rows)
local ok, res = pcall(pandoc.SimpleTable, caption, aligns, widths, headers, rows)
assert(ok, "Error converting list to table in " .. tostring(div_id) .. ": " .. tostring(res))  -- no change here
res = pandoc.utils.from_simple_table(res)  -- ugly, but you get the point
-- or without the pcall:
-- local res =  pandoc.utils.from_simple_table( pandoc.SimpleTable(caption, aligns, widths, headers, rows) )

table2lol: ul instead of ol

Very useful filter, thank you. Alleviates the pain of markdown's finicky table syntax.

Is there a way to have table2lol output something like

*   -   foo
    -   bar
    -   baz

Don't add cells the user didn't add

$> pandoc --lua-filter pandoc-list-table.lua

::: lol2table
*   - a
    - b
*   - c
:::
<table>
  <caption></caption>
  <thead>
    <tr class="header">
      <th>a</th>
      <th>b</th>
    </tr>
  </thead>
  <tbody>
    <tr class="odd">
      <td>c</td>
      <td></td> <!-- <<< added-->
    </tr>
  </tbody>
</table>

Is there a way to tell pandoc-list-table to not add a cell next to c?

Thank you!

Updated: I looked at the codebase and found the code below. Maybe I could try just removing it?

    -- Make sure all rows are the same length by adding empty
    -- cells until they are the same length as the longest row
    for row in *rows
      while #row < col_count
        row[#row+1] = {}

Update for pandoc 2.16

Pandoc has changed the Lua type of its objects from table to userdata, which necessitates some changes in this filter. I'll probably push a fix in the first week of 2022.

Preserve attributes

::: {.lol2table #some-id .some-class lang=en}

A table of stuff.

-   -   foo
    -   bar
    -   baz
-   -   -   tic
        -   pic
    -   -   tac
        -   pac
    -   -   toc
        -   poc
:::

currently produces <table>...</table>. I would expect it to produce:

<table id="some-id" class="some-class" lang="en">...</table>

(sometimes you want/need to add attributes directly to the table as opposed to a wrapping div)

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.