From 8e93175822a98e43b333d043943fafbe079f3df0 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Fri, 17 Apr 2020 18:17:21 -0700 Subject: [PATCH] requirements: Upgrade Python-Markdown from 3.1.1 to 3.2.1. Signed-off-by: Anders Kaseorg --- frontend_tests/node_tests/markdown.js | 10 ++++---- requirements/dev.txt | 6 ++--- requirements/prod.txt | 6 ++--- static/js/fenced_code.js | 4 ++-- version.py | 2 +- .../tests/fixtures/markdown_test_cases.json | 24 +++++++++---------- zerver/tests/test_bugdown.py | 4 ++-- zerver/tests/test_import_export.py | 4 ++-- zerver/tests/test_templates.py | 4 ++-- 9 files changed, 32 insertions(+), 32 deletions(-) diff --git a/frontend_tests/node_tests/markdown.js b/frontend_tests/node_tests/markdown.js index 88b7fbad43..cba92d3176 100644 --- a/frontend_tests/node_tests/markdown.js +++ b/frontend_tests/node_tests/markdown.js @@ -179,7 +179,7 @@ stream_data.add_sub(amp_stream); // works properly before markdown is initialized. run_test('fenced_block_defaults', () => { const input = '\n```\nfenced code\n```\n\nand then after\n'; - const expected = '\n\n
fenced code\n
\n\n\n\nand then after\n\n'; + const expected = '\n\n
fenced code\n
\n\n\n\nand then after\n\n'; const output = fenced_code.process_fenced_code(input); assert.equal(output, expected); }); @@ -290,15 +290,15 @@ run_test('marked', () => { {input: 'hello ***foo*** for you', expected: '

hello foo for you

'}, {input: '__hello__', expected: '

__hello__

'}, {input: '\n```\nfenced code\n```\n\nand then after\n', - expected: '
fenced code\n
\n\n\n

and then after

'}, + expected: '
fenced code\n
\n\n\n

and then after

'}, {input: '\n```\n fenced code trailing whitespace \n```\n\nand then after\n', - expected: '
    fenced code trailing whitespace\n
\n\n\n

and then after

'}, + expected: '
    fenced code trailing whitespace\n
\n\n\n

and then after

'}, {input: '* a\n* list \n* here', expected: ''}, {input: '\n```c#\nfenced code special\n```\n\nand then after\n', - expected: '
fenced code special\n
\n\n\n

and then after

'}, + expected: '
fenced code special\n
\n\n\n

and then after

'}, {input: '\n```vb.net\nfenced code dot\n```\n\nand then after\n', - expected: '
fenced code dot\n
\n\n\n

and then after

'}, + expected: '
fenced code dot\n
\n\n\n

and then after

'}, {input: 'Some text first\n* a\n* list \n* here\n\nand then after', expected: '

Some text first

\n\n

and then after

'}, {input: '1. an\n2. ordered \n3. list', diff --git a/requirements/dev.txt b/requirements/dev.txt index cac4b9e207..369342206e 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -442,9 +442,9 @@ lxml==4.5.0 \ --hash=sha256:fe976a0f1ef09b3638778024ab9fb8cde3118f203364212c198f71341c0715ca markdown-include==0.5.1 \ --hash=sha256:72a45461b589489a088753893bc95c5fa5909936186485f4ed55caa57d10250f -markdown==3.1.1 \ - --hash=sha256:2e50876bcdd74517e7b71f3e7a76102050edec255b3983403f1a63e7c8a41e7a \ - --hash=sha256:56a46ac655704b91e5b7e6326ce43d5ef72411376588afa1dd90e881b83c7e8c +markdown==3.2.1 \ + --hash=sha256:90fee683eeabe1a92e149f7ba74e5ccdc81cd397bd6c516d93a8da0ef90b6902 \ + --hash=sha256:e4795399163109457d4c5af2183fbe6b60326c17cfdf25ce6e7474c6624f725d markupsafe==1.1.1 \ --hash=sha256:00bc623926325b26bb9605ae9eae8a215691f33cae5df11ca5424f06f2d1f473 \ --hash=sha256:09027a7803a62ca78792ad89403b1b7a73a01c8cb65909cd876f7fcebd79b161 \ diff --git a/requirements/prod.txt b/requirements/prod.txt index ad34bcb159..152b04961c 100644 --- a/requirements/prod.txt +++ b/requirements/prod.txt @@ -303,9 +303,9 @@ lxml==4.5.0 \ --hash=sha256:fe976a0f1ef09b3638778024ab9fb8cde3118f203364212c198f71341c0715ca markdown-include==0.5.1 \ --hash=sha256:72a45461b589489a088753893bc95c5fa5909936186485f4ed55caa57d10250f -markdown==3.1.1 \ - --hash=sha256:2e50876bcdd74517e7b71f3e7a76102050edec255b3983403f1a63e7c8a41e7a \ - --hash=sha256:56a46ac655704b91e5b7e6326ce43d5ef72411376588afa1dd90e881b83c7e8c +markdown==3.2.1 \ + --hash=sha256:90fee683eeabe1a92e149f7ba74e5ccdc81cd397bd6c516d93a8da0ef90b6902 \ + --hash=sha256:e4795399163109457d4c5af2183fbe6b60326c17cfdf25ce6e7474c6624f725d markupsafe==1.1.1 \ --hash=sha256:00bc623926325b26bb9605ae9eae8a215691f33cae5df11ca5424f06f2d1f473 \ --hash=sha256:09027a7803a62ca78792ad89403b1b7a73a01c8cb65909cd876f7fcebd79b161 \ diff --git a/static/js/fenced_code.js b/static/js/fenced_code.js index 327076379c..9d41552d59 100644 --- a/static/js/fenced_code.js +++ b/static/js/fenced_code.js @@ -23,9 +23,9 @@ let stash_func = function (text) { exports.wrap_code = function (code) { // Trim trailing \n until there's just one left // This mirrors how pygments handles code input - return '
' +
+    return '
' +
         _.escape(code.replace(/^\n+|\n+$/g, '')) +
-        '\n
\n'; + '\n
\n'; }; function wrap_quote(text) { diff --git a/version.py b/version.py index a12c266369..cd3b24b9d3 100644 --- a/version.py +++ b/version.py @@ -34,4 +34,4 @@ DESKTOP_WARNING_VERSION = "5.0.0" # historical commits sharing the same major version, in which case a # minor version bump suffices. -PROVISION_VERSION = '75.8' +PROVISION_VERSION = '76.0' diff --git a/zerver/tests/fixtures/markdown_test_cases.json b/zerver/tests/fixtures/markdown_test_cases.json index 9bbaf4d690..72a0fe3d11 100644 --- a/zerver/tests/fixtures/markdown_test_cases.json +++ b/zerver/tests/fixtures/markdown_test_cases.json @@ -3,14 +3,14 @@ { "name": "codeblock_hilite", "input": "Hamlet said:\n~~~~.python \ndef speak(self):\n x = 1\n~~~~", - "expected_output": "

Hamlet said:

\n
def speak(self):\n    x = 1\n
", - "marked_expected_output": "

Hamlet said:

\n
def speak(self):\n    x = 1\n
", + "expected_output": "

Hamlet said:

\n
def speak(self):\n    x = 1\n
", + "marked_expected_output": "

Hamlet said:

\n
def speak(self):\n    x = 1\n
", "text_content": "Hamlet said:\ndef speak(self):\n x = 1\n" }, { "name": "ampampamp", "input": "& & &\n~~~~\n& & &\n~~~~\n & & &", - "expected_output": "

& & &

\n
& & &\n
\n\n\n
& & &\n
" + "expected_output": "

& & &

\n
& & &\n
\n\n\n
& & &\n
" }, { "name": "basic_paragraph", @@ -21,7 +21,7 @@ { "name": "codeblock_multiline", "input": "Hamlet once said\n~~~~\ndef func():\n x = 1\n\n y = 2\n\n z = 3\n~~~~\nAnd all was good.", - "expected_output": "

Hamlet once said

\n
def func():\n    x = 1\n\n    y = 2\n\n    z = 3\n
\n\n\n

And all was good.

", + "expected_output": "

Hamlet once said

\n
def func():\n    x = 1\n\n    y = 2\n\n    z = 3\n
\n\n\n

And all was good.

", "text_content": "Hamlet once said\ndef func():\n x = 1\n\n y = 2\n\n z = 3\n\n\n\nAnd all was good." }, { @@ -32,7 +32,7 @@ { "name": "codeblock_trailing_whitespace", "input": "Hamlet once said\n~~~~\ndef func():\n x = 1\n\n y = 2\t\t\n\n z = 3 \n~~~~\nAnd all was good.", - "expected_output": "

Hamlet once said

\n
def func():\n    x = 1\n\n    y = 2\n\n    z = 3\n
\n\n\n

And all was good.

", + "expected_output": "

Hamlet once said

\n
def func():\n    x = 1\n\n    y = 2\n\n    z = 3\n
\n\n\n

And all was good.

", "text_content": "Hamlet once said\ndef func():\n x = 1\n\n y = 2\n\n z = 3\n\n\n\nAnd all was good." }, { @@ -44,13 +44,13 @@ { "name": "codeblock_backticks", "input": "\n```\nfenced code\n```\n\n```inline code```\n", - "expected_output": "
fenced code\n
\n\n\n

inline code

", + "expected_output": "
fenced code\n
\n\n\n

inline code

", "text_content": "fenced code\n\n\n\ninline code" }, { "name": "hanging_multi_codeblock", "input": "Hamlet said:\n~~~~\ndef speak(self):\n x = 1\n# Comment to make this code block longer to test Trac #1162\n~~~~\n\nThen he mentioned ````y = 4 + x**2```` and\n~~~~\ndef foobar(self):\n return self.baz()", - "expected_output": "

Hamlet said:

\n
def speak(self):\n    x = 1\n# Comment to make this code block longer to test Trac #1162\n
\n\n\n

Then he mentioned y = 4 + x**2 and

\n
def foobar(self):\n    return self.baz()\n
", + "expected_output": "

Hamlet said:

\n
def speak(self):\n    x = 1\n# Comment to make this code block longer to test Trac #1162\n
\n\n\n

Then he mentioned y = 4 + x**2 and

\n
def foobar(self):\n    return self.baz()\n
", "text_content": "Hamlet said:\ndef speak(self):\n x = 1\n# Comment to make this code block longer to test Trac #1162\n\n\n\nThen he mentioned y = 4 + x**2 and\ndef foobar(self):\n return self.baz()\n" }, { @@ -68,7 +68,7 @@ { "name": "complexly_nested_quote", "input": "I heard about this second hand...\n~~~ quote\n\nHe said:\n~~~ quote\nThe customer is complaining.\n\nThey looked at this code:\n``` \ndef hello(): print 'hello\n```\nThey would prefer:\n~~~\ndef hello()\n puts 'hello'\nend\n~~~\n\nPlease advise.\n~~~\n\nShe said:\n~~~ quote\nJust send them this:\n```\necho \"hello\n\"\n```\n~~~", - "expected_output": "

I heard about this second hand...

\n
\n

He said:

\n
\n

The customer is complaining.

\n

They looked at this code:

\n
def hello(): print 'hello\n
\n\n\n

They would prefer:

\n
\n

def hello()
\n puts 'hello'
\nend

\n
\n

Please advise.

\n
She said:\n~~~ quote\nJust send them this:\n```\necho "hello\n"\n```\n
", + "expected_output": "

I heard about this second hand...

\n
\n

He said:

\n
\n

The customer is complaining.

\n

They looked at this code:

\n
def hello(): print 'hello\n
\n\n\n

They would prefer:

\n
\n

def hello()
\n puts 'hello'
\nend

\n
\n

Please advise.

\n
She said:\n~~~ quote\nJust send them this:\n```\necho "hello\n"\n```\n
", "text_content": "I heard about this second hand...\n> He said:\n> > The customer is complaining.\n> > They looked at this code:\n> > def hello(): print 'hello\n> > They would prefer:\n> def hello()\n> puts 'hello'\n> end\n\nPlease advise.\nShe said:\n~~~ quote\nJust send them this:\n```\necho \"hello\n\"\n```\n" }, { @@ -113,13 +113,13 @@ { "name": "dangerous_block", "input": "``` one ```\n\n``` two ```\n\n~~~~\nx = 1", - "expected_output": "

one

\n

two

\n
x = 1\n
", + "expected_output": "

one

\n

two

\n
x = 1\n
", "text_content": " one \n two \nx = 1\n" }, { "name": "four_space_code_block", "input": " def foo(): pass", - "expected_output": "
def foo(): pass\n
", + "expected_output": "
def foo(): pass\n
", "text_content": "def foo(): pass\n" }, { @@ -237,7 +237,7 @@ { "name": "ulist_codeblock", "input": "~~~\nint x = 3\n* 4;\n~~~", - "expected_output": "
int x = 3\n* 4;\n
", + "expected_output": "
int x = 3\n* 4;\n
", "text_content": "int x = 3\n* 4;\n" }, { @@ -697,7 +697,7 @@ { "name": "safe_html_in_code", "input": "~~~\n

stay normal

", - "expected_output": "
<h1>stay normal</h1>\n
", + "expected_output": "
<h1>stay normal</h1>\n
", "text_content": "

stay normal<\/h1>\n" }, { diff --git a/zerver/tests/test_bugdown.py b/zerver/tests/test_bugdown.py index 85c6a433e8..225bdc8c17 100644 --- a/zerver/tests/test_bugdown.py +++ b/zerver/tests/test_bugdown.py @@ -1934,8 +1934,8 @@ class BugdownTest(ZulipTestCase): " I am writing this message to test something. I am writing this message to test something." converted = bugdown_convert(msg) expected_output = '

Hello,

\n' + \ - '
I am writing this message to test something. I am writing this message to test something.\n' +     \
-                          '
' + '
I am writing this message to test something. I am writing this message to test something.\n' +     \
+                          '
' self.assertEqual(converted, expected_output) realm = Realm.objects.create(string_id='code_block_processor_test') diff --git a/zerver/tests/test_import_export.py b/zerver/tests/test_import_export.py index dcf8c974ca..f333e84ca4 100644 --- a/zerver/tests/test_import_export.py +++ b/zerver/tests/test_import_export.py @@ -988,7 +988,7 @@ class ImportExportTest(ZulipTestCase): original_msg = Message.objects.get(content=special_characters_message, sender__realm=original_realm) self.assertEqual( original_msg.rendered_content, - ('
'\n
\n\n\n' + ('
'\n
\n\n\n' '

@Polonius

' % (orig_polonius_user.id,)) ) @@ -997,7 +997,7 @@ class ImportExportTest(ZulipTestCase): imported_msg = Message.objects.get(content=special_characters_message, sender__realm=imported_realm) self.assertEqual( imported_msg.rendered_content, - ('
\'\n
\n' + ('
\'\n
\n' '

@Polonius

' % (imported_polonius_user.id,)) ) diff --git a/zerver/tests/test_templates.py b/zerver/tests/test_templates.py index 3d86cd8399..16a2ade777 100644 --- a/zerver/tests/test_templates.py +++ b/zerver/tests/test_templates.py @@ -102,8 +102,8 @@ footer expected = ('headerThisisaheading.

    ' '
  1. Alistitemwithanindentedcodeblock:

    ' '
    indentedcodeblockwithmultiplelines
' - '
'
-                    'non-indentedcodeblockwithmultiplelines
footer') + '
'
+                    'non-indentedcodeblockwithmultiplelines
footer') self.assertEqual(content_sans_whitespace, expected) def test_custom_markdown_include_extension(self) -> None: