emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Export results of code literal blocks (Jekyll directory structure) xpost emacs.stackexchange
@ 2017-06-24 23:33 Jeremy Reeve
  2017-06-28 13:22 ` Nicolas Goaziou
  0 siblings, 1 reply; 4+ messages in thread
From: Jeremy Reeve @ 2017-06-24 23:33 UTC (permalink / raw)
  To: emacs-orgmode

Org-mode newbie here.  Please be gentle.  Posted on Stack Exchange
before I found the official list.

I'm trying to follow the recipe for exporting Org-mode documents for
processing by Jekyll. My publishing org-publish-project-alist is
configured to place exported html in my _posts directory and take
images and place them in _posts/assets with org-publish-attachment.
This modification of directory structure seems to be the root of the
problem.

#+BEGIN_SRC python :results value file
  import numpy as np
  import matplotlib.pyplot as plt

  from mpl_toolkits.mplot3d import Axes3D

  p1 = np.array([0,4,4])
  p2 = np.array([4,-4,4])
  p3 = np.array([2,2,-4])

  fig = plt.figure()
  ax = fig.gca(projection='3d')
  ax.set_aspect("equal")

  #draw the arrow
  ax.quiver(p1[0],p1[1],p1[2],p2[0],p2[1],p2[2],length=1.0)
  ax.quiver(p1[0],p1[1],p1[2],p3[0],p3[1],p3[2],length=1.0)

  ax.set_xlim([-5, 5])
  ax.set_ylim([-5, 5])
  ax.set_zlim([-5, 5])

  plt.savefig('../images/hw1-p3.png')
  return '../images/hw1-p3.png'
#+END_SRC

#+RESULTS:
[[file:../images/hw1-p3.png]]


#+BEGIN_EXPORT html
<figure>
  <img
  src="{{ site.url }}/assets/hw1-p3.png"
  alt="Problem 3 visualisation">
  <figcaption>Problem 3 visualisation</figcaption>
</figure>
#+END_EXPORT html

The end result I would like is to have the link to the result of the
literal code block automatically generated either such that it is not
exported as an inline image (as the relative path is incorrect) and be
forced to manually add a correct link for HTML export or have the
inline image link transformed such that it is correct.

Suggestions like "Don't use Jekyll" are fine so long as it is
accompanied with an alternative and explanation as to why.  I see some
people have written custom Org-mode Jekyll plugins like
https://github.com/eggcaker/jekyll-org and am wondering if these are a
better route.

Also, the above snippet exports everything including the "BEGIN
export" which I think shouldn't happen but I'll examine that
separately.

Regards...Jeremy

Org mode version 9.0.5 (9.0.5-elpa @ /Users/xxx/.emacs.d/elpa/org-20170210/)
GNU Emacs 25.1.1 (x86_64-apple-darwin13.4.0, NS appkit-1265.21 Version
10.9.5 (Build 13F1911)) of 2016-09-18

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

* Re: Export results of code literal blocks (Jekyll directory structure) xpost emacs.stackexchange
  2017-06-24 23:33 Export results of code literal blocks (Jekyll directory structure) xpost emacs.stackexchange Jeremy Reeve
@ 2017-06-28 13:22 ` Nicolas Goaziou
  2017-06-30  1:17   ` Jeremy Reeve
  0 siblings, 1 reply; 4+ messages in thread
From: Nicolas Goaziou @ 2017-06-28 13:22 UTC (permalink / raw)
  To: Jeremy Reeve; +Cc: emacs-orgmode

Hello,

Jeremy Reeve <jeremy.reeve81@gmail.com> writes:

> Org-mode newbie here.  Please be gentle.

Do you have any reason to think we will not be gentle?

  "We have a squeaker today, class. Isn't he cute?"

> I'm trying to follow the recipe for exporting Org-mode documents for
> processing by Jekyll. My publishing org-publish-project-alist is
> configured to place exported html in my _posts directory and take
> images and place them in _posts/assets with org-publish-attachment.
> This modification of directory structure seems to be the root of the
> problem.

[...]

> #+RESULTS: [[file:../images/hw1-p3.png]]
>
> #+BEGIN_EXPORT html
> <figure>
>   <img
>   src="{{ site.url }}/assets/hw1-p3.png"
>   alt="Problem 3 visualisation">
>   <figcaption>Problem 3 visualisation</figcaption>
> </figure>
> #+END_EXPORT html
>
> The end result I would like is to have the link to the result of the
> literal code block automatically generated either such that it is not
> exported as an inline image (as the relative path is incorrect) and be
> forced to manually add a correct link for HTML export or have the
> inline image link transformed such that it is correct.

Can't you write a function that fixes generated links? See
`org-export-before-parsing-hook'.

> Also, the above snippet exports everything including the "BEGIN
> export" which I think shouldn't happen but I'll examine that
> separately.

The closing line is wrong. It should be "#+end_export". Use `M-x
org-lint' to find this kind of problem.

Regards,

-- 
Nicolas Goaziou

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

* Re: Export results of code literal blocks (Jekyll directory structure) xpost emacs.stackexchange
  2017-06-28 13:22 ` Nicolas Goaziou
@ 2017-06-30  1:17   ` Jeremy Reeve
  2017-06-30  7:08     ` Nicolas Goaziou
  0 siblings, 1 reply; 4+ messages in thread
From: Jeremy Reeve @ 2017-06-30  1:17 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode

On 29 June 2017 at 01:22, Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:
> Hello,
>
> Jeremy Reeve <jeremy.reeve81@gmail.com> writes:
>
>> Org-mode newbie here.  Please be gentle.
>
> Do you have any reason to think we will not be gentle?
>
>   "We have a squeaker today, class. Isn't he cute?"

That comment was totally inappropriate for a public mailing list.

>
> Can't you write a function that fixes generated links? See
> `org-export-before-parsing-hook'.

Yes I probably can.  I can think of many ways of doing exactly that.
I wasn't aware of the existence of the hook and that's why I chose to
ask. That's what I was looking for - a pointer. Thanks.

There seem to be many inconsistencies between the particular versions
I am using and the public documentation and I appreciate that the code
is probably evolving rapidly.  I note the difference in documentation
between master in the code repository and what is currently on the
public facing web site and that I ought to build the documentation
specific to the version I am using.  The experience gave me the
feeling that there might be something relevant which is not well or at
all documented.

If I read the entire reference manual of every piece of software I use
I would have no time to carry out the actual tasks I use these tools
for.  It would be morally correct to read the reference manual
cover-to-cover to find out the best approach to solving a problem.  I
think it is unfair to categorise this post as of the 'too lazy to look
up something in the manual' form as I had provided a concrete example
and what I wanted to achieve and as I tried to hint at - not a highly
experienced Emacs-lisp developer or emacs-org user having spent very
little time (a day) exposed to org-mode.  Occasionally one needs a
steer in the right direction, that is all.

I think what needs to be appreciated is that there will be a spectrum
of users on the one end who are active Emacs-lisp developers who have
familiarity with the codebase all the way to people appreciative of
the open source efforts but that do not have the time or inclination
to act as developers on yet another project unrelated to their work.

>
>> Also, the above snippet exports everything including the "BEGIN
>> export" which I think shouldn't happen but I'll examine that
>> separately.
>
> The closing line is wrong. It should be "#+end_export". Use `M-x
> org-lint' to find this kind of problem.

Yes. I found this immediately after posting and thanks for the tip
about org-lint.

Jeremy

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

* Re: Export results of code literal blocks (Jekyll directory structure) xpost emacs.stackexchange
  2017-06-30  1:17   ` Jeremy Reeve
@ 2017-06-30  7:08     ` Nicolas Goaziou
  0 siblings, 0 replies; 4+ messages in thread
From: Nicolas Goaziou @ 2017-06-30  7:08 UTC (permalink / raw)
  To: Jeremy Reeve; +Cc: emacs-orgmode

Hello,

Jeremy Reeve <jeremy.reeve81@gmail.com> writes:

>>   "We have a squeaker today, class. Isn't he cute?"
>
> That comment was totally inappropriate for a public mailing list.

Of course! Hence the double quotes and the indentation. 

It is actually a quote from the Whiplash movie. It illustrates how
unwelcoming can a given community be. This was obviously not addressed
to you. I'm sorry you thought otherwise.

> There seem to be many inconsistencies between the particular versions
> I am using and the public documentation and I appreciate that the code
> is probably evolving rapidly.  I note the difference in documentation
> between master in the code repository and what is currently on the
> public facing web site and that I ought to build the documentation
> specific to the version I am using.

You ought to read the documentation from within Emacs:

  (info "(org) Top")

It is adapted to the Org version you're using.


Regards,

-- 
Nicolas Goaziou

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

end of thread, other threads:[~2017-06-30  7:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-24 23:33 Export results of code literal blocks (Jekyll directory structure) xpost emacs.stackexchange Jeremy Reeve
2017-06-28 13:22 ` Nicolas Goaziou
2017-06-30  1:17   ` Jeremy Reeve
2017-06-30  7:08     ` 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).