void-packages/srcpkgs/terminal_markdown_viewer/patches/unichr.patch
Đoàn Trần Công Danh 4f75cf25fd srcpkgs/t*: convert patches to -Np1
```sh
git grep -l '^patch_args=-Np0' "srcpkgs/$1*/template" |
while read template; do
	for p in ${template%/template}/patches/*; do
		sed -i '
			\,^[+-][+-][+-] /dev/null,b
			/^[*-]\+ [0-9]\+\(,[0-9]\+\)\? [*-]\+$/b
			s,^[*][*][*] ,&a/,
			/^--- /{
				s,\(^--- \)\(./\)*,\1a/,
				s,[.-][Oo][Rr][Ii][Gg]\([	/]\),\1,
				s/[.-][Oo][Rr][Ii][Gg]$//
				s/[.]patched[.]\([^.]\)/.\1/
				h
			}
			/^+++ -/{
				g
				s/^--- a/+++ b/
				b
			}
			s,\(^+++ \)\(./\)*,\1b/,
		' "$p"
	done
	sed -i '/^patch_args=/d' $template
done
```
2021-06-20 13:17:29 +07:00

22 lines
531 B
Diff

--- a/mdv/markdownviewer.py
+++ b/mdv/markdownviewer.py
@@ -129,6 +129,9 @@
import io
import os
import sys
+
+PY3 = True if sys.version_info[0] > 2 else False
+
import textwrap
is_app = 0
# code analysis for hilite:
@@ -158,6 +161,9 @@
from HTMLParser import HTMLParser
envget = os.environ.get
+if PY3:
+ unichr = chr
+
# ---------------------------------------------------------------------- Config
hr_sep, txt_block_cut, code_pref, list_pref, bquote_pref, hr_ends = \
'─', '✂', '| ', '- ', '|', '◈'