Unwrap Japanese characters without inserting space as well

Ref: https://github.com/kaushalmodi/ox-hugo/issues/320
master
Kaushal Modi 6 years ago
parent d2892b3b5e
commit 0fafc2a01e
  1. 14
      doc/ox-hugo-manual.org
  2. 15
      ox-hugo.el

@ -2846,9 +2846,10 @@ Here's an example of inlining an SVG:
#+caption: An SVG with hyperlink
#+attr_html: :inlined t
[[file:../test/site/content-org/images/svg-with-hyperlinks.svg]]
*** Chinese Support
*** CJK Support
:PROPERTIES:
:EXPORT_FILE_NAME: chinese-support
:EXPORT_FILE_NAME: cjk-support
:EXPORT_HUGO_ALIASES: chinese-support japanese-support
:END:
**** Auto-unwrapping of lines with multi-byte characters
This issue came up on this [[https://emacs-china.org/t/ox-hugo-auto-fill-mode-markdown/9547][emacs-china thread]] .. the issue was that
@ -2865,10 +2866,11 @@ other languages with multi-byte characters (few examples: Hindi,
Gujarati).
So that line-unwrapping _with space removal_ is done *only if*,
1. The /locale/ is [[https://www.gnu.org/software/gettext/manual/html_node/Locale-Environment-Variables.html][auto-detected]] to be Chinese via environment
variables /LANGUAGE/, /LC_ALL/ or /LANG/, or
2. The /locale/ is *manually set* to Chinese by setting it to *zh*
using ~#+hugo_locale:~ keyword (or ~EXPORT_HUGO_LOCALE~ property).
1. The /locale/ is [[https://www.gnu.org/software/gettext/manual/html_node/Locale-Environment-Variables.html][auto-detected]] to be Chinese or Japanese via
environment variables /LANGUAGE/, /LC_ALL/ or /LANG/, or
2. The /locale/ is *manually set* to Chinese or Japanese by setting it
to *zh* or *ja* using ~#+hugo_locale:~ keyword (or
~EXPORT_HUGO_LOCALE~ property).
*** COMMENT Hugo Bundle
:PROPERTIES:
:EXPORT_FILE_NAME: hugo-bundle

@ -1,6 +1,6 @@
;;; ox-hugo.el --- Hugo Markdown Back-End for Org Export Engine -*- lexical-binding: t -*-
;; Authors: Kaushal Modi <kaushal.mod@gmail.com>
;; Authors: Kaushal Modi <kaushal.modi@gmail.com>
;; Matt Price <moptop99@gmail.com>
;; URL: https://ox-hugo.scripter.co
;; Package-Requires: ((emacs "24.4") (org "9.0"))
@ -2466,11 +2466,14 @@ communication channel."
;; (message "[org-hugo-paragraph DBG] para 1: %s" contents)
;; Join consecutive Chinese lines into a single long line without
;; unwanted space inbetween.
(let ((lang (org-hugo--get-lang info)))
(when (and lang
(string-prefix-p "zh" lang)) ;"zh", "zh_CH", ..
;; Join consecutive Chinese, Japanese lines into a single long
;; line without unwanted space inbetween.
(let* ((lang (org-hugo--get-lang info))
(lang-2chars (when (and (stringp lang)
(>= (length lang) 2))
(substring lang 0 2))))
(when (and lang-2chars
(member lang-2chars '("zh" "ja"))) ;"zh", "zh_CH", "ja", ..
;; https://emacs-china.org/t/ox-hugo-auto-fill-mode-markdown/9547/5
;; Example: 这是一个测试 -> 这是一个测试文本 ("This is a test text")
;; 文本

Loading…
Cancel
Save