From 9325a16c6f62141b3d254a3217c51e8defd52eb6 Mon Sep 17 00:00:00 2001 From: Armin Ronacher Date: Thu, 22 Sep 2011 11:17:18 +0200 Subject: [PATCH] Added support for strings with commas in template definitions. --- sphinx/domains/cpp.py | 2 +- tests/test_cpp_domain.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/sphinx/domains/cpp.py b/sphinx/domains/cpp.py index 68cb62934..f616ee079 100644 --- a/sphinx/domains/cpp.py +++ b/sphinx/domains/cpp.py @@ -29,7 +29,7 @@ _string_re = re.compile(r"[LuU8]?('([^'\\]*(?:\\.[^'\\]*)*)'" r'|"([^"\\]*(?:\\.[^"\\]*)*)")', re.S) _visibility_re = re.compile(r'\b(public|private|protected)\b') _array_def_re = re.compile(r'\[\s*(.+?)?\s*\]') -_template_arg_re = re.compile(r'[^,>]+') +_template_arg_re = re.compile(r'(%s)|([^,>]+)' % _string_re.pattern, re.S) _operator_re = re.compile(r'''(?x) \[\s*\] | \(\s*\) diff --git a/tests/test_cpp_domain.py b/tests/test_cpp_domain.py index 61ad91e7a..30cdb69e7 100644 --- a/tests/test_cpp_domain.py +++ b/tests/test_cpp_domain.py @@ -28,6 +28,9 @@ def test_type_definitions(): x = 'void operator()(const boost::array& v) const' assert unicode(parse('function', x)) == x + x = 'void operator()(const boost::array& v) const' + assert unicode(parse('function', x)) == x + rv = parse('member_object', 'const std::vector< unsigned int, long> &name') assert unicode(rv) == 'const std::vector& name'