@smallzhan 这个在 Doom Emacs chinese layer 里面有，但是有点问题：
org-html-paragraph: Wrong number of arguments: ((t) (paragraph contents info) "Join consecutive Chinese lines into a single long line without unwanted space
when exporting org-mode to html." (let* ((fix-regexp "[[:multibyte:]]") (origin-contents contents) (fixed-contents (replace-regexp-in-string (concat "\\(" fix-regexp "\\) *
*\\(" fix-regexp "\\)") "\\1\\2" origin-contents))) (list paragraph fixed-contents info))), 1
(defadvice org-hugo-paragraph (before org-hugo-paragraph-advice
(paragraph contents info) activate)
"Join consecutive Chinese lines into a single long line without
unwanted space when exporting org-mode to hugo markdown."
(let* ((origin-contents (ad-get-arg 1))
"\\(" fix-regexp "\\) *\n *\\(" fix-regexp "\\)") "\\1\\2" origin-contents)))
(ad-set-arg 1 fixed-contents)))
My goodness, you are incredible. I browsed many ox-hugo posts in forums and noticed that you’ve been searching articles/questions, providing feedbacks/answers. Just wasn’t expecting you’d go all the way to translate to answer the post. Thank you.
I am not surprised seeing that bug report because that auto-fill behavior change is not common in the multi-byte char scripts I know of too: Gujarati, Hindi.
So, would it be OK, If I enable the autofill behavior in the above mentioned commit only if #+language: zh is set in the Org file?
I think that would be much simpler and performance efficient than using regular expression to parse if the multi-byte char fits in the Chinese char range of unicodes. I will also make that an elisp variable that can hold a list of strings, so that people can add more language codes to that list.
If that does not work automatically, user can explicitly specify the locale to be Chinese by adding #+hugo_locale: zh keyword or :EXPORT_HUGO_LOCALE: zh property to a subtree’s property drawer. (Any local string that begins with “zh” will work, like “zh_CH”).
* Filling automatically not preserved for Chinese characters (preserve filling on)
Ensure that multi-byte characters are force-unwrapped if the locale is
manually set or auto-detected as Chinese.