Giter Club home page Giter Club logo

list-table's Issues

If some cells are undefined, the filter can generate an invalid AST

If some cells are undefined, the filter can generate an invalid AST. For example, with this markdown:

::: list-table
* - A
  - B

* - 1
:::

...we get the following (edited to show just the offending rows; rep.lua reports the AST using the logging module; see below):

% pandoc-3.1.8 -L list-table.lua list-table-bug.md -L rep.lua -t html -o /dev/null
(#) blocks Blocks[1] {
  [1] Table {
    ...
    bodies: List[1] {
      [1] {
        ...
        body: List[1] {
          [1] pandoc.Row {
            ...
            cells: List[1] {
              [1] pandoc.Cell {
                alignment: "AlignDefault"
                attr: Attr {
                  attributes: AttributeList {}
                  classes: List {}
                  identifier: ""
                }
                col_span: 1
                contents: Blocks[1] {
                  [1] Plain {
                    content: Inlines[1] {
                      [1] Str "1"
                    }
                  }
                }
                row_span: 1
              }
            }
          }
        }
        ...

The row only contains a single cell, so this is an invalid AST and isn't handled correctly by all writers (see jgm/pandoc#9096 for further discussion).

The filter should be updated to add empty cells for any missing ones.

Here's rep.lua

local logging = require 'logging'
function Pandoc(pandoc)
    if logging.loglevel > 0 then
        logging.temp('meta', pandoc.meta)
    end
    logging.temp('blocks', pandoc.blocks)
end

Installing the filter

Hi,

I know this is a basic question, but as a novice I can't find an answer. The list-table.lua filter has worked up to now, but then I updated Quarto, and apparently it has gone.

I've downloaded it again, but can't remember how to install it. I tried moving the file in the Applications/quarto/share/filter folder in my Mac Monterey, but it looks like Quarto is not finding it.

Are there installation instructions that I can read?

Paolo

This LUA filter stopped working with the format `commonmark_x`, and is not displayed correctly with the format `markdown_github` on Codebraid

Hello!

  • I use the latest version of @jgm's Pandoc;
  • I use the latest version of @gpoore's Codebraid and Codebraid Preview;
  • I use mostly the format markdown_github because of supported features.

Here is a small YAML default file code:

filters:
  - assets/filters/lua/list-table.lua
template: "assets/templates/confluence"
variables:
  confluence_html: true
  languages:
    - english
    - español
    - français
    - português

And VSCode's Codebraid settings:

{
  "codebraid.preview.css.overrideDefault": true,
  "codebraid.preview.css.useDefault": true,
  "codebraid.preview.css.useMarkdownPreviewFontSettings": true,
  "codebraid.preview.pandoc.defaultsFile": "confluence.yaml",
  "codebraid.preview.pandoc.executable": "pandoc",
  "codebraid.preview.pandoc.showRaw": true,
  "codebraid.preview.pandoc.showStderr": "never",
  "codebraid.preview.security.allowEmbeddedScripts": true,
  "codebraid.preview.security.allowInlineScripts": true,
  "codebraid.preview.security.allowLocalScripts": true,
  "codebraid.preview.security.allowRemoteFonts": true,
  "codebraid.preview.security.allowRemoteImages": true,
  "codebraid.preview.security.allowRemoteMedia": true,
  "codebraid.preview.security.allowRemoteScripts": true,
  "codebraid.preview.security.allowRemoteStyles": true,
  "codebraid.preview.scrollEditorWithPreview": true,
  "codebraid.preview.scrollPreviewWithEditor": true,
  "codebraid.preview.pandoc.build": 
  {
    "*.md": 
    {
      "reader": "markdown_github",
      "preview": 
      {
        "html": 
        {
          "defaults": {},
          "options": 
          [
            "--preserve-tabs",
            "--standalone",
            "--wrap=auto",
          ]
        }
      },
      "export": {}
    },
  },
}

Here is a small Pandoc template code:

$if(confluence_html)$
<html $if(lang)$lang="$lang$" $endif$>

<head>
	<meta charset="UTF-8" />
	<meta name="generator" content="pandoc" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
	<title>$if(title-prefix)$$title-prefix$ - $endif$$pagetitle$</title>
</head>

<body>
	$endif$
	<div class="ids-markdown">
		Testing...
		$body$
	</div>
	$if(confluence_html)$
</body>

</html>
$endif$

I tested the simple list-table code in a Markdown file:

# Lorem ipsum dolor sit amet consectetur adipisicing elit. Fugit, minus?

Lorem ipsum dolor, sit amet consectetur adipisicing elit. Vero, adipisci sequi? Maiores autem quaerat praesentium?

:::list-table
   * - row 1, column 1
     - row 1, column 2
     - row 1, column 3

   * - row 2, column 1
     -
     - row 2, column 3

   * - row 3, column 1
     - row 3, column 2
:::

I tested with the markdown_github format and here is the result. It failed to render the code:

It failed to display the list-table code with the markdown_github format

I switched to the format commonmark_x and tested it. Here is the error:

Screenshot – Codebraid Preview error with the commonmark_x format

DOCX output doesn't seem to work.

Using this filter for ODT / HTML / LaTeX works, but when I try DOCX output the filter fails:

▶︎ pandoc -s -o list-table.docx -L list-table.lua --verbose list-table.md
[INFO] Running filter /Users/ian/.local/share/pandoc/filters/list-table.lua
[INFO] Completed filter /Users/ian/.local/share/pandoc/filters/list-table.lua in 43 ms
Encountered unassigned table cell
Exception: pandoc exited with 63

▶︎ pandoc -s --pdf-engine=xelatex -o list-table.pdf -L list-table.lua  --verbose list-table.md 
[INFO] Running filter /Users/ian/.local/share/pandoc/filters/list-table.lua
[INFO] Completed filter /Users/ian/.local/share/pandoc/filters/list-table.lua in 5 ms
[makePDF] temp dir: ... OK

list-table.lua throws version-number error when called via --filter, but works with --lua-filter

I did a bunch of trial and error, but this error message really threw me for a loop. Running

pandoc test.md -o test.pdf --filter ./list-table.lua

I get the error lua: /home/jules/.pandoc/lua_filters/list-table3.lua:8: pandoc version >=2.11 is required . (Needless to say, I am using a newer version.) The filter works as expected when calling it via:

pandoc test.md -o test.pdf --lua-filter ./list-table.lua

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.