emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nick Dokos <ndokos@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: Renaming of +NAME for code blocks to in HTML export, no longer user defined
Date: Mon, 04 Jan 2016 13:29:13 -0500	[thread overview]
Message-ID: <87lh85b3ly.fsf@alphaville.usersys.redhat.com> (raw)
In-Reply-To: CAJV1HcyKEixhmcbTjY3WbzPF-LNiD3eOE6cq+pv3tPb0nsRReQ@mail.gmail.com

Adam Aviv <aviv@usna.edu> 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	other threads:[~2016-01-04 18:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-04 18:04 Renaming of +NAME for code blocks to in HTML export, no longer user defined Adam Aviv
2016-01-04 18:29 ` Nick Dokos [this message]
2016-01-05 16:44   ` Adam Aviv
2016-01-21  9:20     ` Nicolas Goaziou
2016-01-21 14:21       ` Adam Aviv

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=87lh85b3ly.fsf@alphaville.usersys.redhat.com \
    --to=ndokos@gmail.com \
    --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).