public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Converting from Markdown to Markdown to add Bibliography
@ 2021-01-02 21:39 Tjorven Hetzger
       [not found] ` <f661af64-d28a-4c95-8444-0dc79d64d5aan-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Tjorven Hetzger @ 2021-01-02 21:39 UTC (permalink / raw)
  To: pandoc-discuss


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

Hi!

I have a markdown file with in-text citations in Pandoc markdown and want 
to use Pandoc to render these in-text citations and add a bibliography at 
the end of the file – nothing else should be changed.

This is the file I start with:
```
[[202012311200]]

# Title

This is a citation [@Mefferd2017, 200] and this is another one 
[@Kuenne2007, 7].

## References
```
The best outcome I have been able to achieve so far is this:
```
\[\[202012311200\]\]

# Title

This is a citation (Mefferd 2017, 200) and this is another one (Künne
2007, 7).

## References {#references .unnumbered}

Künne, Wolfgang. 2007. "Abstrakte Gegenstände -- Semantik Und
Ontologie." Book. Vittorio Klostermann.

Mefferd, Andrew. 2017. *The Greenhouse and Hoophouse Grower's Handbook
-- Organic Vegetable Production Using Protected Culture*. Chelsea Green
Publishing.
```
The command I used here (using the default .csl-style):
`pandoc --citeproc -t markdown-citations-fenced_divs-native_divs-raw_html`

Remaining issues:
- I don't want the brackets in the first line to be escaped.
- I don't want `{#references .unnumbered}`to appear next to the 
"References" heading.

Is there any way I can achieve this (e.g. by deactivating more extensions)?

-- 
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/f661af64-d28a-4c95-8444-0dc79d64d5aan%40googlegroups.com.

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

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

* Re: Converting from Markdown to Markdown to add Bibliography
       [not found] ` <f661af64-d28a-4c95-8444-0dc79d64d5aan-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2021-01-03 20:36   ` John MacFarlane
       [not found]     ` <m2r1n1ycyg.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: John MacFarlane @ 2021-01-03 20:36 UTC (permalink / raw)
  To: Tjorven Hetzger, pandoc-discuss

Tjorven Hetzger <thetzger-7y4VAllY4QU@public.gmane.org> writes:

> Hi!
>
> I have a markdown file with in-text citations in Pandoc markdown and want 
> to use Pandoc to render these in-text citations and add a bibliography at 
> the end of the file – nothing else should be changed.
>
> This is the file I start with:
> ```
> [[202012311200]]
>
> # Title
>
> This is a citation [@Mefferd2017, 200] and this is another one 
> [@Kuenne2007, 7].
>
> ## References
> ```
> The best outcome I have been able to achieve so far is this:
> ```
> \[\[202012311200\]\]
>
> # Title
>
> This is a citation (Mefferd 2017, 200) and this is another one (Künne
> 2007, 7).
>
> ## References {#references .unnumbered}
>
> Künne, Wolfgang. 2007. "Abstrakte Gegenstände -- Semantik Und
> Ontologie." Book. Vittorio Klostermann.
>
> Mefferd, Andrew. 2017. *The Greenhouse and Hoophouse Grower's Handbook
> -- Organic Vegetable Production Using Protected Culture*. Chelsea Green
> Publishing.
> ```
> The command I used here (using the default .csl-style):
> `pandoc --citeproc -t markdown-citations-fenced_divs-native_divs-raw_html`
>
> Remaining issues:
> - I don't want the brackets in the first line to be escaped.

The markdown writer generally escapes literal brackets, to
prevent them from inadvertently being treated as links.
Of course, in this case they wouldn't be, but that's something
you know and the writer doesn't.

You could avoid this by indicating that it's to be treated as
raw markdown and passed through verbatim:

`[[2020123111200]]`{=markdown}

But then of course it WILL change in translation, so that's
probably not what you want either.

> - I don't want `{#references .unnumbered}`to appear next to the 
> "References" heading.

Sorry, that's added automatically and there's no way to disable
it.

But both issues can be dealt with using Lua filters!

For the first issue, you'd write a filter that matches
Str elements with content `[[...]]` and transforms them into
RawInline (Format "markdown") elements.

For the second issue, you'd write a filter that removes
these heading attributes -- just make sure to apply it
after `--citeproc` on the command line.

-- 
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/m2r1n1ycyg.fsf%40johnmacfarlane.net.


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

* Re: Converting from Markdown to Markdown to add Bibliography
       [not found]     ` <m2r1n1ycyg.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
@ 2021-01-03 21:33       ` Tjorven Hetzger
  0 siblings, 0 replies; 3+ messages in thread
From: Tjorven Hetzger @ 2021-01-03 21:33 UTC (permalink / raw)
  To: pandoc-discuss


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

@John: That's good to know! I don't know anything about Lua filters, but 
will look into them. Thanks for putting me on that track!

On Sunday, 3 January 2021 at 20:37:12 UTC John MacFarlane wrote:

> Tjorven Hetzger <thet...-7y4VAllY4QU@public.gmane.org> writes:
>
> > Hi!
> >
> > I have a markdown file with in-text citations in Pandoc markdown and 
> want 
> > to use Pandoc to render these in-text citations and add a bibliography 
> at 
> > the end of the file – nothing else should be changed.
> >
> > This is the file I start with:
> > ```
> > [[202012311200]]
> >
> > # Title
> >
> > This is a citation [@Mefferd2017, 200] and this is another one 
> > [@Kuenne2007, 7].
> >
> > ## References
> > ```
> > The best outcome I have been able to achieve so far is this:
> > ```
> > \[\[202012311200\]\]
> >
> > # Title
> >
> > This is a citation (Mefferd 2017, 200) and this is another one (Künne
> > 2007, 7).
> >
> > ## References {#references .unnumbered}
> >
> > Künne, Wolfgang. 2007. "Abstrakte Gegenstände -- Semantik Und
> > Ontologie." Book. Vittorio Klostermann.
> >
> > Mefferd, Andrew. 2017. *The Greenhouse and Hoophouse Grower's Handbook
> > -- Organic Vegetable Production Using Protected Culture*. Chelsea Green
> > Publishing.
> > ```
> > The command I used here (using the default .csl-style):
> > `pandoc --citeproc -t 
> markdown-citations-fenced_divs-native_divs-raw_html`
> >
> > Remaining issues:
> > - I don't want the brackets in the first line to be escaped.
>
> The markdown writer generally escapes literal brackets, to
> prevent them from inadvertently being treated as links.
> Of course, in this case they wouldn't be, but that's something
> you know and the writer doesn't.
>
> You could avoid this by indicating that it's to be treated as
> raw markdown and passed through verbatim:
>
> `[[2020123111200]]`{=markdown}
>
> But then of course it WILL change in translation, so that's
> probably not what you want either.
>
> > - I don't want `{#references .unnumbered}`to appear next to the 
> > "References" heading.
>
> Sorry, that's added automatically and there's no way to disable
> it.
>
> But both issues can be dealt with using Lua filters!
>
> For the first issue, you'd write a filter that matches
> Str elements with content `[[...]]` and transforms them into
> RawInline (Format "markdown") elements.
>
> For the second issue, you'd write a filter that removes
> these heading attributes -- just make sure to apply it
> after `--citeproc` on the command line.
>

-- 
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/1e301c8a-5fc8-4eee-9d30-d88ce1cd160en%40googlegroups.com.

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

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

end of thread, other threads:[~2021-01-03 21:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-02 21:39 Converting from Markdown to Markdown to add Bibliography Tjorven Hetzger
     [not found] ` <f661af64-d28a-4c95-8444-0dc79d64d5aan-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-01-03 20:36   ` John MacFarlane
     [not found]     ` <m2r1n1ycyg.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
2021-01-03 21:33       ` Tjorven Hetzger

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