Git Product home page Git Product logo

Comments (8)

sergiocorreia avatar sergiocorreia commented on July 21, 2024

I just pushed a fix that should work, but since I had to touch several parts of the code I wouldn't be surprised if I missed something.

BTW, TravisCI is failing right now because I can't get pandoc to install on their docker containers, but the tests are passing on my side

from panflute.

ickc avatar ickc commented on July 21, 2024

I recently have experimented quite a few different ways of setting up travis for pandoc project. Do you want me to pull request on the travis setup? (and you want sudo = false, right?)

from panflute.

sergiocorreia avatar sergiocorreia commented on July 21, 2024

Yes, I think sudo=false is by default in TravisCI. My current build is quite simple, but feel free to send me any PR if you see anything that can be improved (this is the first time I've used Travis).

I also suspect there's a bug that pops up only in some systems and that might be picked up by Travis in this case. I need to change the JSON loading code to fix that for good, but that would probably wait a few days unless you or someone else spot that bug on the field (so it's not only Travis's specific config that gives the bug)

from panflute.

ickc avatar ickc commented on July 21, 2024

I just pushed a fix that should work, but since I had to touch several parts of the code I wouldn't be surprised if I missed something.

I tried updating panflute, but the version is still 1.4.2. By the way, can you provide a quicker way to check version like the attribute panflute.__version__?

Thanks.

from panflute.

ickc avatar ickc commented on July 21, 2024

I can confirm 1.4.3 works. I installed using pip install git+git://github.com/sergiocorreia/panflute.git. It's still 1.4.2 in panflute 1.4.2 : Python Package Index.

from panflute.

sergiocorreia avatar sergiocorreia commented on July 21, 2024

Having a .version variable makes sense; I'll probably follow suggestion 3 of this link

from panflute.

ickc avatar ickc commented on July 21, 2024

I think this one need to reopen:

from panflute import *
x = [Para(Str('Something')), Para(Space, Str('else'))]
c1 = TableCell(*x)
c2 = TableCell(Header(Str('Title')))
rows = [TableRow(c1, c2)]
table = Table(*rows, header=None)
print(convert_text([table], input_format='panflute', output_format='native'))

will output

[Table [] [AlignDefault,AlignDefault] [0.0,0.0]
 []
 [[[Para [Str "Something"]
   ,Para [Space,Str "else"]]
  ,[Header 1 ("",[],[]) [Str "Title"]]]]]

Notice the 2nd line is an empty "list". pandoc seems to parse this just fine. But the problem is when this is passed to panflute, panflute will complain IndexError: table header has an incorrect number of cols: 0 rows but expected 2.

And in the case when pandoc has no header row, it will output a "list" of "list" that looks like this:

 [[]
 ,[]]

So even if pandoc is fine with [], a list of empty lists might be better because it is what pandoc output, and because this is what "panflute requires".

from panflute.

sergiocorreia avatar sergiocorreia commented on July 21, 2024

Just submitted a fix:

  • The bug was in converting the table to json. Now it prints the list of empty lists.
  • I also allow convert_text(elem) where elem is any arbitrary panflute element (so you don't have to wrap it in a list.
  • Also added a test case for this

from panflute.

Related Issues (20)

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.