Add \ to emphasis post chars to allow immediate explicit line break

Post chars are defined in (nth 1 org-emphasis-regexp-components) in emacs org.
When I initially adapted the list of chars for go, I failed to check how it's
actually used (further down in org.el):
  (string-match (concat "[" (nth 1 erc) "\n]") (char-to-string (char-after (point))))

Due to the surrounding [] the `\\` in
  '("-[:space:]('\"{" "-[:space:].,:!?;'\")}\\[" "[:space:]" "." 1)

is actually a literal backslash, not an escape of the opening bracket I
guess. I'm not in the mood for thinking any harder about this, so let's hope
this is right. yolo.
This commit is contained in:
Niklas Fasching 2022-09-20 17:00:44 +02:00
parent 3082cbe04e
commit f27340ed5e
4 changed files with 7 additions and 1 deletions

View file

@ -394,7 +394,7 @@ func isValidPreChar(r rune) bool {
} }
func isValidPostChar(r rune) bool { func isValidPostChar(r rune) bool {
return r == utf8.RuneError || unicode.IsSpace(r) || strings.ContainsRune(`-.,:!?;'")}[`, r) return r == utf8.RuneError || unicode.IsSpace(r) || strings.ContainsRune(`-.,:!?;'")}[\`, r)
} }
func isValidBorderChar(r rune) bool { return !unicode.IsSpace(r) } func isValidBorderChar(r rune) bool { return !unicode.IsSpace(r) }

View file

@ -6,6 +6,8 @@ also hard line breaks not followed by a newline get ignored, see \\</li>
<li><em>emphasis with a slash/inside</em></li> <li><em>emphasis with a slash/inside</em></li>
<li><em>emphasis</em> followed by raw text with slash /</li> <li><em>emphasis</em> followed by raw text with slash /</li>
<li><strong>emphasis ending with a &#34;difficult&#34; multibyte character 习</strong></li> <li><strong>emphasis ending with a &#34;difficult&#34; multibyte character 习</strong></li>
<li>emphasis just before <code class="verbatim">explict line break</code><br>
<code class="verbatim">plus more emphasis</code></li>
<li>-&gt;/not an emphasis/&lt;-</li> <li>-&gt;/not an emphasis/&lt;-</li>
<li>links with slashes do not become <em>emphasis</em>: <a href="https://somelinkshouldntrenderaccidentalemphasis.com">https://somelinkshouldntrenderaccidentalemphasis.com</a>/ <em>emphasis</em></li> <li>links with slashes do not become <em>emphasis</em>: <a href="https://somelinkshouldntrenderaccidentalemphasis.com">https://somelinkshouldntrenderaccidentalemphasis.com</a>/ <em>emphasis</em></li>
<li><span style="text-decoration: underline;">underlined</span> <strong>bold</strong> <code class="verbatim">verbatim</code> <code>code</code> <del>strikethrough</del></li> <li><span style="text-decoration: underline;">underlined</span> <strong>bold</strong> <code class="verbatim">verbatim</code> <code>code</code> <del>strikethrough</del></li>

View file

@ -5,6 +5,8 @@
- /emphasis with a slash/inside/ - /emphasis with a slash/inside/
- /emphasis/ followed by raw text with slash / - /emphasis/ followed by raw text with slash /
- *emphasis ending with a "difficult" multibyte character 习* - *emphasis ending with a "difficult" multibyte character 习*
- emphasis just before =explict line break=\\
=plus more emphasis=
- ->/not an emphasis/<- - ->/not an emphasis/<-
- links with slashes do not become /emphasis/: [[https://somelinkshouldntrenderaccidentalemphasis.com]]/ /emphasis/ - links with slashes do not become /emphasis/: [[https://somelinkshouldntrenderaccidentalemphasis.com]]/ /emphasis/
- _underlined_ *bold* =verbatim= ~code~ +strikethrough+ - _underlined_ *bold* =verbatim= ~code~ +strikethrough+

View file

@ -5,6 +5,8 @@
- /emphasis with a slash/inside/ - /emphasis with a slash/inside/
- /emphasis/ followed by raw text with slash / - /emphasis/ followed by raw text with slash /
- *emphasis ending with a "difficult" multibyte character 习* - *emphasis ending with a "difficult" multibyte character 习*
- emphasis just before =explict line break=\\
=plus more emphasis=
- ->/not an emphasis/<- - ->/not an emphasis/<-
- links with slashes do not become /emphasis/: [[https://somelinkshouldntrenderaccidentalemphasis.com]]/ /emphasis/ - links with slashes do not become /emphasis/: [[https://somelinkshouldntrenderaccidentalemphasis.com]]/ /emphasis/
- _underlined_ *bold* =verbatim= ~code~ +strikethrough+ - _underlined_ *bold* =verbatim= ~code~ +strikethrough+