emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Renaming of +NAME for code blocks to in HTML export, no longer u


From: Nick Dokos
Subject: Re: [O] Renaming of +NAME for code blocks to in HTML export, no longer user defined
Date: Mon, 04 Jan 2016 13:29:13 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Adam Aviv <address@hidden> writes:

> Hi all,
>
> I've been using org-mode for some time to manage a course website, and I 
> developed a hack for source
> blocking where if I use the +NAME tag for source doe like so:
>
> #+NAME: helloworld.cpp
> #+BEGIN_SRC c++ -r
> #include <iostream> (ref:include)
>
> using namespace std; (ref:namespace)
>
> // Hello World in C++
> int main(int argc, char * argv[]){
>   cout << "Hello World" << endl; (ref:speak)
> }
> #+END_SRC
>
> Then I could retrieve the name tag in the HTML source via the id when 
> exported, like so:
>
> <pre class="src src-c++" id="helloworld.cpp">
>
> I can then use the id tag and CSS to have it float next to the code like this:
>
> Inline image 1                           
>
> However, since I updated org-mode recently to version 8.3.2, the +NAME 
> tagging is no longer user
> defined. Instead, it get's a generic, org defined name, such as orgsrcblock1. 
> This means my little hack
> no longer works and I get something that looks like this in the HTML 
> exporting:
>
> <pre class="src src-c++" id="orgsrcblock1">
>
> I have two questions for the group:
>
> 1) Is there a way to overwrite the generic source block naming? Or turn off 
> this feature somewhere? I
> can't seem to figure that out for myself. 
>
> 2) Is there another hack that someone can suggest? For example, is there a 
> way to have a user defined
> <div> tag around the src code that will get exported?
>

It may be a bug: the code (in org-html-src-block) looks like this

          (label (let ((lbl (and (org-element-property :name src-block)
                                 (org-export-get-reference src-block info))))
                   (if lbl (format " id=\"%s\"" lbl) ""))))

and I'm wondering whether the "and" should be an "or".

--
Nick




reply via email to

[Prev in Thread] Current Thread [Next in Thread]