Commit c730ec01 authored by MORIOKA Tomohiko's avatar MORIOKA Tomohiko
Browse files

(chise-json-list-add-prefix): New function.

(chise-json-other-spec-get-radical-strokes): Add prefix `bib:' for
each item of `kangxi-radical-source', `kangxi-strokes-source' and
`total-strokes-source'.
(chise-json-char-get-info): Add prefix `bib:' for each item of
`sources' and *-source.
parent 19edb237
......@@ -1363,6 +1363,11 @@
nil)
t))))
(defun chise-json-list-add-prefix (sequence prefix)
(if sequence
(mapvector (lambda (item)
(format "%s:%s" prefix item)) sequence)))
(defun chise-json-other-spec-get-radical-strokes (other-spec)
(let (domain-rs-alist
radical
......@@ -1372,7 +1377,8 @@
((eq (caar cell) 'ideographic-radical)
(setq domain (cdar cell)
radical (cdr (assq 'body (cdr cell)))
sources (cdr (assq 'sources (cdr cell))))
sources (chise-json-list-add-prefix (cdr (assq 'sources (cdr cell)))
'bib))
(if (setq ret (assq domain domain-rs-alist))
(setcdr ret (nconc (list* (cons 'kangxi-radical-number radical)
(if sources
......@@ -1395,7 +1401,8 @@
)
((eq (caar cell) 'ideographic-strokes)
(setq domain (cdar cell)
sources (cdr (assq 'sources (cdr cell))))
sources (chise-json-list-add-prefix (cdr (assq 'sources (cdr cell)))
'bib))
(if (setq ret (assq domain domain-rs-alist))
(setcdr ret (nconc (list* (cons 'kangxi-strokes
(cdr (assq 'body (cdr cell))))
......@@ -1420,7 +1427,8 @@
)
((eq (caar cell) 'total-strokes)
(setq domain (cdar cell)
sources (cdr (assq 'sources (cdr cell))))
sources (chise-json-list-add-prefix (cdr (assq 'sources (cdr cell)))
'bib))
(if (setq ret (assq domain domain-rs-alist))
(setcdr ret (nconc (list* (cons 'total-strokes
(cdr (assq 'body (cdr cell))))
......@@ -2250,6 +2258,7 @@
anno-id
domain code
kangxi-radical kangxi-strokes total-strokes
reldesc sources
dest rest)
(setq char-info (chise-json-separate-normalized-spec
(chise-json-char-get-normalized-spec char subnode char-spec)
......@@ -2312,17 +2321,20 @@
(cons
'relations
(mapcar (lambda (cell)
(cons
(setq ret (if (cdar cell)
(format "%s@%s" (caar cell)(cdar cell))
(caar cell)))
(list*
(cons '@id (setq anno-id
(format "%s/%s"
id (www-uri-encode-feature-name ret))))
(cons 'reldesc
(progn
(setq i 0)
(setq ret (if (cdar cell)
(format "%s@%s" (caar cell)(cdar cell))
(caar cell)))
(setq anno-id
(format "%s/%s"
id (www-uri-encode-feature-name ret)))
(setq reldesc nil
sources nil
rest nil)
(dolist (item (cdr cell))
(cond
((eq (car item) 'body)
(setq i 0)
(setq reldesc
(mapvector
(lambda (spec)
(setq i (1+ i))
......@@ -2337,10 +2349,34 @@
'target
(chise-json-char-get-ref-info (cdr feat)))
)
((eq (car feat) 'sources)
(cons 'sources
(chise-json-list-add-prefix
(cdr feat) 'bib))
)
(t feat)))
spec)))
(cdr (assq 'body (cdr cell))))))
(del-alist 'body (cdr cell)))))
(sort spec
(lambda (a b)
(string< (car a)(car b)))))))
(cdr item)))
)
((eq (car item) 'sources)
(setq sources (chise-json-list-add-prefix (cdr item) 'bib))
)
(t
(setq rest (cons item rest))
)))
(cons
ret
(list*
(cons '@id anno-id)
(cons 'reldesc reldesc)
(sort (if sources
(cons (cons 'sources sources)
rest)
rest)
(lambda (a b)
(string< (car a)(car b)))))))
(sort relation-spec
#'chise-json-normalized-feature<)))
dest)))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment