emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Need info about code block header arguments in (HTML) export
@ 2014-08-11 14:58 Avdi Grimm
  2014-08-12 15:43 ` Rick Frankel
  0 siblings, 1 reply; 2+ messages in thread
From: Avdi Grimm @ 2014-08-11 14:58 UTC (permalink / raw)
  To: emacs-orgmode Org-Mode

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

Hi there, Org experts!

I write books in org-mode, and one of the features I've really started to
need is to be able to automatically include filename information when
exporting source code listings. That is, given some Org source like this:

    #+BEGIN_SRC ruby :tangle foo/bar.rb
      puts "hello, world"
    #+END_SRC

...the final HTML might look something like this:

    <div class="org-src-container">
    <div class="src-path">foo/bar.rb</div>

    <pre class="src src-ruby">puts <span class="org-string">"Hello,
world"</span>
    </pre>
    </div>

However, I already do a lot of post-processing on the exported HTML, so I'm
thinking that a simpler, more general solution would be sufficient:

    <div class="org-src-container" data-org-header-args="ruby :tangle
foo/bar.rb">

    <pre class="src src-ruby">puts <span class="org-string">"Hello,
world"</span>
    </pre>
    </div>

As you can see, in this version the header arguments are inserted,
unchanged, into a new data-org-header-args attribute. This would give me
enough information to munge the final HTML into the form I need.

So my question is: can anyone give me pointers on how to accomplish this?
Thanks!
-- 
Avdi Grimm
http://avdi.org

[-- Attachment #2: Type: text/html, Size: 1903 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Need info about code block header arguments in (HTML) export
  2014-08-11 14:58 Need info about code block header arguments in (HTML) export Avdi Grimm
@ 2014-08-12 15:43 ` Rick Frankel
  0 siblings, 0 replies; 2+ messages in thread
From: Rick Frankel @ 2014-08-12 15:43 UTC (permalink / raw)
  To: Avdi Grimm; +Cc: emacs-orgmode Org-Mode

On 2014-08-11 10:58, Avdi Grimm wrote:
> Hi there, Org experts!
> 
> I write books in org-mode, and one of the features I've really started
> to need is to be able to automatically include filename information
> when exporting source code listings. That is, given some Org source
> like this:
> 
>     #+BEGIN_SRC ruby :tangle foo/bar.rb
>       puts "hello, world"
>     #+END_SRC
> 
> ...the final HTML might look something like this:
> 
>     <div class="org-src-container">
>     <div class="src-path">foo/bar.rb</div>
> 

Currently, you can acheive similar html output by using the
`#+CAPTION' header argument;

#+CAPTION: foo/bar.pl
#+BEGIN_SRC perl :exports code
print "foo\n";
#+END_SRC

which would generate this html:

#+BEGIN_SRC html
<div class="org-src-container">
<label class="org-src-name">foo/bar.pl</label>
<pre class="src src-perl"><span style="color: #458b00;">print</span> 
<span style="color: #006400;">"foo\n"</span>;
</pre>
</div>
#+END_SRC

I don't see a way to get the `:tangle' keyword during export, as the
parser does not include that in list passed to the src-block export
function.


rick

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-08-12 15:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-11 14:58 Need info about code block header arguments in (HTML) export Avdi Grimm
2014-08-12 15:43 ` Rick Frankel

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).