value)
(www-format-value-as-S-exp value)))
-(defun www-format-value (value &optional feature-name format without-tags)
- ;; (cond
- ;; ((find-charset feature-name)
- ;; (cond
- ;; ((and (= (charset-chars feature-name) 94)
- ;; (= (charset-dimension feature-name) 2))
- ;; (www-format-value-as-CCS-94x94 value))
- ;; (t
- ;; (www-format-value-as-CCS-default value)))
- ;; )
- ;; (t
- ;; (www-format-value-as-S-exp value)))
- (www-format-apply-value format nil value nil nil without-tags)
+(defun www-format-value (object feature-name
+ &optional value format without-tags)
+ (unless value
+ (setq value (www-char-feature object feature-name)))
+ (www-format-apply-value object feature-name
+ format nil value nil nil without-tags)
)
((eq format 'S-exp) "S")
(t "s"))))
-(defun www-format-apply-value (format props value
+(defun www-format-apply-value (object feature-name
+ format props value
&optional uri-char uri-feature
without-tags)
(let (ret)
(format "%s" value)
without-tags))
)
+ ((eq format 'wiki-text)
+ (if without-tags
+ (www-xml-format-list value)
+ (www-format-eval-list value object feature-name nil uri-char))
+ )
((eq format 'S-exp)
(www-format-encode-string
(format (www-format-props-to-string props format)
(cond
((symbolp format)
(www-format-apply-value
+ char feature-name
format nil value
uri-char (www-uri-encode-feature-name feature-name))
)
(cond ((null (cdr format))
(setq format (car format))
(www-format-apply-value
+ char feature-name
(car format) (nth 1 format) value
uri-char (www-uri-encode-feature-name feature-name))
)
(plist-get (nth 1 exp) :format)
lang uri-char value)
(www-format-apply-value
+ char feature-name
(car exp) (nth 1 exp) value
uri-char (www-uri-encode-feature-name feature-name)))
)
(www-format-eval-unit format-list char feature-name lang uri-char)))
+;;; @ XML generator
+;;;
+
+(defun www-xml-format-props (props)
+ (let ((dest "")
+ key val)
+ (while props
+ (setq key (pop props)
+ val (pop props))
+ (if (symbolp key)
+ (setq key (symbol-name key)))
+ (if (eq (aref key 0) ?:)
+ (setq key (substring key 1)))
+ (setq dest
+ (format "%s %s=\"%s\""
+ dest key val)))
+ dest))
+
+(defun www-xml-format-unit (format-unit)
+ (let (name props children)
+ (cond
+ ((stringp format-unit)
+ format-unit)
+ ((consp format-unit)
+ (setq name (car format-unit)
+ props (nth 1 format-unit)
+ children (nthcdr 2 format-unit))
+ (if children
+ (format "<%s%s>%s</%s>"
+ name
+ (if props
+ (www-xml-format-props props)
+ "")
+ (www-xml-format-list children)
+ name)
+ (format "<%s%s/>"
+ name (www-xml-format-props props)))
+ )
+ (t
+ (format "%s" format-unit)))))
+
+(defun www-xml-format-list (format-list)
+ (if (atom format-list)
+ (www-xml-format-unit format-list)
+ (mapconcat #'www-xml-format-unit
+ format-list "")))
+
+
;;; @ HTML generator
;;;