public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* include external source file
@ 2012-03-14 13:29 Christopher League
  2012-03-14 17:00 ` fiddlosopher
  2012-03-14 18:16 ` Joost Kremers
  0 siblings, 2 replies; 4+ messages in thread
From: Christopher League @ 2012-03-14 13:29 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

[-- Attachment #1: Type: text/plain, Size: 1213 bytes --]

Greetings,

I use pandoc/yst for course web sites in computer science, and I'd love to 
have a way to include and syntax-highlight an external source file. We have 
an equivalent of the latex listings *environment,* but not (as far as I 
know) of the \lstinputlisting{} command. It should quote necessary 
characters too. I'm forever inserting chunks of code using emacs, and then 
forgetting to quote the dollars and backslashes.

I can code Haskell, and contributed a small feature to yst in the past. But 
I'm looking for advice or direction from the community about how to 
approach this from the user's end. Does anyone else need this? Are there 
workarounds I missed?

Thanks,
Chris

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To view this discussion on the web visit https://groups.google.com/d/msg/pandoc-discuss/-/q_wtl9EWmV0J.
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at http://groups.google.com/group/pandoc-discuss?hl=en.


[-- Attachment #2: Type: text/html, Size: 1450 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: include external source file
  2012-03-14 13:29 include external source file Christopher League
@ 2012-03-14 17:00 ` fiddlosopher
  2012-03-21  1:44   ` Christopher League
  2012-03-14 18:16 ` Joost Kremers
  1 sibling, 1 reply; 4+ messages in thread
From: fiddlosopher @ 2012-03-14 17:00 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

[-- Attachment #1: Type: text/plain, Size: 1546 bytes --]

On Wednesday, March 14, 2012 6:29:20 AM UTC-7, Christopher League wrote:
>
> Greetings,
>
> I use pandoc/yst for course web sites in computer science, and I'd love to 
> have a way to include and syntax-highlight an external source file. We have 
> an equivalent of the latex listings *environment,* but not (as far as I 
> know) of the \lstinputlisting{} command. It should quote necessary 
> characters too. I'm forever inserting chunks of code using emacs, and then 
> forgetting to quote the dollars and backslashes.
>
> I can code Haskell, and contributed a small feature to yst in the past. 
> But I'm looking for advice or direction from the community about how to 
> approach this from the user's end. Does anyone else need this? Are there 
> workarounds I missed?
>

This might be relevant: 
http://johnmacfarlane.net/pandoc/scripting.html#include-files (and look at 
the section on "Pandoc 1.9 changes" for a more modern way of doing this).

It would be relatively easy to build a feature like this into yst.

 

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To view this discussion on the web visit https://groups.google.com/d/msg/pandoc-discuss/-/EQxPvO30vNIJ.
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at http://groups.google.com/group/pandoc-discuss?hl=en.


[-- Attachment #2: Type: text/html, Size: 1909 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: include external source file
  2012-03-14 13:29 include external source file Christopher League
  2012-03-14 17:00 ` fiddlosopher
@ 2012-03-14 18:16 ` Joost Kremers
  1 sibling, 0 replies; 4+ messages in thread
From: Joost Kremers @ 2012-03-14 18:16 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

On Wed, Mar 14, 2012 at 06:29:20AM -0700, Christopher League wrote:
> I can code Haskell, and contributed a small feature to yst in the past. But 
> I'm looking for advice or direction from the community about how to 
> approach this from the user's end. Does anyone else need this? Are there 
> workarounds I missed?

Well, if you can code Haskell you'll probably prefer John's suggestion, but
since you use Emacs, I thought I'd mention in anyway: pandoc-mode has the
ability to include external files into a document before sending it off to
pandoc. It doesn't escape anything, as it assumes that the included file is
in the same format as the master file, but if you know a little Elisp, it
should be fairly simple to write your own include function that does the
necessary escaping.

-- 
Joost Kremers
Life has its moments


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: include external source file
  2012-03-14 17:00 ` fiddlosopher
@ 2012-03-21  1:44   ` Christopher League
  0 siblings, 0 replies; 4+ messages in thread
From: Christopher League @ 2012-03-21  1:44 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

[-- Attachment #1: Type: text/plain, Size: 2300 bytes --]

Thanks, guys. After looking at the code for both pandoc and yst, and the 
tips on pandoc scripting, I think my approach will be to build a hook into 
yst so it can process the Pandoc AST using any external program via a JSON 
filter. For example, say "preprocess: runhaskell includeCode.hs" in 
config.yaml, and then it will run that command line between reading the .st 
and writing the output format.

Actually, maybe it should be called postprocess since it looks like 
markdown parsing comes after string-template interpretation.

Anyway, this would provide flexibility for all sorts of other operations 
apart from including files.

Thanks,
Chris

On Wednesday, March 14, 2012 1:00:16 PM UTC-4, fiddlosopher wrote:
>
> On Wednesday, March 14, 2012 6:29:20 AM UTC-7, Christopher League wrote:
>>
>> Greetings,
>>
>> I use pandoc/yst for course web sites in computer science, and I'd love 
>> to have a way to include and syntax-highlight an external source file. We 
>> have an equivalent of the latex listings *environment,* but not (as far 
>> as I know) of the \lstinputlisting{} command. It should quote necessary 
>> characters too. I'm forever inserting chunks of code using emacs, and then 
>> forgetting to quote the dollars and backslashes.
>>
>> I can code Haskell, and contributed a small feature to yst in the past. 
>> But I'm looking for advice or direction from the community about how to 
>> approach this from the user's end. Does anyone else need this? Are there 
>> workarounds I missed?
>>
>
> This might be relevant: 
> http://johnmacfarlane.net/pandoc/scripting.html#include-files (and look 
> at the section on "Pandoc 1.9 changes" for a more modern way of doing this).
>
> It would be relatively easy to build a feature like this into yst.
>
>  
>

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To view this discussion on the web visit https://groups.google.com/d/msg/pandoc-discuss/-/2hb25F0sn7cJ.
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at http://groups.google.com/group/pandoc-discuss?hl=en.


[-- Attachment #2: Type: text/html, Size: 2935 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-03-21  1:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-14 13:29 include external source file Christopher League
2012-03-14 17:00 ` fiddlosopher
2012-03-21  1:44   ` Christopher League
2012-03-14 18:16 ` Joost Kremers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).