[Git][reproducible-builds/diffoscope][master] 2 commits: Improve output of Markdown and reStructuredText to use code blocks with...
Chris Lamb (@lamby)
gitlab at salsa.debian.org
Fri Jul 8 07:46:55 UTC 2022
Chris Lamb pushed to branch master at Reproducible Builds / diffoscope
Commits:
671283e0 by Chris Lamb at 2022-07-08T08:43:39+01:00
Improve output of Markdown and reStructuredText to use code blocks with highlighting. (Closes: reproducible-builds/diffoscope#306)
- - - - -
071a99b7 by Chris Lamb at 2022-07-08T08:45:20+01:00
releasing package diffoscope version 218
- - - - -
6 changed files:
- debian/changelog
- diffoscope/__init__.py
- diffoscope/presenters/markdown.py
- diffoscope/presenters/restructuredtext.py
- tests/data/output.md
- tests/data/output.rst
Changes:
=====================================
debian/changelog
=====================================
@@ -1,8 +1,9 @@
-diffoscope (218) UNRELEASED; urgency=medium
+diffoscope (218) unstable; urgency=medium
- * WIP (generated upon release).
+ * Improve output of Markdown and reStructuredText to use code blocks with
+ syntax highlighting. (Closes: reproducible-builds/diffoscope#306)
- -- Chris Lamb <lamby at debian.org> Thu, 23 Jun 2022 07:45:27 +0100
+ -- Chris Lamb <lamby at debian.org> Fri, 08 Jul 2022 08:45:11 +0100
diffoscope (217) unstable; urgency=medium
=====================================
diffoscope/__init__.py
=====================================
@@ -17,4 +17,4 @@
# You should have received a copy of the GNU General Public License
# along with diffoscope. If not, see <https://www.gnu.org/licenses/>.
-VERSION = "217"
+VERSION = "218"
=====================================
diffoscope/presenters/markdown.py
=====================================
@@ -1,7 +1,7 @@
#
# diffoscope: in-depth comparison of files, archives, and directories
#
-# Copyright © 2017, 2019-2020 Chris Lamb <lamby at debian.org>
+# Copyright © 2017, 2019-2020, 2022 Chris Lamb <lamby at debian.org>
#
# diffoscope is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,17 +29,19 @@ class MarkdownTextPresenter(Presenter):
self.title(difference.source1)
else:
self.title(
- "Comparing {} & {}".format(
+ "Comparing `{}` & `{}`".format(
difference.source1, difference.source2
)
)
for x in difference.comments:
- self.print_func(x)
+ self.print_func(f" * *{x}*")
self.print_func()
if difference.unified_diff:
- self.print_func(self.indent(difference.unified_diff, " "))
+ self.print_func("```diff")
+ self.print_func(difference.unified_diff.rstrip())
+ self.print_func("```")
self.print_func()
def title(self, val):
=====================================
diffoscope/presenters/restructuredtext.py
=====================================
@@ -1,7 +1,7 @@
#
# diffoscope: in-depth comparison of files, archives, and directories
#
-# Copyright © 2017, 2019-2020 Chris Lamb <lamby at debian.org>
+# Copyright © 2017, 2019-2020, 2022 Chris Lamb <lamby at debian.org>
#
# diffoscope is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -37,11 +37,11 @@ class RestructuredTextPresenter(Presenter):
)
for x in difference.comments:
- self.print_func()
self.print_func(x)
+ self.print_func()
if difference.unified_diff:
- self.print_func("::")
+ self.print_func(".. code-block:: diff")
self.print_func()
self.print_func(self.indent(difference.unified_diff, " "))
self.print_func()
=====================================
tests/data/output.md
=====================================
@@ -1,38 +1,44 @@
-# Comparing test1.tar & test2.tar
+# Comparing `test1.tar` & `test2.tar`
## file list
- @@ -1,4 +1,4 @@
- -drwxr-xr-x 0 lunar (1000) lunar (1000) 0 2015-06-29 15:49:09.000000 dir/
- --rw-r--r-- 0 lunar (1000) lunar (1000) 446 2015-06-29 15:49:09.000000 dir/text
- -crw-r--r-- 0 root (0) root (0) 1, 3 2015-06-29 15:49:09.000000 dir/null
- -lrwxrwxrwx 0 lunar (1000) lunar (1000) 0 2015-06-29 15:49:09.000000 dir/link -> broken
- +drwxr-xr-x 0 lunar (1000) lunar (1000) 0 2015-06-29 15:49:41.000000 dir/
- +-rw-r--r-- 0 lunar (1000) lunar (1000) 671 2015-06-29 15:49:41.000000 dir/text
- +crw-r--r-- 0 root (0) root (0) 1, 3 2015-06-29 15:49:41.000000 dir/null
- +lrwxrwxrwx 0 lunar (1000) lunar (1000) 0 2015-06-29 15:49:41.000000 dir/link -> really-broken
+```diff
+@@ -1,4 +1,4 @@
+-drwxr-xr-x 0 lunar (1000) lunar (1000) 0 2015-06-29 15:49:09.000000 dir/
+--rw-r--r-- 0 lunar (1000) lunar (1000) 446 2015-06-29 15:49:09.000000 dir/text
+-crw-r--r-- 0 root (0) root (0) 1, 3 2015-06-29 15:49:09.000000 dir/null
+-lrwxrwxrwx 0 lunar (1000) lunar (1000) 0 2015-06-29 15:49:09.000000 dir/link -> broken
++drwxr-xr-x 0 lunar (1000) lunar (1000) 0 2015-06-29 15:49:41.000000 dir/
++-rw-r--r-- 0 lunar (1000) lunar (1000) 671 2015-06-29 15:49:41.000000 dir/text
++crw-r--r-- 0 root (0) root (0) 1, 3 2015-06-29 15:49:41.000000 dir/null
++lrwxrwxrwx 0 lunar (1000) lunar (1000) 0 2015-06-29 15:49:41.000000 dir/link -> really-broken
+```
## dir/text
- @@ -1,6 +1,12 @@
- +A common form of lorem ipsum reads:
- +
- Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
- incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
- nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
- Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
- fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
- culpa qui officia deserunt mollit anim id est laborum.
- +
- +"Lorem ipsum" text is derived from sections 1.10.32--3 of Cicero's De finibus
- +bonorum et malorum (On the Ends of Goods and Evils, or alternatively [About]
- +The Purposes of Good and Evil).
+```diff
+@@ -1,6 +1,12 @@
++A common form of lorem ipsum reads:
++
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
+ incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
+ nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
+ Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
+ fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
+ culpa qui officia deserunt mollit anim id est laborum.
++
++"Lorem ipsum" text is derived from sections 1.10.32--3 of Cicero's De finibus
++bonorum et malorum (On the Ends of Goods and Evils, or alternatively [About]
++The Purposes of Good and Evil).
+```
## dir/link
-symlink
+ * *symlink*
- @@ -1 +1 @@
- -destination: broken
- +destination: really-broken
+```diff
+@@ -1 +1 @@
+-destination: broken
++destination: really-broken
+```
=====================================
tests/data/output.rst
=====================================
@@ -6,7 +6,7 @@ Comparing test1.tar & test2.tar
file list
---------
-::
+.. code-block:: diff
@@ -1,4 +1,4 @@
-drwxr-xr-x 0 lunar (1000) lunar (1000) 0 2015-06-29 15:49:09.000000 dir/
@@ -22,7 +22,7 @@ file list
dir/text
--------
-::
+.. code-block:: diff
@@ -1,6 +1,12 @@
+A common form of lorem ipsum reads:
@@ -42,9 +42,9 @@ dir/text
dir/link
--------
-
symlink
-::
+
+.. code-block:: diff
@@ -1 +1 @@
-destination: broken
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/compare/97a4bc5aa63b10e32ccb9cb36e3f996af47f9cd7...071a99b757eeaa7fce9d7ae3dc51f451e46d2fb5
--
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/compare/97a4bc5aa63b10e32ccb9cb36e3f996af47f9cd7...071a99b757eeaa7fce9d7ae3dc51f451e46d2fb5
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.reproducible-builds.org/pipermail/rb-commits/attachments/20220708/8c65e65c/attachment.htm>
More information about the rb-commits
mailing list