emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: <Ken.Williams@thomsonreuters.com>
To: nicholas.dokos@hp.com
Cc: bzg@altern.org, emacs-orgmode@gnu.org
Subject: Re: Styling HTML output
Date: Fri, 26 Aug 2011 22:07:52 +0000	[thread overview]
Message-ID: <CA7D8285.455A2%ken.williams@thomsonreuters.com> (raw)
In-Reply-To: <3799.1314386770@alphaville.americas.hpqcorp.net>

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


On 8/26/11 2:26 PM, "Nick Dokos" <nicholas.dokos@hp.com> wrote:

>Two things:
>
>o application/octet-stream is not the right MIME type for the
> attachment.[...]
>
>o Presumaby the following should say <pre class="src src-perl">:[...]
>


Thanks, I think this update is better.  Unfortunately I don't think my
mailer (stupid Outlook) can change the attachments, so I'll inline it here.



From c3fd3627d6f912fe1108eff1fc2893ff6c4631bb 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..754d1a8 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-perl">=.  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






--
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: 1844 bytes --]

From c3fd3627d6f912fe1108eff1fc2893ff6c4631bb 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..754d1a8 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-perl">=.  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 22:08 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
2011-08-26 19:26     ` Nick Dokos
2011-08-26 22:07       ` Ken.Williams [this message]
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=CA7D8285.455A2%ken.williams@thomsonreuters.com \
    --to=ken.williams@thomsonreuters.com \
    --cc=bzg@altern.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=nicholas.dokos@hp.com \
    /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).