Menu

#383 Smart Quotes incorrect around dash/hyphen

None
closed-fixed
nobody
None
2021-04-03
2019-12-05
Peter Hull
No

I wanted to apply smart quotes to the sequence '-' however this is rendered in HTML as ‘-‘ rather than ‘-’.

This was in Sphinx, but they advised me it was in the docutils code. (see https://github.com/sphinx-doc/sphinx/issues/6884)

I can reproduce with

echo "QUOTE '-'" | rst2html.py --smart-quotes=yes|grep QUOTE
also
echo 'QUOTE "-"' | rst2html.py --smart-quotes=yes|grep QUOTE

Using rst2html.py (Docutils 0.15.2 [release], Python 3.7.5, on darwin)

Discussion

  • Peter Hull

    Peter Hull - 2019-12-05

    Sorry, the example was

    echo "QUOTE '-'" | rst2html.py --smart-quotes=yes|grep QUOTE
    
     
  • Günter Milde

    Günter Milde - 2019-12-09

    Thank you for reporting the problem.

    The reason for this behaviour is, that in some cases, opening quotes should follow hypens (and other characters). Examples are ("this"), ["that"], {'this'} but also---"dumb" as well as literal---dashes.
    These are not trivial to differentiate from use cases like "((" or "-".
    You may try the attached patch or the advice in http://docutils.sourceforge.net/docs/user/smartquotes.html
    "In such cases, it's best to use the recommended apostrophe character (’) in the source".

     

    Last edit: Günter Milde 2019-12-09
  • Peter Hull

    Peter Hull - 2019-12-12

    OK, thanks for the clarification. I will use 'explicit' smart quotes for this.

     
  • Günter Milde

    Günter Milde - 2020-01-26
    • status: open --> open-fixed
     
  • Günter Milde

    Günter Milde - 2020-01-26

    Fixed in 0.17b.dev (repository version).

     
  • Günter Milde

    Günter Milde - 2021-04-03
    • status: open-fixed --> closed-fixed
    • Group: -->
     
  • Günter Milde

    Günter Milde - 2021-04-03

    Fixed in Docutils 0.17.
    Thank you for reporting.

     

Log in to post a comment.

Monday.com Logo