From: Vladimír Vondruš Date: Mon, 8 Jun 2020 19:35:29 +0000 (+0200) Subject: m.code: remove the ZWNJ hack. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~cjwatson/git?a=commitdiff_plain;h=d1837841fc4705f311a106c2efe553f811c46a9d;p=blog.git m.code: remove the ZWNJ hack. Was used only to fix one browser rendering issue on magnum.graphics which happened only when Unicode blocks were involved. Does not make sense to pollute all output with it. --- diff --git a/documentation/test_doxygen/contents_code_language/ansi.html b/documentation/test_doxygen/contents_code_language/ansi.html index d5aa5488..a071d1e3 100644 --- a/documentation/test_doxygen/contents_code_language/ansi.html +++ b/documentation/test_doxygen/contents_code_language/ansi.html @@ -22,11 +22,11 @@

ANSI color escape code highlighting

-
![mosra@don-perverzo m.css]$ 
‌██ ‌██ ‌██ ‌██ ‌██ ‌▓▓ ‌▒▒
+
![mosra@don-perverzo m.css]$ 
██ ██ ██ ██ ██ ▓▓ ▒▒
 
-Leading zeros: ‌▒▒ ‌▒▒
+Leading zeros: ▒▒ ▒▒
 
-  ‌░░ ‌▒▒ ‌▓▓ ‌██
+ ░░ ▒▒ ▓▓ ██
diff --git a/plugins/ansilexer.py b/plugins/ansilexer.py index 39538d8b..01dd9ce1 100644 --- a/plugins/ansilexer.py +++ b/plugins/ansilexer.py @@ -89,8 +89,8 @@ class AnsiLexer(RegexLexer): ] } -_ansi_fg_color_re = re.compile('class="g g-AnsiForegroundColor([0-9a-f]{6})">') -_ansi_fg_bg_color_re = re.compile('class="g g-AnsiForegroundBackgroundColor([0-9a-f]{6})">') +_ansi_fg_color_re = re.compile('class="g g-AnsiForegroundColor([0-9a-f]{6})"') +_ansi_fg_bg_color_re = re.compile('class="g g-AnsiForegroundBackgroundColor([0-9a-f]{6})"') class HtmlAnsiFormatter(HtmlFormatter): def wrap(self, source, outfile): @@ -99,12 +99,7 @@ class HtmlAnsiFormatter(HtmlFormatter): def _wrap_code(self, source): for i, t in source: if i == 1: # it's a line of formatted code - # Add ZWNJ for before each character because otherwise it's - # somehow impossible to wrap even with word-break: break-all. - # Not sure why (and not sure if this is the best solution), but - # had to ship a thing so there it is. Adding did not - # help. - t = _ansi_fg_bg_color_re.sub('style="color: #\\1; background-color: #\\1">‌', t) - t = _ansi_fg_color_re.sub('style="color: #\\1">‌', t) + t = _ansi_fg_bg_color_re.sub('style="color: #\\1; background-color: #\\1"', t) + t = _ansi_fg_color_re.sub('style="color: #\\1"', t) #t += 'H' yield i, t diff --git a/plugins/m/test/code/page.html b/plugins/m/test/code/page.html index 0af11332..a9f95582 100644 --- a/plugins/m/test/code/page.html +++ b/plugins/m/test/code/page.html @@ -39,11 +39,11 @@ ASan reports: =>0x0c287fff8030: 00[fc]fc fc fc fc fc fc fc fc fc fa fa fa fa fa

Console colors:

-
‌██ ‌██ ‌██ ‌██ ‌██ ‌▓▓ ‌▒▒
+
██ ██ ██ ██ ██ ▓▓ ▒▒
 
-Leading zeros: ‌▒▒ ‌▒▒
+Leading zeros: ▒▒ ▒▒
 
-  ‌░░ ‌▒▒ ‌▓▓ ‌██
+ ░░ ▒▒ ▓▓ ██
// this language is not highlighted

Properly preserve backslashes: \frac{a}{b} ... and backticks: :ref:`a function <os.path.join()>`