From a0c8676d1876c779876e757c3e23ac90f346aa80 Mon Sep 17 00:00:00 2001 From: MORIOKA Tomohiko Date: Wed, 1 Jun 2016 15:34:20 +0900 Subject: [PATCH] (char-db-ignored-attributes): Add `composition'. (char-db-json-insert-relation-feature): Use `char-db-json-insert-char-spec' even if running with readable mode. (char-db-json-insert-char-features): - Delete line-breaking for `=>ucs' and `=>ucs*'. - Delete setting for `japanese-radical', `ideographic-', `->ideograph', `ideograph=', `original-ideograph-of', `ancient-ideograph-of', `vulgar-ideograph-of', `wrong-ideograph-of' and `ideographic-variants' because they have been already abolished. (what-char-definition-json): Use `char-db-json-char-data-with-variant' with readable mode. --- char-db-json.el | 116 +++++++------------------------------------------------ 1 file changed, 15 insertions(+), 101 deletions(-) diff --git a/char-db-json.el b/char-db-json.el index d8044d1..b609842 100644 --- a/char-db-json.el +++ b/char-db-json.el @@ -30,6 +30,7 @@ (setq char-db-ignored-attributes '(ideographic-products + composition ;; ->HNG *instance@ruimoku/bibliography/title *instance@morpheme-entry/zh-classical)) @@ -367,11 +368,14 @@ (if separator (insert separator) (setq separator (format ",%s" lbs))) - (if readable - (insert (format "%S" cell)) - (char-db-json-insert-char-spec cell readable - nil - required-features)) + ;; (if readable + ;; (insert (format "%S" cell)) + ;; (char-db-json-insert-char-spec cell readable + ;; nil + ;; required-features)) + (char-db-json-insert-char-spec cell readable + nil + required-features) ) ((consp cell) (if separator @@ -512,9 +516,8 @@ (when (and (memq name attributes) (setq value (get-char-attribute char name))) (insert line-separator) - (insert (format " \"%-20s\": #x%04X,\t\"_comment\": \"%c\"%s" - name value (decode-char '=ucs value) - line-breaking)) + (insert (format " \"%-20s\": #x%04X,\t\"_comment\": \"%c\"" + name value (decode-char '=ucs value))) (setq attributes (delq name attributes)))) (dolist (name '(=>ucs@gb =>ucs@big5)) (when (and (memq name attributes) @@ -726,18 +729,6 @@ (setq strokes value))) (setq attributes (delq 'kangxi-strokes attributes)) ) - (when (and (memq 'japanese-radical attributes) - (setq value (get-char-attribute char 'japanese-radical))) - (unless (eq value radical) - (insert line-separator) - (insert (format "{\"japanese-radical\":\t%S},\t\"_comment\": \"%c\"%s" - value - (ideographic-radical value) - line-breaking)) - (or radical - (setq radical value))) - (setq attributes (delq 'japanese-radical attributes)) - ) (when (and (memq 'japanese-strokes attributes) (setq value (get-char-attribute char 'japanese-strokes))) (unless (eq value strokes) @@ -769,39 +760,6 @@ (setq strokes value))) (setq attributes (delq 'cns-strokes attributes)) ) - (when (and (memq 'ideographic- attributes) - (setq value (get-char-attribute char 'ideographic-))) - (insert line-separator) - (insert "{\"ideographic-\": ") - (setq lbs (concat "\n" (make-string (current-column) ?\ )) - separator nil) - (while (consp value) - (setq cell (car value)) - (if (integerp cell) - (setq cell (decode-char '=ucs cell))) - (cond ((characterp cell) - (if separator - (insert lbs)) - (if readable - (insert (format "%S" cell)) - (char-db-json-insert-char-spec cell readable)) - (setq separator lbs)) - ((consp cell) - (if separator - (insert lbs)) - (if (consp (car cell)) - (char-db-json-insert-char-spec cell readable) - (char-db-json-insert-char-reference cell readable)) - (setq separator lbs)) - (t - (if separator - (insert separator)) - (insert (prin1-to-string cell)) - (setq separator " "))) - (setq value (cdr value))) - (insert " }") - (insert line-breaking) - (setq attributes (delq 'ideographic- attributes))) (when (and (memq 'total-strokes attributes) (setq value (get-char-attribute char 'total-strokes))) (insert line-separator) @@ -810,22 +768,6 @@ )) (setq attributes (delq 'total-strokes attributes)) ) - (when (and (memq '->ideograph attributes) - (setq value (get-char-attribute char '->ideograph))) - (insert line-separator) - (insert (format "{\"->ideograph\":\t%s}%s" - (mapconcat (lambda (code) - (cond ((symbolp code) - (symbol-name code)) - ((integerp code) - (format "#x%04X" code)) - (t - (format "%s %S" - line-breaking code)))) - value " ") - line-breaking)) - (setq attributes (delq '->ideograph attributes)) - ) (if (equal (get-char-attribute char '->titlecase) (get-char-attribute char '->uppercase)) (setq attributes (delq '->titlecase attributes))) @@ -895,7 +837,7 @@ ) ((or (eq name 'ideographic-structure) (eq name 'ideographic-combination) - (eq name 'ideographic-) + ;; (eq name 'ideographic-) (eq name '=decomposition) (char-feature-base-name= '=decomposition name) (char-feature-base-name= '=>decomposition name) @@ -909,35 +851,6 @@ (char-db-json-insert-relation-feature char name value line-breaking ccss readable)) - ((memq name '(ideograph= - original-ideograph-of - ancient-ideograph-of - vulgar-ideograph-of - wrong-ideograph-of - ;; simplified-ideograph-of - ideographic-variants - ;; ideographic-different-form-of - )) - (insert line-separator) - (insert (format "{\"%-20s\":%s " name line-breaking)) - (setq lbs (concat "\n" (make-string (current-column) ?\ )) - separator nil) - (while (consp value) - (setq cell (car value)) - (if (and (consp cell) - (consp (car cell))) - (progn - (if separator - (insert lbs)) - (char-db-json-insert-alist cell readable) - (setq separator lbs)) - (if separator - (insert separator)) - (insert (prin1-to-string cell)) - (setq separator " ")) - (setq value (cdr value))) - (insert " }") - (insert line-breaking)) ((consp value) (insert line-separator) (insert (format " %-20s [ " @@ -1076,7 +989,8 @@ ;;;###autoload (defun what-char-definition-json (char) (interactive (list (char-after))) - (let ((buf (get-buffer-create "*Character Description*")) + (let ((est-hide-cgi-mode t) + (buf (get-buffer-create "*Character Description*")) (the-buf (current-buffer)) (win-conf (current-window-configuration))) (pop-to-buffer buf) @@ -1086,7 +1000,7 @@ (erase-buffer) (condition-case err (progn - (char-db-json-char-data-with-variant char nil) + (char-db-json-char-data-with-variant char 'printable) (unless (char-attribute-alist char) (insert (format "// = %c\n" (let* ((rest (split-char char)) -- 1.7.10.4