On 8/26/11 2:26 PM, "Nick Dokos" <nicholas.do...@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.willi...@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 >
0001-Add-an-entry-for-code-output-styling-in-HTML-CSS.patch
Description: 0001-Add-an-entry-for-code-output-styling-in-HTML-CSS.patch