From c71966c4f8c707bbfc2ec50840cc070e98d118a9 Mon Sep 17 00:00:00 2001 From: milde Date: Sun, 26 Jan 2020 22:08:25 +0000 Subject: Fix [ 383 ] Smart quotes around opening and separator characters. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@8469 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- docutils/test/test_transforms/test_smartquotes.py | 45 ++++++++++++++++------- 1 file changed, 32 insertions(+), 13 deletions(-) (limited to 'docutils/test') diff --git a/docutils/test/test_transforms/test_smartquotes.py b/docutils/test/test_transforms/test_smartquotes.py index fe8a24c32..4e17c8b89 100644 --- a/docutils/test/test_transforms/test_smartquotes.py +++ b/docutils/test/test_transforms/test_smartquotes.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # -*- coding: utf-8 -*- # $Id$ # @@ -18,7 +18,9 @@ Test module for universal.SmartQuotes transform. """ from __future__ import absolute_import -from . import DocutilsTestSupport # must be imported before docutils +if __name__ == '__main__': + import __init__ +from test_transforms import DocutilsTestSupport # must be imported before docutils from docutils.transforms.universal import SmartQuotes from docutils.parsers.rst import Parser @@ -26,7 +28,8 @@ from docutils.parsers.rst import Parser def suite(): parser = Parser() settings = {'smart_quotes': True, - 'trim_footnote_ref_space': True} + 'trim_footnote_ref_space': True, + 'report': 2} # TODO: why is this ignored when running as main? s = DocutilsTestSupport.TransformTestSuite( parser, suite_settings=settings) s.generateTests(totest) @@ -111,10 +114,11 @@ u"""\ f'(x) = df(x)/dx """], [u"""\ -Quotes preceded by -a word"a" and'a', -punctuation:"a",'a', +Closing quotes, if preceded by +wor"d char's +or punctuation:"a",'a';'a' (TODO: opening quotes if followed by word-char?). +Opening quotes after normal space "a" 'a', thin space "a" 'a', em space "a" 'a', @@ -123,17 +127,25 @@ ZWSP\u200B"a" and\u200B'a', ZWNJ\u200C"a" and\u200C'a', escaped space\\ "a" and\\ 'a', +hyphen -"a", -'a' —"a",—'a' -en dash–"a"–'a', -em dash—"a"—'a'. +en dash –"a"–'a', +em dash —"a"—'a'. + +opening brackets ("a") ('a') ["a"] ['a'] {"a"} {'a'} + +But not if followed by (optional punctuation and) whitespace: +"-", "–", "—", "(", "a[", "{" +'-', '–', '—', '((', '[', '{' """, u"""\ - Quotes preceded by - a word”a” and’a’, - punctuation:”a”,’a’, + Closing quotes, if preceded by + wor”d char’s + or punctuation:”a”,’a’;’a’ (TODO: opening quotes if followed by word-char?). + Opening quotes after normal space “a” ‘a’, thin space “a” ‘a’, em space “a” ‘a’, @@ -142,9 +154,16 @@ u"""\ ZWNJ\u200C“a” and\u200C‘a’, escaped space“a” and‘a’, + hyphen -“a”, -‘a’ —“a”,—‘a’ - en dash–“a”–‘a’, - em dash—“a”—‘a’. + en dash –“a”–‘a’, + em dash —“a”—‘a’. + + opening brackets (“a”) (‘a’) [“a”] [‘a’] {“a”} {‘a’} + + But not if followed by (optional punctuation and) whitespace: + “-”, “–”, “—”, “(”, “a[”, “{” + ‘-’, ‘–’, ‘—’, ‘((’, ‘[’, ‘{’ """], ["""\ Quotes and inline-elements: -- cgit v1.2.1