emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: <Ken.Williams@thomsonreuters.com>
To: bzg@altern.org
Cc: emacs-orgmode@gnu.org
Subject: Re: Styling HTML output
Date: Fri, 26 Aug 2011 18:47:38 +0000	[thread overview]
Message-ID: <CA7D5439.4556A%ken.williams@thomsonreuters.com> (raw)
In-Reply-To: <877h607dh8.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 300 bytes --]


On 8/26/11 4:01 AM, "Bastien" <bzg@altern.org> wrote:
>
>Cool - it deserves to be put on Worg org-hacks.org!


Good idea, here's a patch (I hope attachments work on this list?) that
adds it.

--
Ken Williams
Senior Research Scientist
Thomson Reuters
http://labs.thomsonreuters.com



[-- Attachment #2: 0001-Add-an-entry-for-code-output-styling-in-HTML-CSS.patch --]
[-- Type: application/octet-stream, Size: 1842 bytes --]

From d6caa7674c7c848bad36688c0adb83ed35172ec9 Mon Sep 17 00:00:00 2001
From: Ken Williams <ken.williams@thomsonreuters.com>
Date: Fri, 26 Aug 2011 13:45:44 -0500
Subject: [PATCH] Add an entry for code-output styling in HTML/CSS.

---
 org-hacks.org |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/org-hacks.org b/org-hacks.org
index 6c926a0..2791edc 100644
--- a/org-hacks.org
+++ b/org-hacks.org
@@ -1618,6 +1618,34 @@ workaround, one can use the following:
   ,#+LATEX: }
 #+end_src
 
+  * Styling code sections with CSS
+
+Code sections (marked with =#+begin_src= and =#+end_src=) are exported
+to HTML using =<pre>= tags, and assigned CSS classes by their content
+type.  For example, Perl content will have an opening tag like 
+=<pre class="src src-sh">=.  You can use those classes to add styling
+to the output, such as here where a small language tag is added at the
+top of each kind of code box:
+
+#+begin_src lisp
+(setq org-export-html-style
+ "<style type=\"text/css\">
+    <!--/*--><![CDATA[/*><!--*/
+      .src             { background-color: #F5FFF5; position: relative; overflow: visible; }
+      .src:before      { position: absolute; top: -15px; background: #ffffff; padding: 1px; border: 1px solid #000000; font-size: small; }
+      .src-sh:before   { content: 'sh'; }
+      .src-bash:before { content: 'sh'; }
+      .src-R:before    { content: 'R'; }
+      .src-perl:before { content: 'Perl'; }
+      .src-sql:before  { content: 'SQL'; }
+      .example         { background-color: #FFF5F5; }
+    /*]]>*/-->
+ </style>")
+#+end_src
+
+Additionally, we use color to distinguish code output (the =.example=
+class) from input (all the =.src-*= classes).
+
 * Hacking Org: Working with Org-mode and other Emacs Packages.
 ** org-remember-anything
 
-- 
1.7.5


  reply	other threads:[~2011-08-26 18:47 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-25 18:57 Styling HTML output Ken.Williams
2011-08-25 19:06 ` Jason Dunsmore
2011-08-26  9:01 ` Bastien
2011-08-26 18:47   ` Ken.Williams [this message]
2011-08-26 19:26     ` Nick Dokos
2011-08-26 22:07       ` Ken.Williams
2011-08-26 22:24         ` Bastien
2011-08-26 18:41 ` 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

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CA7D5439.4556A%ken.williams@thomsonreuters.com \
    --to=ken.williams@thomsonreuters.com \
    --cc=bzg@altern.org \
    --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 public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).