public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: BPJ <melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: pandoc-discuss <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Subject: Re: Single and double quotes in Context with British English
Date: Wed, 2 Aug 2023 21:33:00 +0200	[thread overview]
Message-ID: <CADAJKhCx=xbPgcQF7EQef4keqpiV+jNywXoPf=LpAaBL+hYefQ@mail.gmail.com> (raw)
In-Reply-To: <a1f39c5a-624a-48d7-af9a-d4b7dd66f3bbn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>

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

You can swap single/double quotes in the Pandoc AST with a simple filter:

``````lua
local swap = {
  DoubleQuote = 'SingleQuote',
  SingleQuote = 'DoubleQuote'
}
function Quoted (elem)
  elem.quotetype = swap[elem.quotetype]
  return elem
end
``````

Den ons 2 aug. 2023 19:59Thomas Hodgson <thomas.hodgson-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> skrev:

> I wonder whether it would be feasible/desirable for the Context writer to
> change its mapping from DoubleQuote/SingleQuote to `\quotation`/`\quote`
> based on the language of the document? (And the same for
> `\enquote`/`\enquote*` for LaTeX.)
>
> On Wednesday, 2 August 2023 at 18:27:38 UTC+2 Thomas Hodgson wrote:
>
>> Thank you.
>>
>> I tried this (included in my header) and I get the result I want visually
>> in the PDF:
>>
>> ```
>> \setuplanguage[en-gb][
>>   leftquotation=“,
>>   rightquotation=”,
>>   leftquote=‘,
>>   rightquote=’,
>> ]
>> ```
>>
>> On Wednesday, 2 August 2023 at 16:55:36 UTC+2 Bastien DUMONT wrote:
>>
>>> As you saw in the ConTeXt outputs, whatever language you set in the
>>> metadata, Pandoc will always identify double quotes as primary quotes and
>>> single quotes as secondary quotes. How they are rendered in PDF depends on
>>> ConTeXt. To alter the rendering of British English, you will need to use
>>> the macro \setuplanguage (
>>> https://wiki.contextgarden.net/Command/setuplanguage).
>>>
>>> Le Wednesday 02 August 2023 à 07:10:40AM, Thomas Hodgson a écrit :
>>> > When I have a markdown file like this:
>>> >
>>> > ```
>>> > 'foo'
>>> > "bar"
>>> > ```
>>> >
>>> > The result of `pandoc --to=context foo.md` is `\quote{foo}
>>> \quotation{bar}`.
>>> > The result of `pandoc --to=context --output=foo.pdf foo.md` is what I
>>> would
>>> > expect: single quotes around 'foo' and double quotes around 'bar'. The
>>> output
>>> > of `pandoc --metadata=lang:en-GB --to=context foo.md` is the same.
>>> But, the
>>> > output of `pandoc --metadata=lang:en-GB --to=context --output=foo.pdf
>>> foo.md`
>>> > has double quotes around 'foo' and single quotes around 'bar'.
>>> >
>>> > I could solve this by using double quotes where I want single, and
>>> vice versa.
>>> > But that will give the wrong result for HTML from the same source.
>>> Also, I'm
>>> > sure that I would forget half the time.
>>> >
>>> > I assume that this happens because Pandoc treats the double quote as
>>> the 'top'
>>> > level of quotes, which in US English is a double quote and in UK
>>> English (in
>>> > this case, confusingly) is a single quote. I don't think it's a bug,
>>> therefore.
>>> >
>>> > I think that the same thing happens with csquotes and LaTeX. But there
>>> I don't
>>> > turn on csquotes.
>>> >
>>> > Is there some way to get the behaviour I want while still using
>>> British
>>> > English?
>>> >
>>> > --
>>> > 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 [1]pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>>> > To view this discussion on the web visit [2]
>>> https://groups.google.com/d/msgid/
>>> > pandoc-discuss/6bf5b865-b98a-4eab-ac15-9ca58d38e6cfn%
>>> 40googlegroups.com.
>>> >
>>> > References:
>>> >
>>> > [1] mailto:pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
>>> > [2]
>>> https://groups.google.com/d/msgid/pandoc-discuss/6bf5b865-b98a-4eab-ac15-9ca58d38e6cfn%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/a1f39c5a-624a-48d7-af9a-d4b7dd66f3bbn%40googlegroups.com
> <https://groups.google.com/d/msgid/pandoc-discuss/a1f39c5a-624a-48d7-af9a-d4b7dd66f3bbn%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/CADAJKhCx%3DxbPgcQF7EQef4keqpiV%2BjNywXoPf%3DLpAaBL%2BhYefQ%40mail.gmail.com.

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

  parent reply	other threads:[~2023-08-02 19:33 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-02 14:10 Thomas Hodgson
     [not found] ` <6bf5b865-b98a-4eab-ac15-9ca58d38e6cfn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2023-08-02 14:55   ` Bastien DUMONT
2023-08-02 16:27     ` Thomas Hodgson
     [not found]       ` <a416671d-1c67-4f4b-97c4-24b18e440466n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2023-08-02 17:57         ` Thomas Hodgson
     [not found]           ` <a1f39c5a-624a-48d7-af9a-d4b7dd66f3bbn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2023-08-02 18:19             ` Bastien DUMONT
2023-08-02 18:54               ` Thomas Hodgson
     [not found]                 ` <1513fe42-80ad-4acd-bb53-85a04ed52a7cn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2023-08-02 19:23                   ` Bastien DUMONT
2023-08-02 20:26                   ` Pablo Rodríguez
     [not found]                     ` <8e63fe5e-de8b-1bdb-27d7-60fab49f2b7b-S0/GAf8tV78@public.gmane.org>
2023-08-03  9:46                       ` Thomas Hodgson
     [not found]                         ` <d9bcf5be-c7f3-4225-ab9e-0d4cdc8de1e6n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2023-08-03 10:16                           ` Bastien DUMONT
2023-08-03 14:23                             ` Thomas Hodgson
2023-08-02 19:33             ` BPJ [this message]
2023-08-02 17:50   ` Pablo Rodríguez
     [not found]     ` <fc349c18-6989-67be-6a64-e701b4a06d16-S0/GAf8tV78@public.gmane.org>
2023-08-02 18:54       ` Thomas Hodgson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CADAJKhCx=xbPgcQF7EQef4keqpiV+jNywXoPf=LpAaBL+hYefQ@mail.gmail.com' \
    --to=melroch-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).