emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* question about org-coderef-label-format and HTML export
@ 2016-12-05 19:55 dmg
  2016-12-06 23:29 ` Nicolas Goaziou
  0 siblings, 1 reply; 4+ messages in thread
From: dmg @ 2016-12-05 19:55 UTC (permalink / raw)
  To: emacs-orgmode

hi everybody,

I was playing with org-coderef-label-format to reference lines of code
in blocks.

I created a small example that overrides the default value:

#+BEGIN_SRC C++ :main no :flags -std=c++14 -Wall --pedantic -Werror
:results output :exports both -r -l "//(ref:%s)" +n
#include <iostream>
int main()
{ //(ref:abc)
   std::cout << "Hello world" << std::endl;
   std::cout << "Hello world 2" << std::endl;
   //(ref:jump)
   return 0;
}
#+END_SRC

#+RESULTS:
#+begin_example
Hello world
Hello world 2
#+end_example

In line [[(abc)]] we remember the current position.  [[(jump)][Line (jump)]]
jumps to point-min.

This seem to work, except for one issue.

the refs are exported to the HTML file:

It only sports the label, not the reference name. See below. Note
how //ref:(abc) in the source code was replaced with //(abc)

<span id="coderef-abc" class="coderef-off">{ <span style="color:
#8D8D84;">//</span> (abc)</span>

Is this the expected behaviour? or am I doing something wrong?

my version of org-mode is:

9.0.1

thank you!

--daniel

-- 
--dmg

---
Daniel M. German
http://turingmachine.org

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

* Re: question about org-coderef-label-format and HTML export
  2016-12-05 19:55 question about org-coderef-label-format and HTML export dmg
@ 2016-12-06 23:29 ` Nicolas Goaziou
  2016-12-07  9:13   ` D M German
  0 siblings, 1 reply; 4+ messages in thread
From: Nicolas Goaziou @ 2016-12-06 23:29 UTC (permalink / raw)
  To: dmg; +Cc: emacs-orgmode

Hello,

dmg <dmg@turingmachine.org> writes:

> I was playing with org-coderef-label-format to reference lines of code
> in blocks.
>
> I created a small example that overrides the default value:
>
> #+BEGIN_SRC C++ :main no :flags -std=c++14 -Wall --pedantic -Werror
> :results output :exports both -r -l "//(ref:%s)" +n

Switches are to be located before Babel parameters:

  #+begin_src C++ -r -l "//(ref:%s)" +n :main no ..

Regards,

-- 
Nicolas Goaziou

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

* Re: question about org-coderef-label-format and HTML export
  2016-12-06 23:29 ` Nicolas Goaziou
@ 2016-12-07  9:13   ` D M German
  2016-12-07 22:15     ` Nicolas Goaziou
  0 siblings, 1 reply; 4+ messages in thread
From: D M German @ 2016-12-07  9:13 UTC (permalink / raw)
  To: emacs-orgmode

 Nicolas Goaziou twisted the bytes to say:


 Nicolas> Hello,
 Nicolas> dmg <dmg@turingmachine.org> writes:

 >> I was playing with org-coderef-label-format to reference lines of code
 >> in blocks.
 >> 
 >> I created a small example that overrides the default value:
 >> 
 >> #+BEGIN_SRC C++ :main no :flags -std=c++14 -Wall --pedantic -Werror
 >> :results output :exports both -r -l "//(ref:%s)" +n

 Nicolas> Switches are to be located before Babel parameters:

  #+begin_src C++ -r -l "//(ref:%s)" +n :main no ..

Thank you, Nicolas, I appreciate your response. It almost works now.

I think I found a bug. It works in some cases but not in others:

the following code properly defines the references abc and bfc. But it
does not define the one for (ref:jump). Here is a link to the exported
HTML file:

http://turingmachine.org/~dmg/temp/ref-test.html
http://turingmachine.org/~dmg/temp/ref-test.org

#+BEGIN_SRC C++ -r -l "//(ref:%s)" +n :main no :results output :exports both 
#include <iostream>
int main()
{ //(ref:abc)
   std::cout << "Hello world" << std::endl;
   std::cout << "Hello world 2" << std::endl;
   //(ref:jump)
   return 0; //(ref:bcf)
}
#+END_SRC


 Nicolas> Regards,

thank you again,

--daniel


 Nicolas> -- 
 Nicolas> Nicolas Goaziou

--
Daniel M. German                  "Computer Science is no more
                                   about computers than astronomy
   Edsger Dijkstra  ->             is about telescopes"
http://turingmachine.org/
http://silvernegative.com/
dmg (at) uvic (dot) ca
replace (at) with @ and (dot) with .

 

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

* Re: question about org-coderef-label-format and HTML export
  2016-12-07  9:13   ` D M German
@ 2016-12-07 22:15     ` Nicolas Goaziou
  0 siblings, 0 replies; 4+ messages in thread
From: Nicolas Goaziou @ 2016-12-07 22:15 UTC (permalink / raw)
  To: D M German; +Cc: emacs-orgmode

Hello,

D M German <dmg@turingmachine.org> writes:

> I think I found a bug. It works in some cases but not in others:
>
> the following code properly defines the references abc and bfc. But it
> does not define the one for (ref:jump). Here is a link to the exported
> HTML file:
>
> http://turingmachine.org/~dmg/temp/ref-test.html
> http://turingmachine.org/~dmg/temp/ref-test.org
>
> #+BEGIN_SRC C++ -r -l "//(ref:%s)" +n :main no :results output :exports both 
> #include <iostream>
> int main()
> { //(ref:abc)
>    std::cout << "Hello world" << std::endl;
>    std::cout << "Hello world 2" << std::endl;
>    //(ref:jump)
>    return 0; //(ref:bcf)
> }
> #+END_SRC

Fixed. Thank you.

Regards,

-- 
Nicolas Goaziou

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

end of thread, other threads:[~2016-12-07 22:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-05 19:55 question about org-coderef-label-format and HTML export dmg
2016-12-06 23:29 ` Nicolas Goaziou
2016-12-07  9:13   ` D M German
2016-12-07 22:15     ` Nicolas Goaziou

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