From: Nick Dokos <ndokos@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: adding "wrap=off" option to textarea for HTML export
Date: Thu, 08 Sep 2016 13:54:36 -0400 [thread overview]
Message-ID: <878tv28eg3.fsf@gmail.com> (raw)
In-Reply-To: 87y432mlxl.fsf@ucl.ac.uk
Eric S Fraga <e.fraga@ucl.ac.uk> 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
next prev parent reply other threads:[~2016-09-08 17:54 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-08 15:49 adding "wrap=off" option to textarea for HTML export Eric S Fraga
2016-09-08 17:54 ` Nick Dokos [this message]
[not found] ` <69324c9e4bfc4fd3bd7df7882e857fd2@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
2016-09-08 18:27 ` Eric S Fraga
2016-09-08 20:51 ` Nicolas Goaziou
[not found] ` <36a89fa2bafb4a0b84ff8ad6523d61a9@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
2016-09-10 9:20 ` Eric S Fraga
2016-09-09 8:08 ` Eric S Fraga
2016-09-09 15:32 ` Clément Pit--Claudel
[not found] ` <0960a5432ed143b18552148fd5b67941@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
2016-09-09 16:06 ` Eric S Fraga
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=878tv28eg3.fsf@gmail.com \
--to=ndokos@gmail.com \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.