File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -38,11 +38,22 @@ def read(name):
38
38
return f .read ()
39
39
40
40
41
+ # $ echo ':something:`test <sdf>`' | sed 's/:\w\+:`\(\w\+\)\(\s\+\(.*\)\)\?`/``\1``/g'
42
+ # ``test``
43
+ def sanitize_rst_roles (rst_source_text : str ) -> str :
44
+ """Replace RST roles with inline highlighting."""
45
+ role_regex = r":\w+:`(?P<rendered_text>[^`]+)(\s+(.*))?`"
46
+ substitution_pattern = r"``(?P=rendered_text)``"
47
+ return re .sub (role_regex , substitution_pattern , rst_source_text )
48
+
49
+
41
50
args = dict (
42
51
name = "yarl" ,
43
52
version = version ,
44
53
description = ("Yet another URL library" ),
45
- long_description = "\n \n " .join ([read ("README.rst" ), read ("CHANGES.rst" )]),
54
+ long_description = "\n \n " .join (
55
+ [read ("README.rst" ), sanitize_rst_roles (read ("CHANGES.rst" ))]
56
+ ),
46
57
long_description_content_type = "text/x-rst" ,
47
58
classifiers = [
48
59
"License :: OSI Approved :: Apache Software License" ,
You can’t perform that action at this time.
0 commit comments