2 (require 'cwiki-common)
4 (defun www-format-encode-string (string &optional without-tags as-body)
7 (let (plane code subcode start end char variants ret rret)
9 (goto-char (point-min))
10 (while (search-forward "&" nil t)
11 (replace-match "&" nil t)))
12 (goto-char (point-min))
13 (while (search-forward "<" nil t)
14 (replace-match "<" nil t))
15 (goto-char (point-min))
16 (while (search-forward ">" nil t)
17 (replace-match ">" nil t))
19 (encode-coding-region (point-min)(point-max) 'utf-8-mcs-er)
20 (let ((coded-charset-entity-reference-alist
21 est-coded-charset-entity-reference-alist))
22 (encode-coding-region (point-min)(point-max) 'utf-8-mcs-er)
24 (goto-char (point-min))
25 (while (re-search-forward "&\\(A-\\|G-\\|g2-\\|R-\\)?CB\\([0-9]+\\);" nil t)
26 (setq code (string-to-int (match-string 2)))
28 (format "<img alt=\"CB%05d\" src=\"%s/cb-gaiji/%02d/CB%05d.gif\"
31 chise-wiki-legacy-bitmap-glyphs-url
33 www-format-char-img-style)
36 (goto-char (point-min))
37 (while (re-search-forward "&\\(o-\\|G-\\|g2-\\|R-\\)?J\\(78\\|83\\|90\\|97\\|SP\\)-\\([0-9A-F][0-9A-F][0-9A-F][0-9A-F]\\);" nil t)
38 (setq plane (match-string 2)
39 code (string-to-int (match-string 3) 16))
41 (format "<img alt=\"J%s-%04X\" src=\"%s/JIS-%s/%02d-%02d.gif\"
44 chise-wiki-legacy-bitmap-glyphs-url
47 (- (logand code 255) 32)
48 www-format-char-img-style)
51 (goto-char (point-min))
52 (while (re-search-forward "&\\(o-\\|G-\\|g2-\\|R-\\)?J0-\\([0-9A-F][0-9A-F][0-9A-F][0-9A-F]\\);" nil t)
53 (setq code (string-to-int (match-string 2) 16))
55 (format "<img alt=\"J0-%04X\" src=\"%s/JIS-90/%02d-%02d.gif\"
58 chise-wiki-legacy-bitmap-glyphs-url
60 (- (logand code 255) 32)
61 www-format-char-img-style)
64 (goto-char (point-min))
65 (while (re-search-forward "&\\(o-\\|G-\\|g2-\\|R-\\)?HD-\\(JA\\|JB\\|JC\\|JD\\|FT\\|IA\\|IB\\|HG\\)-\\([0-9A-F][0-9A-F][0-9A-F][0-9A-F]\\);" nil t)
66 (setq plane (match-string 2)
67 code (string-to-int (match-string 3) 16))
69 (format "<img alt=\"HD-%s-%04X\" src=\"%s/IVD/HanyoDenshi/%s%02d%02d.png\"
72 chise-wiki-legacy-bitmap-glyphs-url
75 (- (logand code 255) 32)
76 www-format-char-img-style)
79 (goto-char (point-min))
80 (while (re-search-forward "&\\(o-\\|G-\\|g2-\\|R-\\)?HD-\\(IP\\|JT\\)-\\([0-9A-F][0-9A-F][0-9A-F][0-9A-F]\\);" nil t)
81 (setq plane (match-string 2)
82 code (string-to-int (match-string 3) 16))
84 (format "<img alt=\"HD-%s-%04X\" src=\"%s/IVD/HanyoDenshi/%s%04X.png\"
87 chise-wiki-legacy-bitmap-glyphs-url
89 www-format-char-img-style)
92 (goto-char (point-min))
93 (while (re-search-forward "&\\(o-\\|G-\\|g2-\\|R-\\)?HD-KS-\\([0-9]+\\);" nil t)
94 (setq code (string-to-int (match-string 2)))
96 (format "<img alt=\"HD-KS%06d\" src=\"%s/IVD/HanyoDenshi/KS%06d.png\"
97 style=\"vertical-align:middle\">"
99 chise-wiki-legacy-bitmap-glyphs-url
101 www-format-char-img-style)
104 (goto-char (point-min))
105 (while (re-search-forward "&\\(o-\\|G-\\|g2-\\|R-\\)?HD-TK-\\([0-9]+\\);" nil t)
106 (setq code (string-to-int (match-string 2)))
108 (format "<img alt=\"HD-KS%06d\" src=\"%s/IVD/HanyoDenshi/TK%08d.png\"
109 style=\"vertical-align:middle\">"
111 chise-wiki-legacy-bitmap-glyphs-url
113 www-format-char-img-style)
116 (goto-char (point-min))
117 (while (re-search-forward "&G\\([01]\\)-\\([0-9A-F][0-9A-F][0-9A-F][0-9A-F]\\);" nil t)
118 (setq plane (string-to-int (match-string 1))
119 code (string-to-int (match-string 2) 16))
121 (format "<img alt=\"GB%d-%04X\" src=\"%s/GB%d/%02d-%02d.gif\"
124 chise-wiki-legacy-bitmap-glyphs-url
127 (- (logand code 255) 32)
128 www-format-char-img-style)
131 (goto-char (point-min))
132 (while (re-search-forward "&\\(R-\\)?C\\([1-7]\\)-\\([0-9A-F][0-9A-F][0-9A-F][0-9A-F]\\);" nil t)
133 (setq plane (string-to-int (match-string 2))
134 code (string-to-int (match-string 3) 16))
136 (format "<img alt=\"CNS%d-%04X\" src=\"%s/CNS%d/%04X.gif\"
139 chise-wiki-legacy-bitmap-glyphs-url
141 www-format-char-img-style)
144 (goto-char (point-min))
145 (while (re-search-forward "&\\(R-\\)?JC3-\\([0-9A-F][0-9A-F][0-9A-F][0-9A-F]\\);" nil t)
146 (setq code (string-to-int (match-string 2) 16))
148 (format "<img alt=\"JC3-%04X\" src=\"%s/JEF-CHINA3/%04X.png\">"
149 code chise-wiki-bitmap-glyph-image-url code)
152 (goto-char (point-min))
153 (while (re-search-forward "&\\(A-\\)?ZOB-\\([0-9]+\\);" nil t)
154 (setq code (string-to-int (match-string 2)))
156 (format "<img alt=\"ZOB-%04d\" src=\"%s/ZOB-1968/%04d.png\"
157 style=\"vertical-align:middle\">"
159 chise-wiki-legacy-bitmap-glyphs-url
161 www-format-char-img-style)
164 (goto-char (point-min))
165 (while (re-search-forward "&\\(A2-\\|g2-\\|R-\\)?DJT-\\([0-9]+\\);" nil t)
166 (setq code (string-to-int (match-string 2)))
168 (format "<img alt=\"DJT-%05d\" src=\"%s/%05d.png\"
169 style=\"vertical-align:middle; width: auto; max-height: 60px\">"
171 chise-wiki-daijiten-bitmap-glyphs-url
173 www-format-char-img-style)
176 (goto-char (point-min))
177 (while (re-search-forward "&SW-JIGUGE\\([45]?\\)-\\([0-9]+\\);" nil t)
178 (setq subcode (match-string 1)
179 code (string-to-int (match-string 2)))
181 (if (string= subcode "")
185 (format "<img alt=\"SW-JIGUGE%s-%05d\" src=\"%s/ShuoWen/Jiguge%s/%05d.png\"
186 style=\"vertical-align:middle; width: auto; max-height: 80px\">"
188 chise-wiki-legacy-bitmap-glyphs-url
192 (goto-char (point-min))
193 (while (re-search-forward "&HNG\\([0-9]+\\)-\\([0-9][0-9][0-9][0-9]\\)\\([0-9]\\);" nil t)
194 (setq plane (match-string 1)
195 code (string-to-int (match-string 2))
196 subcode (string-to-int (match-string 3)))
200 (char-to-string (decode-char 'ascii (+ 96 subcode)))))
203 "<img alt=\"HNG%s-%04d%s\" src=\"%s/%s/%04d%s.png\" style=\"
204 vertical-align:middle; width: auto; max-height: 60px\">"
206 chise-wiki-hng-bitmap-glyphs-url
211 (goto-char (point-min))
212 (while (re-search-forward "&\\(R-\\)?CHISE-HDIC-TSJ\\([0-9A-F]+\\);" nil t)
213 (setq code (string-to-int (match-string 2) 16))
214 (setq char (decode-char '===chise-hdic-tsj code))
215 (when (setq ret (get-char-attribute char '=hdic-tsj-glyph-id))
218 "<img alt=\"HDIC-TSJ-%s\" src=\"https://viewer.hdic.jp/img/tsj/%s.jpg\" style=\"
219 vertical-align:middle; width: auto; max-height: 60px\">"
223 (goto-char (point-min))
224 (while (re-search-forward "&\\(R-\\)?CHISE-HDIC-SYP\\([0-9A-F]+\\);" nil t)
225 (setq code (string-to-int (match-string 2) 16))
226 (setq char (decode-char '===chise-hdic-syp code))
227 (when (setq ret (get-char-attribute char '=hdic-syp-entry-id))
230 "<img alt=\"HDIC-SYP-%s\" src=\"https://viewer.hdic.jp/img/syp/%s\" style=\"
231 vertical-align:middle; width: auto; max-height: 60px\">"
235 (goto-char (point-min))
236 (while (re-search-forward "&\\(R-\\)?CHISE-HDIC-KTB\\([0-9A-F]+\\);" nil t)
237 (setq code (string-to-int (match-string 2) 16))
238 (setq char (decode-char '===chise-hdic-ktb code))
239 (when (setq ret (get-char-attribute char '=hdic-ktb-entry-id))
242 "<img alt=\"HDIC-KTB-%s\" src=\"https://hdic.chise.org/img/ktb/%s.jpg\" style=\"
243 vertical-align:middle; width: auto; max-height: 60px\">"
247 (goto-char (point-min))
248 (while (re-search-forward "&\\(o-\\|G-\\|g2-\\|R-\\)?AJ1-\\([0-9]+\\);" nil t)
249 (setq code (string-to-int (match-string 2)))
251 (format "<img alt=\"AJ1-%05d\" src=\"%s/IVD/AdobeJapan1/CID+%d.png\"
252 style=\"vertical-align:middle\">"
254 chise-wiki-legacy-bitmap-glyphs-url
256 www-format-char-img-style)
259 (goto-char (point-min))
260 (while (re-search-forward "&\\(A-\\|o-\\|G-\\|g2-\\|R-\\)?MJ\\([0-9]+\\);" nil t)
261 (setq code (string-to-int (match-string 2)))
263 (format "<img alt=\"MJ%06d\" src=\"https://moji.or.jp/mojikibansearch/img/MJ/MJ%06d.png\"
264 style=\"vertical-align:middle; width: 48px; height: 48px\">"
267 www-format-char-img-style)
270 (goto-char (point-min))
271 (while (re-search-forward "&\\(o-\\|G-\\|g2-\\)?IU[+-]\\([0-9A-F]+\\);" nil t)
272 (setq code (string-to-int (match-string 2) 16))
274 (format "<img alt=\"u%04x\" src=\"%s/u%04x.svg\"
275 style=\"vertical-align:middle; width: 48px; height: 48px\">"
277 chise-wiki-glyphwiki-glyph-image-url
279 www-format-char-img-style)
282 (goto-char (point-min))
283 (while (re-search-forward "&\\(o-\\|G-\\|g2-\\|R-\\)?KU[+-]\\([0-9A-F]+\\);" nil t)
284 (setq code (string-to-int (match-string 2) 16))
286 (format "<img alt=\"u%04x-k\" src=\"%s/u%04x-k.svg\"
287 style=\"vertical-align:middle; width: 48px; height: 48px\">"
289 chise-wiki-glyphwiki-glyph-image-url
291 www-format-char-img-style)
294 (goto-char (point-min))
295 (while (re-search-forward "&A-\\(comp\\|cgn\\)U[+-]\\([0-9A-F]+\\);" nil t)
296 (setq code (string-to-int (match-string 2) 16))
298 (format "<img alt=\"u%04x\" src=\"%s/u%04x.svg\"
299 style=\"vertical-align:middle; width: 48px; height: 48px\">"
301 chise-wiki-glyphwiki-glyph-image-url
303 www-format-char-img-style)
306 (goto-char (point-min))
307 (while (re-search-forward
308 "&\\(A-\\|g2-\\)?U-i\\([0-9]+\\)\\+\\([0-9A-F]+\\);"
310 (setq plane (string-to-int (match-string 2))
311 code (string-to-int (match-string 3) 16))
313 (format "<img alt=\"u%04x-itaiji-%03d\" src=\"%s/u%04x-itaiji-%03d.svg\"
314 style=\"vertical-align:middle; width: 48px; height: 48px\">"
317 chise-wiki-glyphwiki-glyph-image-url
320 www-format-char-img-style)
323 (goto-char (point-min))
324 (while (re-search-forward "&A-IWDSU\\+\\([0-9A-F]+\\);" nil t)
325 (setq code (string-to-int (match-string 1) 16))
327 (format "<img alt=\"A-IWDSU+%04x\" src=\"%s/u%04x.svg\"
328 style=\"vertical-align:middle; width: 48px; height: 48px\">"
330 chise-wiki-glyphwiki-glyph-image-url
332 www-format-char-img-style)
335 (goto-char (point-min))
336 (while (re-search-forward
337 "&\\(A-\\)?CDP-i\\([0-9]+\\)-\\([0-9A-F]+\\);"
339 (setq plane (string-to-int (match-string 2))
340 code (string-to-int (match-string 3) 16))
342 (format "<img alt=\"cdp-%04x-itaiji-%03d\" src=\"%s/cdp-%04x-itaiji-%03d.svg\"
343 style=\"vertical-align:middle; width: 48px; height: 48px\">"
346 chise-wiki-glyphwiki-glyph-image-url
349 www-format-char-img-style)
352 (goto-char (point-min))
353 (while (re-search-forward
354 "&\\(A-\\)?CDP-v\\([0-9]+\\)-\\([0-9A-F]+\\);"
356 (setq plane (string-to-int (match-string 2))
357 code (string-to-int (match-string 3) 16))
359 (format "<img alt=\"cdp-%04x-var-%03d\" src=\"%s/cdp-%04x-var-%03d.svg\"
360 style=\"vertical-align:middle; width: 48px; height: 48px\">"
363 chise-wiki-glyphwiki-glyph-image-url
366 www-format-char-img-style)
369 (goto-char (point-min))
370 (while (re-search-forward
371 "&\\(A-\\|G-\\|g2-\\|R-\\)?M-\\([0-9]+\\);"
373 (setq code (string-to-int (match-string 2)))
375 (format "<img alt=\"dkw-%05d\" src=\"%s/dkw-%05d.svg\"
376 style=\"vertical-align:middle; width: 48px; height: 48px\">"
378 chise-wiki-glyphwiki-glyph-image-url
380 www-format-char-img-style)
383 (goto-char (point-min))
384 (while (re-search-forward "&\\(g2-\\)?U-v\\([0-9]+\\)\\+\\([0-9A-F]+\\);" nil t)
385 (setq plane (string-to-int (match-string 2))
386 code (string-to-int (match-string 3) 16))
388 (format "<img alt=\"u%04x-var-%03d\" src=\"%s/u%04x-var-%03d.svg\"
389 style=\"vertical-align:middle; width: 48px; height: 48px\">"
392 chise-wiki-glyphwiki-glyph-image-url
395 www-format-char-img-style)
398 (goto-char (point-min))
399 (while (re-search-forward "&\\(A-\\|G-\\|R-\\|g2-\\)?GT-\\([0-9]+\\);" nil t)
400 (setq code (string-to-int (match-string 2)))
402 (format "<img alt=\"GT-%05d\" src=\"%s?char=GT-%05d\"
405 chise-wiki-glyph-cgi-url
407 www-format-char-img-style)
410 (goto-char (point-min))
411 (while (re-search-forward "&\\(A-\\|G-\\|g2-\\)?GT-K\\([0-9]+\\);" nil t)
412 (setq code (string-to-int (match-string 2)))
414 (format "<img alt=\"GT-K%05d\" src=\"%s?char=GT-K%05d\"
417 chise-wiki-glyph-cgi-url
419 www-format-char-img-style)
422 (goto-char (point-min))
423 (while (re-search-forward "&B-\\([0-9A-F]+\\);" nil t)
424 (setq code (string-to-int (match-string 1) 16))
426 (format "<img alt=\"B-%04X\" src=\"%s?char=B-%04X\"
429 chise-wiki-glyph-cgi-url
431 www-format-char-img-style)
434 (goto-char (point-min))
435 (while (re-search-forward
436 "&\\(A-\\|G-\\|g2-\\|R-\\)?CDP-\\([0-9A-F]+\\);" nil t)
437 (setq code (string-to-int (match-string 2) 16))
439 (format "<img alt=\"CDP-%04X\" src=\"%s?char=CDP-%04X\"
442 chise-wiki-glyph-cgi-url
444 www-format-char-img-style)
447 (goto-char (point-min))
448 (while (re-search-forward
449 "&\\(I-\\)?HZK\\(0[1-9]\\|1[0-2]\\)-\\([0-9A-F]+\\);" nil t)
450 (setq plane (match-string 2)
451 code (string-to-int (match-string 3) 16))
453 (format "<img alt=\"HZK%s-%04X\" src=\"%s?char=HZK%s-%04X\"
457 chise-wiki-glyph-cgi-url
460 www-format-char-img-style)
463 (goto-char (point-min))
464 (while (re-search-forward "&\\(A-\\|G-\\|g2-\\|R-\\)?RUI6-\\([0-9A-F]+\\);" nil t)
465 (setq code (string-to-int (match-string 2) 16))
467 (format "<img alt=\"RUI6-%04X\" src=\"%s?char=RUI6-%04X\"
468 style=\"vertical-align:middle\">"
470 chise-wiki-glyph-cgi-url
472 www-format-char-img-style)
475 (goto-char (point-min))
476 (while (re-search-forward "&hanaJU\\+\\([0-9A-F]+\\);" nil t)
477 (setq code (string-to-int (match-string 1) 16))
479 (format "<img alt=\"hanaJU+%04X\" src=\"%s?char=hana-JU+%04X\"
480 style=\"vertical-align:middle\">"
482 chise-wiki-glyph-cgi-url
484 www-format-char-img-style)
487 (goto-char (point-min))
488 (while (re-search-forward "&\\(A-\\|G-\\|g2-\\|R-\\)?\\(UU\\+\\|U-\\)\\([0-9A-F]+\\);" nil t)
489 (setq code (string-to-int (match-string 3) 16))
491 (format "<img alt=\"UU+%04X\" src=\"https://www.unicode.org/cgi-bin/refglyph?24-%04X\"
492 style=\"vertical-align:middle\">"
495 www-format-char-img-style)
498 (goto-char (point-min))
499 (while (re-search-forward "&MCS-\\([0-9A-F]+\\);" nil t)
500 (setq code (string-to-int (match-string 1) 16))
501 (setq start (match-beginning 0)
503 (setq char (decode-char 'system-char-id code))
506 (or (www-get-feature-value char '->subsumptive)
507 (www-get-feature-value char '->denotational)))
509 (if (characterp variants)
510 (setq variants (list variants)))
512 (setq ret (www-format-encode-string
513 (char-to-string (car variants))))
514 (string-match "&MCS-\\([0-9A-F]+\\);" ret))
515 (setq variants (cdr variants)))
517 (unless (string-match "&MCS-\\([0-9A-F]+\\);" ret)
519 (delete-region start end)
522 ((setq ret (or (www-get-feature-value char 'ideographic-combination)
523 (www-get-feature-value char 'ideographic-structure)))
528 (if (characterp (setq rret (find-char ch)))
531 (www-format-encode-string
532 (char-to-string ch) without-tags)
533 (www-format-encode-string
534 (format "%S" ch) without-tags)))
538 (delete-region start end)
542 ;; (goto-char (point-min))
543 ;; (while (search-forward ">-" nil t)
544 ;; (replace-match "&GT-" t 'literal))
547 (setq www-format-char-img-style "vertical-align:middle;")
549 (defun decode-url-string (string &optional coding-system)
550 (if (> (length string) 0)
553 (while (string-match "%\\([0-9A-F][0-9A-F]\\)" string i)
554 (setq dest (concat dest
555 (substring string i (match-beginning 0))
558 (string-to-int (match-string 1 string) 16))))
560 (decode-coding-string
561 (concat dest (substring string i))
564 (defconst www-ids-find-version "0.100.2")
566 (defvar www-ids-find-ideographic-products-file-name
567 (expand-file-name "ideographic-products"
572 chise-system-db-directory))))
574 (defvar www-ids-find-char-viewer-url
575 "/est/view/character/")
577 (defvar www-ids-find-chise-link-map-url-prefix
578 "http://fonts.jp/chise_linkmap/map.cgi?code=")
580 (defvar www-ids-find-tang-chars-file-name
581 "~tomo/projects/chise/ids/www/tang-chars.udd")
583 (defun www-ids-find-format-char (c &optional code-desc)
584 (let* ((ucs (encode-char c '=ucs)))
586 (format "<a href=\"%s%s\">%s</a>"
587 www-ids-find-char-viewer-url
588 (www-uri-encode-object c)
590 (format "<img alt=\"u%04x\" src=\"%s/u%04x.svg\" style=\"vertical-align:middle; width: 60px; height: 60px\"/>%s"
592 chise-wiki-glyphwiki-glyph-image-url
595 (encode-coding-string (format " (%c)" c) 'utf-8-mcs-er)
597 (www-format-encode-string (char-to-string c)))))
600 (defun www-ids-find-format-ids (ids &optional code-desc)
605 (www-ids-find-format-char (aref ids i))
612 (setq ucs (or (char-ucs c)
613 (encode-char c '=>ucs@iso)
614 (encode-char c '=>ucs@unicode)
615 (encode-char c '=>ucs@iwds-1)
616 (encode-char c '=>ucs@iwds-1/normalized)
617 (encode-char c '=>ucs@component)
618 (encode-char c '=>ucs@cognate)))
620 (encode-coding-string
621 (char-to-string (decode-char '=ucs ucs))
625 (setq ret (encode-coding-string
626 (char-to-string c) 'utf-8-mcs-er))
627 (if (eq (aref ret 0) ?&)
628 (concat "&" (substring ret 1)))
632 (defun www-ids-find-format-line (c is)
634 (princ "<span class=\"entry\">")
635 (www-ids-find-format-char c 'code-desc)
638 (or (if (setq ucs (or (char-ucs c)
639 (encode-char c 'ucs)))
641 " <a href=\"http://www.unicode.org/cgi-bin/GetUnihanData.pl?codepoint=%X\">%s</a>"
643 (cond ((<= ucs #xFFFF)
644 (format "U+%04X" ucs))
646 (format "U-%08X" ucs))))
650 (format " <a href=\"%s%X\">(link map)</a>"
651 www-ids-find-chise-link-map-url-prefix ucs)))
653 ;; (www-ids-find-format-ideographic-structure is 'code-desc)
655 (setq ids (ideographic-structure-to-ids is))
658 (princ "<span class=\"ids\">")
659 (www-ids-find-format-ids ids 'code-desc)
661 ;; (www-ids-find-format-char (aref ids i))
667 www-ids-find-tang-chars-file-name)
668 (goto-char (point-min))
669 (re-search-forward (format "^%d$" ucs) nil t)))
671 (format " <a href=\"http://coe21.zinbun.kyoto-u.ac.jp/djvuchar?query=%s\">"
674 (format "%%%02X" (char-int c)))
675 (encode-coding-string (char-to-string c)
678 (princ (encode-coding-string "
\e$B"M
\e(B[
\e$BEbBeBsK\
\e(B]</a>" 'utf-8-jp-er)))
681 (defun www-ids-insert-chars-including-components* (components
682 &optional ignored-chars products)
684 (setq products (ideograph-find-products components ignored-chars)))
686 (setq len (length products))
690 (sort (copy-list products)
692 (< (char-int a)(char-int b))))
695 (sort (copy-list products)
697 (if (setq as (char-total-strokes a))
698 (if (setq bs (char-total-strokes b))
700 (< (char-int a)(char-int b))
703 (< (char-int a)(char-int b)))))
706 (sort (copy-list products)
708 (if (setq as (char-total-strokes a))
709 (if (setq bs (char-total-strokes b))
711 (ideograph-char< a b)
714 (ideograph-char< a b))))
716 (unless (memq c ignored-chars)
717 (setq is (char-feature c 'ideographic-structure))
719 (www-ids-find-format-line c is)
721 (www-ids-insert-chars-including-components*
722 (char-to-string c) (cons c ignored-chars)))
729 (defun www-ids-insert-chars-including-components (components
730 &optional ignored-chars)
731 (let ((products (ideograph-find-products components ignored-chars))
732 is as bs len ignore-children)
733 (setq len (length products))
735 (setq ignore-children t)
737 (encode-coding-string
738 "<p>
\e$B7k2L$,B?$9$.$k$?$a!":F5"E*8!:w$r>JN,$7$^$7$?!#
\e(B</p>"
742 (www-ids-find-format-char c))
745 (www-ids-insert-chars-including-components* components ignored-chars products)))
746 (dolist (c ignored-chars)
747 (dolist (vc (char-component-variants c))
748 (unless (memq vc ignored-chars)
749 (when (setq is (get-char-attribute vc 'ideographic-structure))
751 (www-ids-find-format-line vc is)
753 (www-ids-insert-chars-including-components*
755 (cons vc ignored-chars)))))))
756 (setq products (ideograph-find-products-with-variants components ignored-chars))
757 (setq len (length products))
759 (setq ignore-children t)
761 (encode-coding-string
762 "<p>
\e$B7k2L$,B?$9$.$k$?$a!"4XO";z$N:F5"E*8!:w$r>JN,$7$^$7$?!#
\e(B</p>"
766 (www-ids-find-format-char c))
767 (dolist (c (sort (copy-tree products)
769 (if (setq as (char-total-strokes a))
770 (if (setq bs (char-total-strokes b))
772 (ideograph-char< a b)
775 (ideograph-char< a b)))))
776 (unless (memq c ignored-chars)
777 (setq is (get-char-attribute c 'ideographic-structure))
779 (www-ids-find-format-line c is)
780 (unless ignore-children
782 (www-ids-insert-chars-including-components*
784 (cons c ignored-chars))))
790 (defun www-batch-ids-find ()
791 (let ((components (car command-line-args-left))
792 (coded-charset-entity-reference-alist
794 '(=cns11643-1 "C1-" 4 X)
795 '(=cns11643-2 "C2-" 4 X)
796 '(=cns11643-3 "C3-" 4 X)
797 '(=cns11643-4 "C4-" 4 X)
798 '(=cns11643-5 "C5-" 4 X)
799 '(=cns11643-6 "C6-" 4 X)
800 '(=cns11643-7 "C7-" 4 X)
802 '(=gb12345 "G1-" 4 X)
803 '(=jis-x0208@1990 "J90-" 4 X)
804 '(=jis-x0212 "JSP-" 4 X)
806 '(=jef-china3 "JC3-" 4 X)
807 '(=jis-x0208@1978 "J78-" 4 X)
808 '(=jis-x0208@1983 "J83-" 4 X)
809 '(=daikanwa "M-" 5 d)
810 coded-charset-entity-reference-alist))
812 (setq command-line-args-left (cdr command-line-args-left))
814 ((stringp components)
815 (if (string-match "^components=" components)
816 (setq components (substring components (match-end 0))))
818 (if (> (length components) 0)
819 (decode-url-string components 'utf-8-er)
823 (setq components nil)
825 (princ "Content-Type: text/html; charset=UTF-8
827 <!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"
828 \"http://www.w3.org/TR/html4/loose.dtd\">
831 <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">
832 <title>CHISE IDS Find</title>
833 <link href=\"/css/bootstrap-4.5.0.min.css\" rel=\"stylesheet\">
834 <style type=\"text/css\">
836 .entry { font-size: 36px; }
837 .entry a img { height: 36px; }
838 .ids { font-size: 24px; }
839 .ids a img { height: 24px; }
840 img { vertical-align:middle; }
841 a { text-decoration:none; }
843 li { margin: 0 0 -0.2em; }
846 display: inline-block;
848 .tooltip .tooltiptext {
857 <div class=\"jumbotron jumbotron-fluid mb-0\">
858 <h1 class=\"display-4 text-center\">")
859 (princ (encode-coding-string "CHISE IDS
\e$B4A;z8!:w
\e(B" 'utf-8-jp-er))
862 <p class=\"text-center\">Version ")
863 (princ www-ids-find-version)
864 (princ (format-time-string
865 " (Last-modified: %Y-%m-%d %H:%M:%S)</p>"
868 www-ids-find-ideographic-products-file-name))))
871 <div class=\"container mt-0 mw-100 d-inline-block align-top bg-dark\">
873 <div class=\"input-group mb-3 h3 my-4\">
874 <div class=\"input-group-prepend mw-75 ml-3\">
875 <form action=\"/ids-find\" method=\"GET\">
876 <span class=\"input-group-text\" id=\"basic-addon1\">
878 (princ (encode-coding-string "
\e$BItIJJ8;zNs
\e(B" 'utf-8-jp-er))
881 <input type=\"text\" class=\"form-control\" aria-describedby=\"basic-addon1\" name=\"components\" size=\"30\" maxlength=\"256\" value=\"")
882 (if (> (length components) 0)
883 (princ (encode-coding-string components 'utf-8-er)))
885 <input class=\"mr-3\" type=\"submit\" value=\"")
886 (princ (encode-coding-string "
\e$B8!:w3+;O
\e(B" 'utf-8-jp-er))
893 (unless (file-newer-than-file-p
894 www-ids-find-ideographic-products-file-name
895 (locate-file (car command-line-args) exec-path))
896 (princ (encode-coding-string "<hr>
898 \e$B8=:_!"%7%9%F%`$N99?7:n6HCf$G$9!#$7$P$i$/$*BT$A$/$@$5$$!#
\e(B
901 ;; (setq components nil)
905 (princ "<div class=\"container\">
907 ;; (map-char-attribute
909 ;; (when (every (lambda (p)
910 ;; (ideographic-structure-member p v))
912 ;; (princ (encode-coding-string
913 ;; (ids-find-format-line c v)
918 ;; 'ideographic-structure)
919 (when (= (length components) 1)
920 (www-ids-find-format-line (aref components 0)
921 (char-feature (aref components 0)
922 'ideographic-structure)))
923 ;; (dolist (c (ideographic-products-find components))
924 ;; (setq is (char-feature c 'ideographic-structure))
925 ;; ;; to avoid problems caused by wrong indexes
926 ;; (when (every (lambda (c)
927 ;; (ideographic-structure-member c is))
929 ;; (www-ids-find-format-line c is)))
931 (www-ids-insert-chars-including-components components)
936 (princ (encode-coding-string "<div class=\"container mt-4\">
939 \e$B;XDj$7$?ItIJ$rA4$F4^$`4A;z$N0lMw$rI=<($7$^$9!#
\e(B
942 CHISE
\e$B$GMQ$$$i$l$k<BBV;2>H7A<0!JNc!'
\e(B&M-00256;
\e$B!K$GItIJ$r;XDj$9$k;v$b$G$-$^$9!#
\e(B
946 (princ (encode-coding-string "
950 <li><a href=\"https://www.chise.org/ipns/ids-find.chise.org/index.ja.html\"
951 >IPFS
\e$BHG
\e(B CHISE IDS
\e$B4A;z8!:w
\e(B</a></li>
954 <li><a href=\"http://www.shuiren.org/chuden/toyoshi/syoseki/chise_ids.html\"
955 >
\e$B!V
\e(BCHISE IDS FIND
\e$B$G4A;z$r8!:w!W
\e(B</a>
\e$B!=
\e(B
\e$B;3ED?r?N$5$s!J
\e(B<a
956 href=\"http://www.shuiren.org/\">
\e$B?g?MDb
\e(B</a>
\e$B!K$K$h$k2r@b
\e(B
959 <li><a href=\"http://www.karitsu.org/tools/firefox_plugin.htm\"
960 >Firefox
\e$BMQ
\e(B plugin</a> by
\e$B=);3M[0lO:$5$s!J
\e(B<a href=\"http://www.karitsu.org/\"
961 >
\e$B2aN)c7
\e(B</a>
\e$B!K
\e(B
964 <li><a href=\"http://git.chise.org/gitweb/?p=chise/ids.git;a=blob;f=www/www-ids-find.el\"
965 >www-ids-find.el (source file (Emacs Lisp part))
966 <li><a href=\"http://www.chise.org/ids/\"
967 >
\e$B!V
\e(BCHISE
\e$B4A;z9=B$>pJs%G!<%?%Y!<%9!W
\e(B</a>
968 <li><a href=\"http://fonts.jp/chise_linkmap/\"
969 >
\e$B!V
\e(Bchise_linkmap : CHISE
\e$B4A;zO"4D?^!W
\e(B</a> by
\e$B>eCO9(0l$5$s
\e(B
970 <li><a href=\"http://www.chise.org/\"
974 <li><a href=\"http://coe21.zinbun.kyoto-u.ac.jp/djvuchar\"
975 >
\e$B!VBsK\J8;z%G!<%?%Y!<%9!W
\e(B</a> by
976 <a href=\"http://coe21.zinbun.kyoto-u.ac.jp/\"
977 >
\e$B5~ETBg3X
\e(B21
\e$B@$5*
\e(BCOE
\e$B!VEl%"%8%"@$3&$N?MJ8>pJs3X8&5f650i5rE@!W
\e(B</a>
978 <li><a href=\"http://www.unicode.org/\"
988 <div class=\"container\">
990 (princ "<div class=\"ml-0\">
991 Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2015, 2016, 2017, 2020, 2021, 2022, 2023 <a href=\"http://kanji.zinbun.kyoto-u.ac.jp/~tomo/\"
992 >MORIOKA Tomohiko</a></div>")
996 href=\"http://www.chise.org/xemacs/\"
997 >XEmacs CHISE</a> %s.</div>"
998 (encode-coding-string xemacs-chise-version 'utf-8-jp-er)))