public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* markdown to LaTeX environments
@ 2020-10-19 15:36 cha...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
       [not found] ` <f93ed7f6-9e25-4dce-bbe0-f9e2d726b190n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: cha...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org @ 2020-10-19 15:36 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 578 bytes --]

Is there a way to customize the markdown -> LaTeX translation so a block 
like:

~~~java
...
~~~

gets translated into something like:

\begin{java}
...
\end{java}

?

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/f93ed7f6-9e25-4dce-bbe0-f9e2d726b190n%40googlegroups.com.

[-- Attachment #1.2: Type: text/html, Size: 1012 bytes --]

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

* Re: markdown to LaTeX environments
       [not found] ` <f93ed7f6-9e25-4dce-bbe0-f9e2d726b190n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2020-10-19 19:05   ` BPJ
  2020-10-19 22:59   ` John MacFarlane
  1 sibling, 0 replies; 4+ messages in thread
From: BPJ @ 2020-10-19 19:05 UTC (permalink / raw)
  To: pandoc-discuss

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

This Lua filter should do the trick:

``````lua
local jbegin = "\\begin{java}\n"
local jend = "\\end{java}\n"
function CodeBlock (cb)
  if cb.classes:includes('java') then
    return pandoc.RawBlock('latex', jbegin .. cb.text .. jend)
  end
  return nil
end
``````

This is easy just because both a code block and a raw block are both
basically a string.

-- 
Better --help|less than helpless

Den mån 19 okt. 2020 17:37cha...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <charpov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> skrev:

> Is there a way to customize the markdown -> LaTeX translation so a block
> like:
>
> ~~~java
> ...
> ~~~
>
> gets translated into something like:
>
> \begin{java}
> ...
> \end{java}
>
> ?
>
> --
> You received this message because you are subscribed to the Google Groups
> "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pandoc-discuss/f93ed7f6-9e25-4dce-bbe0-f9e2d726b190n%40googlegroups.com
> <https://groups.google.com/d/msgid/pandoc-discuss/f93ed7f6-9e25-4dce-bbe0-f9e2d726b190n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhCdSR0eK0WEM1D%2BCAi6SQmNvtYwQ4kL7VUhh%2BChq-4W8g%40mail.gmail.com.

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

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

* Re: markdown to LaTeX environments
       [not found] ` <f93ed7f6-9e25-4dce-bbe0-f9e2d726b190n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  2020-10-19 19:05   ` BPJ
@ 2020-10-19 22:59   ` John MacFarlane
       [not found]     ` <m2tuupvn3c.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
  1 sibling, 1 reply; 4+ messages in thread
From: John MacFarlane @ 2020-10-19 22:59 UTC (permalink / raw)
  To: cha...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, pandoc-discuss


Yes, this can be done with filters fairly easily.
Question 1:  Are the contents of the environment supposed to
be interpreted as markdown or just passed through literally?

"cha...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <charpov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

> Is there a way to customize the markdown -> LaTeX translation so a block 
> like:
>
> ~~~java
> ...
> ~~~
>
> gets translated into something like:
>
> \begin{java}
> ...
> \end{java}
>
> ?
>
> -- 
> You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/f93ed7f6-9e25-4dce-bbe0-f9e2d726b190n%40googlegroups.com.


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

* Re: markdown to LaTeX environments
       [not found]     ` <m2tuupvn3c.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
@ 2020-10-20 11:44       ` cha...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
  0 siblings, 0 replies; 4+ messages in thread
From: cha...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org @ 2020-10-20 11:44 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 1663 bytes --]

Passed through literally.  I'm working on a document from which I only plan 
to generate LaTeX.  I guess I could write \begin{java}/\end{java} directly 
in the markdown.  ~~~java is easier (and I have a lot written that way 
already).

On Monday, October 19, 2020 at 6:59:53 PM UTC-4 John MacFarlane wrote:

>
> Yes, this can be done with filters fairly easily.
> Question 1: Are the contents of the environment supposed to
> be interpreted as markdown or just passed through literally?
>
> "cha...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <cha...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
>
> > Is there a way to customize the markdown -> LaTeX translation so a block 
> > like:
> >
> > ~~~java
> > ...
> > ~~~
> >
> > gets translated into something like:
> >
> > \begin{java}
> > ...
> > \end{java}
> >
> > ?
> >
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups "pandoc-discuss" group.
> > To unsubscribe from this group and stop receiving emails from it, send 
> an email to pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/pandoc-discuss/f93ed7f6-9e25-4dce-bbe0-f9e2d726b190n%40googlegroups.com
> .
>

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/83bef2be-e28a-402c-bb32-1df323279b00n%40googlegroups.com.

[-- Attachment #1.2: Type: text/html, Size: 2841 bytes --]

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

end of thread, other threads:[~2020-10-20 11:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-19 15:36 markdown to LaTeX environments cha...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
     [not found] ` <f93ed7f6-9e25-4dce-bbe0-f9e2d726b190n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2020-10-19 19:05   ` BPJ
2020-10-19 22:59   ` John MacFarlane
     [not found]     ` <m2tuupvn3c.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
2020-10-20 11:44       ` cha...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

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).