public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* raw attribute in Pandoc's native format?
@ 2021-08-04 14:15 Alessandro G.
       [not found] ` <2d57c016-1442-4793-9e30-efceb8668938n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Alessandro G. @ 2021-08-04 14:15 UTC (permalink / raw)
  To: pandoc-discuss


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

Hello, I am a new user. I apologize in advance should my question have 
already been covered (I did try searching) -- or make no sense! :)

Is it possible to use a raw attribute (raw_attribute extension) to express 
Pandoc's native format fragments? If yes, how?

As an example, Pandoc's native format allows this:
[Header 1 ("",[],[]) [Str "foo",LineBreak,Str "bar"]]
(note there is a "LineBreak" inside "Header")
for reference, this converts (as intended) to HTML as <h1>foo<br />bar</h1>

As far as I understand, it is not possible to express "LineBreak" inside 
"Header" via (simple) markdown (I might be wrong!), so I thought about 
raw_attribute.

So far I tried using variations (with/without commas) of
# foo`LineBreak`{=native}bar
but it did not work.

Thanks in advance! :)

-- 
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/2d57c016-1442-4793-9e30-efceb8668938n%40googlegroups.com.

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

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

* Re: raw attribute in Pandoc's native format?
       [not found] ` <2d57c016-1442-4793-9e30-efceb8668938n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2021-08-04 15:10   ` BPJ
       [not found]     ` <CADAJKhDZUOoxVnsu8nWfkt9abVjjYkfwdb-qZP+c9Y4RJRCyqA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: BPJ @ 2021-08-04 15:10 UTC (permalink / raw)
  To: pandoc-discuss

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

You can use raw HTML, or just a code span with some content which does not
otherwise occur in your code spans and replace that with a LineBreak
element with a filter.

``````markdown
## First line.`LB`Second line.
``````

``````lua
function Code (elem)
  if 'LB' == elem.text then
    return pandoc.LineBreak()
  end
  return nil
end
``````

HTH,

/bpj


Den ons 4 aug. 2021 16:16Alessandro G. <dreamwards-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> skrev:

> Hello, I am a new user. I apologize in advance should my question have
> already been covered (I did try searching) -- or make no sense! :)
>
> Is it possible to use a raw attribute (raw_attribute extension) to express
> Pandoc's native format fragments? If yes, how?
>
> As an example, Pandoc's native format allows this:
> [Header 1 ("",[],[]) [Str "foo",LineBreak,Str "bar"]]
> (note there is a "LineBreak" inside "Header")
> for reference, this converts (as intended) to HTML as <h1>foo<br
> />bar</h1>
>
> As far as I understand, it is not possible to express "LineBreak" inside
> "Header" via (simple) markdown (I might be wrong!), so I thought about
> raw_attribute.
>
> So far I tried using variations (with/without commas) of
> # foo`LineBreak`{=native}bar
> but it did not work.
>
> Thanks in advance! :)
>
> --
> 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/2d57c016-1442-4793-9e30-efceb8668938n%40googlegroups.com
> <https://groups.google.com/d/msgid/pandoc-discuss/2d57c016-1442-4793-9e30-efceb8668938n%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/CADAJKhDZUOoxVnsu8nWfkt9abVjjYkfwdb-qZP%2Bc9Y4RJRCyqA%40mail.gmail.com.

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

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

* Re: raw attribute in Pandoc's native format?
       [not found]     ` <CADAJKhDZUOoxVnsu8nWfkt9abVjjYkfwdb-qZP+c9Y4RJRCyqA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2021-08-05  9:55       ` Alessandro G.
  0 siblings, 0 replies; 3+ messages in thread
From: Alessandro G. @ 2021-08-05  9:55 UTC (permalink / raw)
  To: pandoc-discuss


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

Thanks! filtering is a good idea and very likely the best approach in such 
cases.
Mine was a rather borderline example, sorry - it was the best I could think 
of (based on a known limitation of markdown), I was mostly interested in 
the "general" question.

BTW, I did some further testing, so just for reference (should someone 
google this in the future):
to the best of my understanding "native" raw attributes are not actually 
"inserted" in the native AST (in the way, say, that html raw attributes are 
inserted into html) but left embedded in it as RawInline/RawBlock in the 
same way any other raw attribute is, for example:

`````markdown
`foo`{=native}
`bar`{=html} 
`baz`{=foobar}
````` 

gets converted to
`````native
[Para [RawInline (Format "native") "foo",SoftBreak,RawInline (Format 
"html") "bar",SoftBreak,RawInline (Format "foobar") "baz"]]
`````
(i.e. the native writer behaves in the same way no matter what the Format 
value is -- including nonexistent Format "foobar")

I think this is a very reasonable limitation, but in any case the current 
behavior can still be quite handy, since (as suggested by BP) it should be 
easy to filter the resulting RawInline (Format "native") elements (or, for 
example, Format "myproject").
On Wednesday, August 4, 2021 at 5:11:07 PM UTC+2 BP wrote:

> You can use raw HTML, or just a code span with some content which does not 
> otherwise occur in your code spans and replace that with a LineBreak 
> element with a filter.
>
> ``````markdown
> ## First line.`LB`Second line.
> ``````
>
> ``````lua
> function Code (elem)
>   if 'LB' == elem.text then
>     return pandoc.LineBreak()
>   end
>   return nil
> end
> ``````
>
> HTH,
>
> /bpj
>
>
> Den ons 4 aug. 2021 16:16Alessandro G. <dream...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> skrev:
>
>> Hello, I am a new user. I apologize in advance should my question have 
>> already been covered (I did try searching) -- or make no sense! :)
>>
>> Is it possible to use a raw attribute (raw_attribute extension) to 
>> express Pandoc's native format fragments? If yes, how?
>>
>> As an example, Pandoc's native format allows this:
>> [Header 1 ("",[],[]) [Str "foo",LineBreak,Str "bar"]]
>> (note there is a "LineBreak" inside "Header")
>> for reference, this converts (as intended) to HTML as <h1>foo<br 
>> />bar</h1>
>>
>> As far as I understand, it is not possible to express "LineBreak" inside 
>> "Header" via (simple) markdown (I might be wrong!), so I thought about 
>> raw_attribute.
>>
>> So far I tried using variations (with/without commas) of
>> # foo`LineBreak`{=native}bar
>> but it did not work.
>>
>> Thanks in advance! :)
>>
>> -- 
>> 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/2d57c016-1442-4793-9e30-efceb8668938n%40googlegroups.com 
>> <https://groups.google.com/d/msgid/pandoc-discuss/2d57c016-1442-4793-9e30-efceb8668938n%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/ca0ade0a-9d26-45e3-8976-af93c3e3c09en%40googlegroups.com.

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

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

end of thread, other threads:[~2021-08-05  9:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-04 14:15 raw attribute in Pandoc's native format? Alessandro G.
     [not found] ` <2d57c016-1442-4793-9e30-efceb8668938n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-08-04 15:10   ` BPJ
     [not found]     ` <CADAJKhDZUOoxVnsu8nWfkt9abVjjYkfwdb-qZP+c9Y4RJRCyqA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2021-08-05  9:55       ` Alessandro G.

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