mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-04 12:30:11 +03:00
substitute '@@' code block delimiter with triple back-tick, more consistent with other markdown extensions
This commit is contained in:
parent
e704dd2e40
commit
86682d4764
|
@ -244,7 +244,7 @@ if markdown is not None and pygments is not None:
|
||||||
|
|
||||||
class CodeBlockPreprocessor(Preprocessor):
|
class CodeBlockPreprocessor(Preprocessor):
|
||||||
pattern = re.compile(
|
pattern = re.compile(
|
||||||
r'^\s*@@ (.+?) @@\s*(.+?)^\s*@@', re.M|re.S)
|
r'^\s*``` ([^\n]+)\n(.+?)^\s*```', re.M|re.S)
|
||||||
|
|
||||||
formatter = HtmlFormatter()
|
formatter = HtmlFormatter()
|
||||||
|
|
||||||
|
|
|
@ -26,12 +26,12 @@ indented
|
||||||
|
|
||||||
# hash style header #
|
# hash style header #
|
||||||
|
|
||||||
@@ json @@
|
``` json
|
||||||
[{
|
[{
|
||||||
"alpha": 1,
|
"alpha": 1,
|
||||||
"beta: "this is a string"
|
"beta: "this is a string"
|
||||||
}]
|
}]
|
||||||
@@"""
|
```"""
|
||||||
|
|
||||||
# If markdown is installed we also test it's working
|
# If markdown is installed we also test it's working
|
||||||
# (and that our wrapped forces '=' to h2 and '-' to h3)
|
# (and that our wrapped forces '=' to h2 and '-' to h3)
|
||||||
|
@ -47,12 +47,12 @@ string"</span><br /><span class="p">}]</span><br /></pre></div>
|
||||||
<p><br /></p>"""
|
<p><br /></p>"""
|
||||||
|
|
||||||
MARKED_DOWN_NOT_HILITE = """
|
MARKED_DOWN_NOT_HILITE = """
|
||||||
<p>@@ json @@
|
<p>``` json
|
||||||
[{
|
[{
|
||||||
"alpha": 1,
|
"alpha": 1,
|
||||||
"beta: "this is a string"
|
"beta: "this is a string"
|
||||||
}]
|
}]
|
||||||
@@</p>"""
|
```</p>"""
|
||||||
|
|
||||||
# We support markdown < 2.1 and markdown >= 2.1
|
# We support markdown < 2.1 and markdown >= 2.1
|
||||||
MARKED_DOWN_lt_21 = """<h2>an example docstring</h2>
|
MARKED_DOWN_lt_21 = """<h2>an example docstring</h2>
|
||||||
|
@ -105,13 +105,14 @@ class TestViewNamesAndDescriptions(TestCase):
|
||||||
|
|
||||||
# hash style header #
|
# hash style header #
|
||||||
|
|
||||||
@@ json @@
|
``` json
|
||||||
[{
|
[{
|
||||||
"alpha": 1,
|
"alpha": 1,
|
||||||
"beta: "this is a string"
|
"beta: "this is a string"
|
||||||
}]
|
}]
|
||||||
@@"""
|
```"""
|
||||||
|
|
||||||
|
print("MOCK:\n[%s]" % MockView().get_view_description())
|
||||||
assert MockView().get_view_description() == DESCRIPTION
|
assert MockView().get_view_description() == DESCRIPTION
|
||||||
|
|
||||||
def test_view_description_can_be_empty(self):
|
def test_view_description_can_be_empty(self):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user