Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
Hey guys, I tried to use Asciidoctor as converter for my static site generator which I am implementing in python3. Since there is no wrapper module for it, I tried to call Asciidoctor via subprocess. Popen which works quite fine when I give it the filename of my sourcefile. However I need Asciidoctor to accept a string from my program and tried to use stdin as it was shown in the documentation. Since I never got any results I played a little with the cli and discovered that even the example from the documentation does not work when I run it from bash. Am I doing something wrong since copy&paste from the docs should work (at least that is what I think ;) ). My python function running Asciidoctor: def generate_html(filecontent): command = ["asciidoctor", "-s", "-o", "-"] filecontent = filecontent.encode() with Popen(command, stdin=PIPE, stdout=PIPE) as p: return p.communicate(input=filecontent)[0] I am running:
Does anybody know of this and can me help out? If you need any further information I am happy to help. Cheers, |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
Administrator
|
The example of the documentation is missing the second `-`. The first `-` goes with the `-o` to say "output to stdout". The second `-` means take from stdin. However, technically you don't need `-o -` in this case since taking from stdin goes to stdout by default. This should do the trick: $ asciidoctor -s - I'll update the example in the docs. -Dan On Thu, Mar 2, 2017 at 1:54 PM, mirodin [via Asciidoctor :: Discussion] <[hidden email]> wrote:
... [show rest of quote] Dan Allen | @mojavelinux | https://twitter.com/mojavelinux |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
Hi Dan,
thank you so much for your fast and perfect answer, I really appreciate it. As I see in the docs you included my use case as well ;) Cheers, Tristan |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
Administrator
|
You're welcome, Tristan! Cheers, -Dan On Fri, Mar 3, 2017 at 5:22 AM, mirodin [via Asciidoctor :: Discussion] <[hidden email]> wrote: Hi Dan, Dan Allen | @mojavelinux | https://twitter.com/mojavelinux |
Free forum by Nabble | Edit this page |