public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Fenced code blocks in multiline tables
@ 2015-07-20 13:17 Ivan Lazar Miljenovic
       [not found] ` <CA+u6gbzerR6py_HuF1fw273NMPzT+sqH3pvw38vP=2p9sv7jrA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Ivan Lazar Miljenovic @ 2015-07-20 13:17 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

I'm trying to have a slide in my presentation where I compare two code samples.

I thought the best way of doing so would be to use a multiline table,
with a code block on either side.

The problem is that whilst the code block is accepted within the
multiline table, it doesn't seem to parse properly.

A sample table:

--------------------------------------------------------------------------------
     Regular Express                              Parser Combinators
---------------------------------  ---------------------------------------------
```haskell                              ```haskell
"\.\([[:alpha:]][[:alnum:]-_:\.]*\)"    identifier = do
```                                       first <- letter
                                          rest <- many $ alphaNum <|>
oneOf "-_:."
                                          return (first:rest)
                                        ```
--------------------------------------------------------------------------------

The output of running this through Pandoc and telling it to output the
Native Haskell representation is:

Table [] [AlignCenter,AlignCenter] [0.4375,0.5625]
 [[Plain [Str "Regular",Space,Str "Express"]]
 ,[Plain [Str "Parser",Space,Str "Combinators"]]]
 [[[Plain [Code ("",[],[]) "haskell \"\\.\\([[:alpha:]][[:alnum:]-_:\\.]*\\)"]]
  ,[Plain [Code ("",[],[]) "haskell \"    identifier = do first <-
letter rest <- many $ alphaNum <|> oneOf \"-_:.\" return
(first:rest)"]]]]

(Note that if I use ~ rather than ` for the code block, it instead
parses it as a subscript.)

If I try to manually create a table:

Table [] [AlignCenter,AlignCenter] [0.4375,0.5625]
[[Plain [Str "Regular",Space,Str "Express"]]
,[Plain [Str "Parser",Space,Str "Combinators"]]]
[[[Plain [Code ("",["haskell"],[]) "foo"]]
 ,[Plain [Code ("",["haskell"],[]) "identifier = do first <- letter\n
rest <- many $ alphaNum <|> oneOf \"-_:.\"\nreturn (first:rest)"]]]]

The resulting Markdown is then:

  ------------------------------------------------------------------------
          Regular Express                    Parser Combinators
  ------------------------------- ----------------------------------------
          `foo`{.haskell}             `identifier = do first <- letter
                                   rest <- many $ alphaNum <|> oneOf "-_:.
                                                     "
                                       return (first:rest)`{.haskell}
  ------------------------------------------------------------------------

(It isn't obvious from this snippet, but this table appears right
after the previous line, rather than leaving a blank line as required
for multiline tables.)

Is there any way to achieve what I want?

-- 
Ivan Lazar Miljenovic
Ivan.Miljenovic-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
http://IvanMiljenovic.wordpress.com


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

* Re: Fenced code blocks in multiline tables
       [not found] ` <CA+u6gbzerR6py_HuF1fw273NMPzT+sqH3pvw38vP=2p9sv7jrA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2015-07-20 17:07   ` kurt.pfeifle-gM/Ye1E23mwN+BqQ9rBEUg
  0 siblings, 0 replies; 2+ messages in thread
From: kurt.pfeifle-gM/Ye1E23mwN+BqQ9rBEUg @ 2015-07-20 17:07 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw


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

AFAIK, code blocks are supported in `grid_tables` only, not in any other 
table type.

I know `fenced_code_blocks` work within `grid_tables`, because I've made 
use of them in the past. 


Am Montag, 20. Juli 2015 15:17:37 UTC+2 schrieb Ivan Miljenovic:
>
> I'm trying to have a slide in my presentation where I compare two code 
> samples. 
>
> I thought the best way of doing so would be to use a multiline table, 
> with a code block on either side. 
>
> The problem is that whilst the code block is accepted within the 
> multiline table, it doesn't seem to parse properly. 
>
> A sample table: 
>
> -------------------------------------------------------------------------------- 
>
>      Regular Express                              Parser Combinators 
> --------------------------------- 
>  --------------------------------------------- 
> ```haskell                              ```haskell 
> "\.\([[:alpha:]][[:alnum:]-_:\.]*\)"    identifier = do 
> ```                                       first <- letter 
>                                           rest <- many $ alphaNum <|> 
> oneOf "-_:." 
>                                           return (first:rest) 
>                                         ``` 
> -------------------------------------------------------------------------------- 
>
>
> The output of running this through Pandoc and telling it to output the 
> Native Haskell representation is: 
>
> Table [] [AlignCenter,AlignCenter] [0.4375,0.5625] 
>  [[Plain [Str "Regular",Space,Str "Express"]] 
>  ,[Plain [Str "Parser",Space,Str "Combinators"]]] 
>  [[[Plain [Code ("",[],[]) "haskell 
> \"\\.\\([[:alpha:]][[:alnum:]-_:\\.]*\\)"]] 
>   ,[Plain [Code ("",[],[]) "haskell \"    identifier = do first <- 
> letter rest <- many $ alphaNum <|> oneOf \"-_:.\" return 
> (first:rest)"]]]] 
>
> (Note that if I use ~ rather than ` for the code block, it instead 
> parses it as a subscript.) 
>
> If I try to manually create a table: 
>
> Table [] [AlignCenter,AlignCenter] [0.4375,0.5625] 
> [[Plain [Str "Regular",Space,Str "Express"]] 
> ,[Plain [Str "Parser",Space,Str "Combinators"]]] 
> [[[Plain [Code ("",["haskell"],[]) "foo"]] 
>  ,[Plain [Code ("",["haskell"],[]) "identifier = do first <- letter\n 
> rest <- many $ alphaNum <|> oneOf \"-_:.\"\nreturn (first:rest)"]]]] 
>
> The resulting Markdown is then: 
>
>   ------------------------------------------------------------------------ 
>           Regular Express                    Parser Combinators 
>   ------------------------------- ---------------------------------------- 
>           `foo`{.haskell}             `identifier = do first <- letter 
>                                    rest <- many $ alphaNum <|> oneOf "-_:. 
>                                                      " 
>                                        return (first:rest)`{.haskell} 
>   ------------------------------------------------------------------------ 
>
> (It isn't obvious from this snippet, but this table appears right 
> after the previous line, rather than leaving a blank line as required 
> for multiline tables.) 
>
> Is there any way to achieve what I want? 
>
> -- 
> Ivan Lazar Miljenovic 
> Ivan.Mi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <javascript:> 
> http://IvanMiljenovic.wordpress.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 post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/a3ca45a7-badb-4147-8ffd-d9227b870adb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

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

end of thread, other threads:[~2015-07-20 17:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-20 13:17 Fenced code blocks in multiline tables Ivan Lazar Miljenovic
     [not found] ` <CA+u6gbzerR6py_HuF1fw273NMPzT+sqH3pvw38vP=2p9sv7jrA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-07-20 17:07   ` kurt.pfeifle-gM/Ye1E23mwN+BqQ9rBEUg

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