Duplicated the common code over. It's fully covered, so it's okay.
# DEALINGS IN THE SOFTWARE.
#
-from docutils import utils
-import re
-
-link_regexp = re.compile(r'(?P<title>.*) <(?P<link>.+)>')
-
-def parse_link(text):
- link = utils.unescape(text)
- m = link_regexp.match(link)
- if m: return m.group('title', 'link')
- return None, link
+# This file is here only to make python unittest work, it's not needed
+# otherwise
# DEALINGS IN THE SOFTWARE.
#
-from . import parse_link
-from docutils import nodes
+import re
+from docutils import nodes, utils
from docutils.parsers import rst
+# to avoid dependencies, link_regexp and parse_link() is common for m.abbr,
+# m.gh and m.gl
+
+link_regexp = re.compile(r'(?P<title>.*) <(?P<link>.+)>')
+
+def parse_link(text):
+ link = utils.unescape(text)
+ m = link_regexp.match(link)
+ if m: return m.group('title', 'link')
+ return None, link
+
def abbr(name, rawtext, text, lineno, inliner, options={}, content=[]):
abbr, title = parse_link(text)
if not abbr:
# DEALINGS IN THE SOFTWARE.
#
-from . import parse_link
from docutils.parsers.rst.states import Inliner
from docutils import nodes, utils
from docutils.parsers import rst
# DEALINGS IN THE SOFTWARE.
#
-from . import parse_link
-from docutils import nodes
+import re
+from docutils import nodes, utils
from docutils.parsers import rst
+# to avoid dependencies, link_regexp and parse_link() is common for m.abbr,
+# m.gh and m.gl
+
+link_regexp = re.compile(r'(?P<title>.*) <(?P<link>.+)>')
+
+def parse_link(text):
+ link = utils.unescape(text)
+ m = link_regexp.match(link)
+ if m: return m.group('title', 'link')
+ return None, link
+
def gh_internal(account, ref, title, link):
base_url = "https://github.com/{}/{}/{}/{}"
if '#' in ref:
# DEALINGS IN THE SOFTWARE.
#
-from . import parse_link
+import re
from docutils import nodes, utils
from docutils.parsers import rst
+# to avoid dependencies, link_regexp and parse_link() is common for m.abbr,
+# m.gh and m.gl
+
+link_regexp = re.compile(r'(?P<title>.*) <(?P<link>.+)>')
+
+def parse_link(text):
+ link = utils.unescape(text)
+ m = link_regexp.match(link)
+ if m: return m.group('title', 'link')
+ return None, link
+
def glext(name, rawtext, text, lineno, inliner, options={}, content=[]):
title, extension = parse_link(text)
if not title: title = extension