[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] adding "wrap=off" option to textarea for HTML export
From: |
Nick Dokos |
Subject: |
Re: [O] adding "wrap=off" option to textarea for HTML export |
Date: |
Thu, 08 Sep 2016 13:54:36 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) |
Eric S Fraga <address@hidden> 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