manubot / rootstock

Clone me to create your Manubot manuscript
https://manubot.github.io/rootstock/
Other
454 stars 179 forks source link

data-generated tables #350

Open brian-bot opened 4 years ago

brian-bot commented 4 years ago

Forgive me if this is a naive question (I'm new to pandoc and manubot) - but I was wondering if there is a way that tables can be generated from data files (either delimited files or json/yaml) as can be done with jekyll (https://jekyllrb.com/docs/datafiles/). Any suggestions?

Thanks in advance!

dhimmel commented 4 years ago

I was wondering if there is a way that tables can be generated from data files

Unfortunately, there is no built-in Pandoc support for this. It would be a nice feature for Manubot, because we want data to be defined in one and only one place.

Some comments on solutions in https://github.com/manubot/rootstock/issues/339. There are Pandoc filters like pandoc-placetable that enable tables from CSV URLs. You'd have to install a haskel package on CI, which would be possible but perhaps not super easy.

So I think this is something you could add to a Manubot manuscript, but it would require a bit of customization.

brian-bot commented 4 years ago

Thanks for the note, Daniel - appreciate the response. I'll update this issue if I come up with a customized solution.

agitter commented 4 years ago

You'd have to install a haskel package on CI, which would be possible but perhaps not super easy.

If you do pursue the pandoc-placetable option and need to install a Haskell package in the GitHub Actions workflow, the actions/setup-haskell can simplify the process. You can check https://github.com/agitter/my-manuscript/pull/16 for an example. The two steps I added are:

      - name: Setup Haskell
        uses: actions/setup-haskell@v1.1
      - name: Test Haskell
        run: |
          cabal update
          cabal install pandoc-placetable

It looks like it installs pandoc-placetable correctly, but I didn't actually test the Pandoc filter.

dhimmel commented 4 years ago

I didn't actually test the Pandoc filter.

@brian-bot the place you'd want to add the filter would be at:

https://github.com/manubot/rootstock/blob/adc7b8bca102594d8e7d46d93071c4018f0c6944/build/pandoc/defaults/common.yaml#L4-L9

I think you'd want to add - pandoc-placetable. the order won't matter unless there is some interaction.