- (if (editablep slot)
- (<ucw:textarea :accessor (presentation-slot-value slot instance)
- :rows (rows slot)
- :cols (columns slot))
- (if (escape-html-p slot)
- (<:as-html (presentation-slot-value slot instance))
- (<:as-is (presentation-slot-value slot instance)))))
+ (flet ((maybe-convert-newline-and-escape-html-then-print ()
+ (let ((string (if (convert-newlines-p slot)
+ (with-output-to-string (new-string)
+ (with-input-from-string
+ (s (presentation-slot-value slot instance))
+ (loop for line = (read-line s nil)
+ while line
+ do (format new-string "~A~A" line "<br/>"))))
+ (presentation-slot-value slot instance))))
+ (if (escape-html-p slot)
+ (<:as-html string)
+ (<:as-is string)))))
+
+ (if (editablep slot)
+ (<ucw:textarea
+ :accessor (presentation-slot-value slot instance)
+ :reader (or (presentation-slot-value slot instance)
+ "")
+ :rows (rows slot)
+ :cols (columns slot))
+ (when (presentation-slot-value slot instance)
+ (maybe-convert-newline-and-escape-html-then-print)))))