mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2026-03-30 02:42:35 +02:00
82 lines
2.4 KiB
Diff
82 lines
2.4 KiB
Diff
--- a/m2r2.py
|
|
+++ b/m2r2.py
|
|
@@ -11,7 +11,7 @@
|
|
import sys
|
|
from argparse import ArgumentParser, Namespace
|
|
|
|
-import mistune
|
|
+import mistune1
|
|
from docutils import io, statemachine, utils
|
|
from docutils.parsers import rst
|
|
from docutils.utils import column_width
|
|
@@ -86,7 +86,7 @@
|
|
parser.parse_known_args(namespace=options)
|
|
|
|
|
|
-class RestBlockGrammar(mistune.BlockGrammar): # pylint: disable=too-few-public-methods
|
|
+class RestBlockGrammar(mistune1.BlockGrammar): # pylint: disable=too-few-public-methods
|
|
directive = re.compile(
|
|
r"^( *\.\..*?)\n(?=\S)",
|
|
re.DOTALL | re.MULTILINE,
|
|
@@ -101,13 +101,13 @@
|
|
)
|
|
|
|
|
|
-class RestBlockLexer(mistune.BlockLexer):
|
|
+class RestBlockLexer(mistune1.BlockLexer):
|
|
grammar_class = RestBlockGrammar
|
|
default_rules = [
|
|
"directive",
|
|
"oneline_directive",
|
|
"rest_code_block",
|
|
- ] + mistune.BlockLexer.default_rules
|
|
+ ] + mistune1.BlockLexer.default_rules
|
|
|
|
def parse_directive(self, m):
|
|
self.tokens.append({"type": "directive", "text": m.group(1)})
|
|
@@ -120,7 +120,7 @@
|
|
self.tokens.append({"type": "rest_code_block"})
|
|
|
|
|
|
-class RestInlineGrammar(mistune.InlineGrammar):
|
|
+class RestInlineGrammar(mistune1.InlineGrammar):
|
|
image_link = re.compile(
|
|
r"\[!\[(?P<alt>.*?)\]\((?P<url>.*?)\).*?\]\((?P<target>.*?)\)"
|
|
)
|
|
@@ -146,14 +146,14 @@
|
|
self.emphasis = re.compile(r"^\*(?P<text>(?:\*\*|[^\*])+?)\*(?!\*)") # *word*
|
|
|
|
|
|
-class RestInlineLexer(mistune.InlineLexer):
|
|
+class RestInlineLexer(mistune1.InlineLexer):
|
|
grammar_class = RestInlineGrammar
|
|
default_rules = [
|
|
"image_link",
|
|
"rest_role",
|
|
"rest_link",
|
|
"eol_literal_marker",
|
|
- ] + mistune.InlineLexer.default_rules
|
|
+ ] + mistune1.InlineLexer.default_rules
|
|
|
|
def __init__(self, *args, **kwargs):
|
|
no_underscore_emphasis = kwargs.pop("no_underscore_emphasis", False)
|
|
@@ -204,7 +204,7 @@
|
|
return self.renderer.eol_literal_marker(marker)
|
|
|
|
|
|
-class RestRenderer(mistune.Renderer): # pylint: disable=too-many-public-methods
|
|
+class RestRenderer(mistune1.Renderer): # pylint: disable=too-many-public-methods
|
|
_include_raw_html = False
|
|
list_indent_re = re.compile(r"^(\s*(#\.|\*)\s)")
|
|
indent = " " * 3
|
|
@@ -520,7 +520,7 @@
|
|
return "\n\n"
|
|
|
|
|
|
-class M2R(mistune.Markdown):
|
|
+class M2R(mistune1.Markdown):
|
|
def __init__(
|
|
self, renderer=None, inline=RestInlineLexer, block=RestBlockLexer, **kwargs
|
|
):
|
|
|