Giter Club home page Giter Club logo

columns's People

Contributors

jdutant avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

columns's Issues

Error in columns.lua with Pandoc 2.6

Hello,

Thanks for this filter which seems complete.

While testing with the README.md and running the command make, pandoc throws this error :

$ make
pandoc --lua-filter columns.lua --standalone --output expected.html README.md
Error running filter columns.lua:
attempt to index a nil value
stack traceback:
        [C]: in metamethod '__index'
        columns.lua:393: in upvalue 'convert_explicit_columbreaks'
        columns.lua:583: in function <columns.lua:578>
        (...tail calls...)
make: *** [expected.html] Error 83

I think there is a missing condition at the lines https://github.com/jdutant/columns/blob/master/columns.lua#L393-L394

Here is my proposal:

# https://github.com/jdutant/columns/blob/master/columns.lua#L393-L394
-  if elem.content[#elem.content] and elem.content[#elem.content].classes
-    and elem.content[#elem.content].classes:includes('column') then
+    if elem.content[#elem.content]
+    and elem.content[#elem.content].t == 'Div'
+    and elem.content[#elem.content].classes
+    and elem.content[#elem.content].classes:includes('column') then

The main addition here is that we now check if the element is a Div. After adding that, everything works fine

Can I submit a pull request with that change?

Thanks

Add option for ragged columns in LaTeX

I'm using your script to generate a PDF of a recipe collection in markdown. Ingredients are in two columns and the cooking instructions follows in one column layout.

Sometimes the list of ingredients does not fit evenly in two columns and LaTeX fills up with vertical space (too much white space in right column):
image

By inserting

\vspace*{\fill}

before \end{multicols} I can get my desired result (see this SO thread):

image

It would be nice to have an option to not layout column text in the entire column height. This would insert \vspace*{\vfill} before \columnbreak (for left column) and \end{multicols} (for right column).

Handle floats and float placement

Possibly a job for a separate filter. From Bastien Dumont (https://groups.google.com/g/pandoc-discuss/c/JxV3nF_igdw):

I noticed one problem though: LaTeX always places on top of the page full-width figures in a multicolumn environment. It means that the stream will be broken after the figure, as this document will show:

\documentclass{article}
\usepackage{multicol}
\usepackage{lipsum}

\begin{document}

\begin{multicols}{2}
\lipsum[1-7]
\end{multicols}

\begin{figure}
\begin{quote}
\lipsum[8]
\end{quote}
\end{figure}

\begin{multicols}{2}
\lipsum[1-7]
\end{multicols}

\end{document}

If you only want to make all figures span the entire width in a two-column layout, you can simply add this in the metadata block of your document (without changing anything in the command-line):

header-includes: |
  \renewenvironment{figure}{\begin{figure*}}{\end{figure*}}

However, the limitation regarding the figures' placement will still apply.

Error in columns.lua with Pandoc 2.5

While testing with README.md and make, pandoc throws some errors like :

Error running filter columns.lua:
columns.lua:71: attempt to call a nil value (method 'insert')
stack traceback:
        columns.lua:71: in function <columns.lua:53>
        (...tail calls...)

It seems to be due to an import error with pandoc.List

handle columns markup in two-column mode

Check whether the class option "twocolumn" is set. If so, handle column breaks and column spans in the document and (optionally) generate HTML output with two columns. Provide a global two-columns option that sets the class option twocolumn.

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.