Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Smart - quote types #84

Open
jgm opened this issue Jun 10, 2011 · 21 comments
Open

Smart - quote types #84

jgm opened this issue Jun 10, 2011 · 21 comments
Assignees

Comments

@jgm
Copy link
Owner

@jgm jgm commented Jun 10, 2011

currently only english type quotes (both up) are supported, an option like -Sq x (x = numeric id of quote type) would be nice to allow e.g. (this is for Czech) „abc“; or even -SqAB, where A(B) represent characters for opening(closing) quote

Google Code Info:
Issue #: 287
Author: svat...@mail2web.com
Created On: 2011-02-14T10:26:54.000Z
Closed On:

@jgm

This comment has been minimized.

Copy link
Owner Author

@jgm jgm commented Jun 10, 2011

@ghost ghost assigned jgm Jun 10, 2011
@jonassmedegaard

This comment has been minimized.

Copy link
Contributor

@jonassmedegaard jonassmedegaard commented May 30, 2012

I would very much like to see this too.

I imagine a minimal implementation could be to support explicit setting them as unicode character pairs like this:

pandoc -V doublequote=»« -V singlequote=›‹ -o output.html input.txt

More clever (e.g. a later addition) would be a language lookup table, to alter the defaults per language. That would cleverly switch to „this“ when setting -V lang=da (or autodiscovering the language?), and might also support different quoting style for text pieces of different languages within same document.

@jonassmedegaard

This comment has been minimized.

Copy link
Contributor

@jonassmedegaard jonassmedegaard commented May 30, 2012

For others reading this issue, here's what I currently use to postprocess html output to switch to danish citation style:

perl -i -pe 's/”(\w([^”]*\w)?)”/„$1“/g;s/’(\w([^’]*\w)?)’/‚$1‘/g' output.html

(to change to other citation styles, change the characters around the two

$1
)

@jgm

This comment has been minimized.

Copy link
Owner Author

@jgm jgm commented May 31, 2012

To clarify: are you requesting support for configurable smart quotes on output, or also in input?

If you want to write Danish style quotes (or whatever) in input, they should pass through unchanged to the output.

So I gather you want to write "hello" in your markdown file and get „hello“ in the output. Correct?

@jonassmedegaard

This comment has been minimized.

Copy link
Contributor

@jonassmedegaard jonassmedegaard commented May 31, 2012

On 12-05-30 at 07:19pm, John MacFarlane wrote:

To clarify: are you requesting support for configurable smart quotes
on output, or also in input?

If you want to write Danish style quotes (or whatever) in input, they
should pass through unchanged to the output.

So I gather you want to write "hello" in your markdown file and get
„hello“ in the output. Correct?

Yes, correct.

(I did wonder why you had notions of quoting style at all in input files
in source - now I understand that (to some degree of "understand")) :-)

  • Jonas

  • Jonas Smedegaard - idealist & Internet-arkitekt

  • Tlf.: +45 40843136 Website: http://dr.jones.dk/

    [x] quote me freely [ ] ask before reusing [ ] keep private

@jgm

This comment has been minimized.

Copy link
Owner Author

@jgm jgm commented Jun 1, 2012

Jonas: In HTML 5 and LaTeX/PDF output, it is already possible to get national quote styles.

In HTML 5, you just need to add some CSS (which you can include using --css): something like this, but for your language:

 q { quotes: "“" "”" "‘" "’"; }

In LaTeX, add \usepackage[danish=quotes]{csquotes} to your template.

@jonassmedegaard

This comment has been minimized.

Copy link
Contributor

@jonassmedegaard jonassmedegaard commented Jun 1, 2012

On 12-05-31 at 08:28pm, John MacFarlane wrote:

Jonas: In HTML 5 and LaTeX/PDF output, it is already possible to get
national quote styles.

In HTML 5, you just need to add some CSS (which you can include using
--css): something like this, but for your language:

 q { quotes: "“" "”" "‘" "’"; }

In LaTeX, add \usepackage[danish=quotes]{csquotes} to your template.

I knew about LaTeX but not HTML5. Thanks for the hint!

Still, as I suspect is even written between the lines above: that is
little help for my current project for primary schools that use IE7.

I can possibly use Modernizr.js and/or IE7.js but in my experience those
often collide with other JavaScript messing with the DOM, e.g. Slidy and
Slideous.

Also, for the reference, above are not danish quotes. These are correct:

q { quotes: "„" "“" "‚" "‘"; }

...and (as an active translator made me aware when I tried to "correct"
him) these are equally correct (even if not my preference, as you might
guess from that incident):

q { quotes: "»" "«" "›" "‹"; }

More info here:
http://en.wikipedia.org/wiki/Non-English_usage_of_quotation_marks

  • Jonas

Happy to notice that Slideous has been merged into Pandoc now!

  • Jonas Smedegaard - idealist & Internet-arkitekt

  • Tlf.: +45 40843136 Website: http://dr.jones.dk/

    [x] quote me freely [ ] ask before reusing [ ] keep private

@jgm

This comment has been minimized.

Copy link
Owner Author

@jgm jgm commented Jun 1, 2012

+++ Jonas Smedegaard [Jun 01 12 02:28 ]:

On 12-05-31 at 08:28pm, John MacFarlane wrote:

Jonas: In HTML 5 and LaTeX/PDF output, it is already possible to get
national quote styles.

In HTML 5, you just need to add some CSS (which you can include using
--css): something like this, but for your language:

 q { quotes: "“" "”" "‘" "’"; }

In LaTeX, add \usepackage[danish=quotes]{csquotes} to your template.

I knew about LaTeX but not HTML5. Thanks for the hint!

Still, as I suspect is even written between the lines above: that is
little help for my current project for primary schools that use IE7.

I can possibly use Modernizr.js and/or IE7.js but in my experience those
often collide with other JavaScript messing with the DOM, e.g. Slidy and
Slideous.

Also, for the reference, above are not danish quotes. These are correct:

q { quotes: "„" "“" "‚" "‘"; }

Yeah, I know. I just gave the English ones and added "but for your
language," because it's tough for me to type those.

...and (as an active translator made me aware when I tried to "correct"
him) these are equally correct (even if not my preference, as you might
guess from that incident):

q { quotes: "»" "«" "›" "‹"; }

By the way, LaTeX csquotes also has a danish=guillemots option.

@jonassmedegaard

This comment has been minimized.

Copy link
Contributor

@jonassmedegaard jonassmedegaard commented Jun 1, 2012

On 12-06-01 at 08:49am, John MacFarlane wrote:

+++ Jonas Smedegaard [Jun 01 12 02:28 ]:

On 12-05-31 at 08:28pm, John MacFarlane wrote:

Jonas: In HTML 5 and LaTeX/PDF output, it is already possible to
get national quote styles.

In HTML 5, you just need to add some CSS (which you can include
using --css): something like this, but for your language:

 q { quotes: "“" "”" "‘" "’"; }

In LaTeX, add \usepackage[danish=quotes]{csquotes} to your
template.

I knew about LaTeX but not HTML5. Thanks for the hint!

Still, as I suspect is even written between the lines above: that is
little help for my current project for primary schools that use IE7.

I can possibly use Modernizr.js and/or IE7.js but in my experience
those often collide with other JavaScript messing with the DOM, e.g.
Slidy and Slideous.

Also, for the reference, above are not danish quotes. These are
correct:

q { quotes: "„" "“" "‚" "‘"; }

Yeah, I know. I just gave the English ones and added "but for your
language," because it's tough for me to type those.

Ahh, how lovely: you beat me in nitpicking: I missed that tiny "but"!
:-D

  • Jonas

  • Jonas Smedegaard - idealist & Internet-arkitekt

  • Tlf.: +45 40843136 Website: http://dr.jones.dk/

    [x] quote me freely [ ] ask before reusing [ ] keep private

@WebDucer

This comment has been minimized.

Copy link

@WebDucer WebDucer commented Aug 28, 2012

Language dependent smart quotes would be very nice (HTML, EPUB writer) for me too. I use markdown as source with "-quotes for German, French and Russian texts.

@larmarange

This comment has been minimized.

Copy link

@larmarange larmarange commented Nov 6, 2013

the best would be for pandoc to adapt according to the lang variable

@larmarange

This comment has been minimized.

Copy link

@larmarange larmarange commented Dec 15, 2013

Also, it would be great if pandoc could manage some typographic corrections. For example, in French, you should have a   before signs like ! ? ; or : .

@reagle

This comment has been minimized.

Copy link

@reagle reagle commented Jul 8, 2014

I currently do regexes on the resulting HTML to switch between American and English quotes, but a format independent way would be handy!

@paulmenzel

This comment has been minimized.

Copy link

@paulmenzel paulmenzel commented Jan 12, 2016

Hi. This seems to be a little related to issue #327 too.

I’d love to see such switches too, where one could simply pass the desired quote characters to which the ASCII quotes " around a sequence of words should be converted to.

$ pandoc --version
pandoc 1.12.4.2
Compiled with texmath 0.6.6.1, highlighting-kate 0.5.8.5.
Syntax highlighting is supported for the following languages:
    actionscript, ada, apache, asn1, asp, awk, bash, bibtex, boo, c, changelog,
    clojure, cmake, coffee, coldfusion, commonlisp, cpp, cs, css, curry, d,
    diff, djangotemplate, doxygen, doxygenlua, dtd, eiffel, email, erlang,
    fortran, fsharp, gcc, gnuassembler, go, haskell, haxe, html, ini, isocpp,
    java, javadoc, javascript, json, jsp, julia, latex, lex, literatecurry,
    literatehaskell, lua, makefile, mandoc, markdown, matlab, maxima, metafont,
    mips, modelines, modula2, modula3, monobasic, nasm, noweb, objectivec,
    objectivecpp, ocaml, octave, pascal, perl, php, pike, postscript, prolog,
    pure, python, r, relaxngcompact, restructuredtext, rhtml, roff, ruby, rust,
    scala, scheme, sci, sed, sgml, sql, sqlmysql, sqlpostgresql, tcl, texinfo,
    verilog, vhdl, xml, xorg, xslt, xul, yacc, yaml
Default user data directory: /home/paul/.pandoc
Copyright (C) 2006-2014 John MacFarlane
Web:  http://johnmacfarlane.net/pandoc
This is free software; see the source for copying conditions.  There is no
warranty, not even for merchantability or fitness for a particular purpose.
$ more test.textile 
"test"
$ pandoc -o test.markdown test.textile
$ more test.markdown 
“test”

@Konfekt

This comment has been minimized.

Copy link
Contributor

@Konfekt Konfekt commented Apr 11, 2018

In the other direction, for transforming internationalized to ASCII text: https://raw.githubusercontent.com/moses-smt/mosesdecoder/master/scripts/tokenizer/normalize-punctuation.perl is a script that normalizes all quotes and punctuation, for example, guillemets to double quotation marks. For example normalize-punctuation.pl < file.md. For example in LaTeX (withcsquotes), the compiled pdfrestores all the internationalization.

@odkr

This comment has been minimized.

Copy link

@odkr odkr commented Apr 22, 2018

I wrote a simple filter that replaces ASCII quotes with typographic ones and that respects the lang metadata field.

It should be fairly easy to customise. However, it’s only intended for output formats that treat quotes as part of a document’s semantics (e.g., OpenOffice, Word), not output formats that treat quotes as part of a document’s syntax (e.g., HTML, LaTeX).

You can install it by: pip3 install pandoc_quotes

See https://github.com/odkr/pandoc-quotes for details.

@bubifengyun

This comment has been minimized.

Copy link

@bubifengyun bubifengyun commented Aug 30, 2018

How to turn off the quotes translated? eg. I had write chinese quotes “”, and I hope it is “” in the final pdf file. But pandoc would be self-clever to translate “” to `` '', and in some blocks pandoc would not translate them, as suggested in https://stackoverflow.com/questions/52052231/how-to-write-chinese-quotes-in-bookdown . it leaders to a chaos. Thank you.

@chpio

This comment has been minimized.

Copy link

@chpio chpio commented Aug 30, 2018

How to turn off the quotes translated?

By not enabling smart.

@bubifengyun

This comment has been minimized.

Copy link

@bubifengyun bubifengyun commented Aug 31, 2018

@chpio I find bookdown will run

/usr/bin/pandoc +RTS -K512m -RTS deepin-bible.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output deepin-bible.tex --table-of-contents --toc-depth 2 --template latex/template.tex --number-sections --highlight-style tango --pdf-engine xelatex --biblatex --listings --top-level-division=chapter --variable tables=yes --standalone

which does not contain smart.

You mean, it should add -smart in shell like this

markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-smart

??? Thank you.

@bubifengyun

This comment has been minimized.

Copy link

@bubifengyun bubifengyun commented Aug 31, 2018

As described in https://stackoverflow.com/questions/52052231/how-to-write-chinese-quotes-in-bookdown

I had tested in bookdown template, and found that “”, which is Chinese quotes, would be translated to ``,''。 But if you write “” in a block or other begin,end blocks, the Chinese quotes, “”, would not be translated to ``,''。So you will get different Chinese quotes, in the final pdf file. Can I set in some place to turn off such translation? Thank you.

I had add -smart, it also do the same thing in the above.

@bubifengyun

This comment has been minimized.

Copy link

@bubifengyun bubifengyun commented Aug 31, 2018

/usr/bin/pandoc +RTS -K512m -RTS deepin-bible.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-smart --output deepin-bible.tex --table-of-contents --toc-depth 2 --template latex/template.tex --number-sections --highlight-style tango --pdf-engine xelatex --biblatex --listings --top-level-division=chapter --variable tables=yes --standalone

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
You can’t perform that action at this time.