Eric S Fraga <[email protected]> writes:
> I'm preparing some documentation, exported to HTML, that includes the
> output of a src block. Because this output is rather long, I have
>
> #+attr_html: :textarea t :height 20
>
> before the results of the src block. This generates the correct
> <textarea> form in the HTML output. The text area form's width is
> automatically set to the text width using CSS. The problem is that some
> of the output lines in the src block results are quite long and they
> wrap; this looks ugly.
>
> To turn wrapping off, I would need to add 'wrap="off"' to the textarea
> form as this option cannot be controlled using CSS unfortunately. I
> don't see any way to do this from org.
>
> Any suggestions on how to accomplish this, assuming it is possible?
>
Can you add a post-processing hook? A simple text replacement might be enough.
Or modify the textarea function to understand :wrap - not sure whether Nicolas
would accept a patch though:
--8<---------------cut here---------------start------------->8---
(defun org-html--textarea-block (element)
"Transcode ELEMENT into a textarea block.
ELEMENT is either a src block or an example block."
(let* ((code (car (org-export-unravel-code element)))
(attr (org-export-read-attribute :attr_html element)))
(format "<p>\n<textarea cols=\"%s\" rows=\"%s\"
wrap=\"%s\">\n%s</textarea>\n</p>"
(or (plist-get attr :width) 80)
(or (plist-get attr :height) (org-count-lines code))
(or (plist-get attr :wrap) "on")
code)))
--8<---------------cut here---------------end--------------->8---
Untested.
--
Nick