mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2026-02-18 14:21:57 +01:00
79 lines
2.4 KiB
Diff
79 lines
2.4 KiB
Diff
--- ./m2r2.py.orig
|
|
+++ ./m2r2.py
|
|
@@ -9,7 +9,7 @@
|
|
import sys
|
|
from argparse import ArgumentParser, Namespace
|
|
|
|
-import mistune
|
|
+import mistune1
|
|
from docutils import io, nodes, statemachine, utils
|
|
from docutils.core import ErrorString
|
|
from docutils.parsers import rst
|
|
@@ -80,19 +80,19 @@
|
|
parser.parse_known_args(namespace=options)
|
|
|
|
|
|
-class RestBlockGrammar(mistune.BlockGrammar):
|
|
+class RestBlockGrammar(mistune1.BlockGrammar):
|
|
directive = re.compile(r"^( *\.\..*?)\n(?=\S)", re.DOTALL | re.MULTILINE,)
|
|
oneline_directive = re.compile(r"^( *\.\..*?)$", re.DOTALL | re.MULTILINE,)
|
|
rest_code_block = re.compile(r"^::\s*$", re.DOTALL | re.MULTILINE,)
|
|
|
|
|
|
-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)})
|
|
@@ -105,7 +105,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>.*?)\)"
|
|
)
|
|
@@ -131,14 +131,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)
|
|
@@ -189,7 +189,7 @@
|
|
return self.renderer.eol_literal_marker(marker)
|
|
|
|
|
|
-class RestRenderer(mistune.Renderer):
|
|
+class RestRenderer(mistune1.Renderer):
|
|
_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
|
|
):
|