@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 "[[:multibyte:]]")
(fixed-contents
(replace-regexp-in-string
(concat
"\\(" fix-regexp "\\) *\n *\\(" fix-regexp "\\)") "\\1\\2" origin-contents)))
(ad-set-arg 1 fixed-contents)))
nah, this site usually has a really high rank in search results as I inspect, my guess is that Discourse (the forum template/software) really knows what it’s doing.
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.
Thanks for the enquiry which is very thoughtful. I know little about elisp development so I am not qualified to give feedback regarding the technicality.
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 do agree with this opinion. As long as this is stated in manual (or in sovled Github issue), it sounds good to me.
Please feel free to let me know for further issue. And thanks again for the prompt improvement.
I was on vacation. But this change (use of the #+language to disable line breaks between multibyte chars) be committed very soon, now this week. Thanks for the feedback.
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”).
Example:
#+hugo_base_dir: .
#+hugo_locale: zh_CH
* Filling automatically not preserved for Chinese characters (preserve filling on)
:PROPERTIES:
:EXPORT_FILE_NAME: filling-not-preserved-for-chinese-characters--preserve-filling-on
:EXPORT_HUGO_PRESERVE_FILLING: t
:END:
#+begin_description
Ensure that multi-byte characters are force-unwrapped if the locale is
manually set or auto-detected as Chinese.
#+end_description
abc
def
ghi
这是一个测试
文本