Search code examples
htmlquartolang

How to get swiss quotation marks for a html website with rmarkdown/quarto


I try to get swiss quotation marks («text») in a markdown (quarto) document.

My _quarto.yml looks like that:

project:
  title: "quotes"

book: 
  chapters: 
    - index.qmd
  
format: 
  html:
    lang: de-CH
    css: style.css

The styles.css like that:

html[lang="de-CH"] q {
  quotes: '«' '»' '‹' '›';
}

The index.qmd looks like this:

# Quotation Test

"Quotation please!"

But after rendering it looks always like this

enter image description here

I have tried it with:

  • only: q {quotes: '«' '»' '‹' '›';} in the styles.css,

  • lang: with and without quotes in the yaml,

  • and using only de instead of de-CH

I always get the english quotation marks.


Solution

  • Here is a way using pandoc lua filter for quotations. The raw code for the filter can be found here (you have to copy that code into a newly created file in your project called pandoc-quotation.lua).

    ---
    format: html
    filters: [pandoc-quotation.lua]
    quot-lang: de-CH
    ---
    
    # Quotation Test
    
    "Quotation please!"
    
    'Small quotation please!'
    

    enter image description here

    A full list of potential quotations:

        ar          = {'”',  '“',     '’',  '‘'    },
        bs          = {'”',  '”',     '’',  '’'    },
        bo          = {'「', '」',     '『', '』'    },
        bs          = {'”',  '”',     '’',  '’'    },
        cn          = {'「', '」',     '『', '』'    },
        cs          = {'„',  '“',     '‚',  '‘'    },
        cy          = {'‘',  '’',     '“',  '”'    },
        da          = {'»',  '«',     '›',  '‹'    },
        de          = {'„',  '“',     '‚',  '‘'    },
        ['de-CH']   = {'«',  '»',     '‹',  '›'    },
        el          = {'«',  '»',     '“',  '”'    },
        en          = {'“',  '”',     '‘',  '’'    },
        ['en-US']   = {'“',  '”',     '‘',  '’'    },
        ['en-GB']   = {'‘',  '’',     '“',  '”'    },
        ['en-UK']   = {'‘',  '’',     '“',  '”'    },
        ['en-CA']   = {'“',  '”',     '‘',  '’'    },
        eo          = {'“',  '”',     '‘',  '’'    },
        es          = {'«',  '»',     '“',  '”'    },
        et          = {'„',  '“',     '‚',  '‘'    },
        fi          = {'”',  '”',     '’',  '’'    },
        fil         = {'“',  '”',     '‘',  '’'    },
        fa          = {'«',  '»',     '‹',  '›'    },
        fr          = {'«',  '»',     '‹',  '›'    },
        ga          = {'“',  '”',     '‘',  '’'    },
        gd          = {'‘',  '’',     '“',  '”'    },
        gl          = {'«',  '»',     '‹',  '›'    },
        he          = {'“',  '”',     '‘',  '’'    },
        hi          = {'“',  '”',     '‘',  '’'    },
        hu          = {'„',  '”',     '»',  '«'    },
        hr          = {'„',  '“',     '‚',  '‘'    },
        ia          = {'“',  '”',     '‘',  '’'    },
        id          = {'“',  '”',     '‘',  '’'    },
        is          = {'„',  '“',     '‚',  '‘'    },
        it          = {'«',  '»',     '“',  '”'    },
        ['it-CH']   = {'«',  '»',     '‹',  '›'    },
        ja          = {'「', '」',    '『',  '』'    },
        jbo         = {'lu', 'li\'u', 'lu', 'li\'u'},
        ka          = {'„',  '“',     '‚',  '‘'    },
        khb         = {'《', '》',    '〈',  '〉'    },
        kk          = {'«',  '»',     '‹',  '›'    },
        km          = {'«',  '»',     '‹',  '›'    },
        ko          = {'《', '》',    '〈',  '〉'    },
        ['ko-KR']   = {'“',  '”',     '‘',  '’'    },
        lt          = {'„',  '“',     '‚',  '‘'    },
        lv          = {'„',  '“',     '‚',  '‘'    },
        lo          = {'«',  '»',     '‹',  '›'    },
        nl          = {'„',  '”',     '‚',  '’'    },
        mk          = {'„',  '“',     '’',  '‘'    },
        mn          = {'«',  '»',     '‹',  '›'    },
        mt          = {'“',  '”',     '‘',  '’'    },
        no          = {'«',  '»',     '«',  '»'    },
        pl          = {'„',  '”',     '»',  '«'    },
        ps          = {'«',  '»',     '‹',  '›'    },
        pt          = {'«',  '»',     '“',  '”'    },
        ['pt-BR']   = {'“',  '”',     '‘',  '’'    },
        rm          = {'«',  '»',     '‹',  '›'    },
        ro          = {'„',  '”',     '«',  '»'    },
        ru          = {'«',  '»',     '“',  '”'    },
        sk          = {'„',  '“',     '‚',  '‘'    },
        sl          = {'„',  '“',     '‚',  '‘'    },
        sq          = {'„',  '“',     '‚',  '‘'    },
        sr          = {'„',  '“',     '’',  '’'    },
        sv          = {'”',  '”',     '’',  '’'    },
        tdd         = {'「', '」',    '『',  '』'    },
        ti          = {'«',  '»',     '‹',  '›'    },
        th          = {'“',  '”',     '‘',  '’'    },
        thi         = {'「', '」',    '『',  '』'    },
        tr          = {'«',  '»',     '‹',  '›'    },
        ug          = {'«',  '»',     '‹',  '›'    },
        uk          = {'«',  '»',     '„',  '“'    },
        uz          = {'«',  '»',     '„',  '“'    },
        vi          = {'“',  '”',     '‘',  '’'    },
        wen         = {'„',  '“',     '‚',  '‘'    },
        ka          = {'„',  '“',     '‚',  '‘'    },
        khb         = {'《', '》',     '〈', '〉'    },
        kk          = {'«',  '»',     '‹',  '›'    },
        km          = {'«',  '»',     '‹',  '›'    },
        ko          = {'《', '》',     '〈', '〉'    },
        ['ko-KR']   = {'“',  '”',     '‘',  '’'    },
        lt          = {'„',  '“',     '‚',  '‘'    },
        lv          = {'„',  '“',     '‚',  '‘'    },
        lo          = {'«',  '»',     '‹',  '›'    },
        nl          = {'„',  '”',     '‚',  '’'    },
        mk          = {'„',  '“',     '’',  '‘'    },
        mn          = {'«',  '»',     '‹',  '›'    },
        mt          = {'“',  '”',     '‘',  '’'    },
        no          = {'«',  '»',     '«',  '»'    },
        pl          = {'„',  '”',     '»',  '«'    },
        ps          = {'«',  '»',     '‹',  '›'    },
        pt          = {'«',  '»',     '“',  '”'    },
        ['pt-BR']   = {'“',  '”',     '‘',  '’'    },
        rm          = {'«',  '»',     '‹',  '›'    },
        ro          = {'„',  '”',     '«',  '»'    },
        ru          = {'«',  '»',     '“',  '”'    },
        sk          = {'„',  '“',     '‚',  '‘'    },
        sl          = {'„',  '“',     '‚',  '‘'    },
        sq          = {'„',  '“',     '‚',  '‘'    },
        sr          = {'„',  '“',     '’',  '’'    },
        sv          = {'”',  '”',     '’',  '’'    },
        tdd         = {'「', '」',     '『', '』'    },
        ti          = {'«',  '»',     '‹',  '›'    },
        th          = {'“',  '”',     '‘',  '’'    },
        thi         = {'「', '」',     '『', '』'    },
        tr          = {'«',  '»',     '‹',  '›'    },
        ug          = {'«',  '»',     '‹',  '›'    },
        uk          = {'«',  '»',     '„',  '“'    },
        uz          = {'«',  '»',     '„',  '“'    },
        vi          = {'“',  '”',     '‘',  '’'    },
        wen         = {'„',  '“',     '‚',  '‘'    }