Comments (4)
We can always do this:
- Run
pandoc --to=json ...
- Pipe that to panflute
- Have a filter that can be applied to every element, creating the output
- Use panflute's
walk()
that goes through every element - Instead of dumping the data back into json, save it as a text file
That said, having a filter than parses every possible element is a lot of work, so for small changes it's always easy to piggyback on other writers.
from panflute.
I'm thinking about a Custom HTML writer, I can make an HTML filter (with XML tools), that fixes my output to the way I want but, I can't do that with latex, so the AST, it's the only common place I can get the document to output to HTML and Latex, this is why I'm considering having my own writer.
I know It might be heavy, but may be, a "partial writer", that takes certain formatted elements, and alters the AST in a way that Introduces the raw blocks that you need in the output for that case.
This sounds like the correct way, but also sounds kind of noisy.
May be, having another run that walks the tree, at the end of the filter application, that uses a config file that gives the matching rules for each panflute element, and the corresponding element in the output representation, that way we can write quick writers, this will limit the scope of what is doable, but still, I think It could work, just be thinking on how to implement the module, in a way that doesn't make noise the rest of the panflute functionality but that still uses the same structures.
from panflute.
I'm also interested in this. I intend to write a specific docx writer for our purposes, because the standard pandoc writer of docx is too limited. Particularly, I would like to use a template, where I insert certain metadata at the right locations. With python-docx
I can handle the necessary docx pushing, and I don't want to learn haskell :-).
@sergiocorreia: It would be great if you could elaborate a little more on your proposed workaround: How would you invoke panflute and pipe the json to it? I'm new to panflute, and did not find any information how to invoke panflute in any way other than as a filter, which means it will always go through another writer at the end, right?
from panflute.
from panflute.
Related Issues (20)
- Nav and other HTML5 elements missing
- How to skip a table? HOT 2
- Creating a Table without a Caption produces error HOT 1
- Creating a Panflute filter that interacts with other filters HOT 1
- Reimplement the panflute.stringify with native pandoc writer HOT 2
- Unable to get Panflute filter comments.py to work correctly HOT 1
- Add comparison method to Element class? HOT 2
- Compatibility with Pandoc 2.18 HOT 3
- Using panflute as a writer rather than a filter HOT 8
- Stringifying the terms of a definition list results in AttributeError HOT 7
- Hwo to use the span method? HOT 1
- Applying panflute filter multiple times generates an unexpected result
- Can't convert markdown style citations to LaTeX style using panflute filter HOT 5
- Navigation with next and prev unstable HOT 3
- Add space before footnote in stringify function HOT 4
- Is there solution to add custom style for lists with panflute ? HOT 2
- Avoid side-effects in walk
- Figure, Table: to_json() crashes if caption is None HOT 1
- Reading the value of `--resource-path` inside a panflute filter ? HOT 3
- Trying to create new metadata from metadata
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from panflute.