emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Get :PROPERTY: value from drawer in other heading during HTML export?
@ 2014-09-12 14:54 D. C. Toedt
  2014-09-12 19:06 ` Nicolas Goaziou
  0 siblings, 1 reply; 3+ messages in thread
From: D. C. Toedt @ 2014-09-12 14:54 UTC (permalink / raw)
  To: emacs-orgmode

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

When generating an HTML file from an org-mode document, I'd like to do a
GET operation to retrieve a property value from the drawer of an arbitrary
heading, using the CUSTOM_ID property to identify the heading.  From
Google-searching, I suspect that "org-heading-components" will be involved,
but I'm not proficient enough in elisp to be able to figure out how to use
it from the on-line examples I've found --- and I'm not proficient enough
in Emacs to use any built-in documentation about it ("apropos" doesn't
produce any results).

Here's an example, where GET-PROP is a macro I'd like to use:

==BEGIN==

#+MACRO: get-prop [????]

#+MACRO: get-title [omitted -- thanks to Nicolas Goaziou for the get-title
macro, at
https://lists.gnu.org/archive/html/emacs-orgmode/2014-02/msg00386.html]

* CLAUSES

** Affiliate status from voting control
  :PROPERTIES:
  :CUSTOM_ID: AffilDefn
  :CD-ID: AFFIL-VOTE
  :IMPORTANCE: Situational
  :PUSHBACK: Unlikely
  :END:

(a) One individual or organization ("Person") is an {{{DEFN(Affiliate)}}}
of another Person if,  directly or indirectly via one or more
intermediaries, one of those Persons /controls/ (as defined in subdivision
(b) below), or is controlled by, or is under common control with, the other
Person.

(b) [other text omitted]


* CONTRACT TEMPLATES

** Nondisclosure Agreement

{{{GET-PROP(AffilDefn,CD-ID)}}}: {{{GET-TITLE(AffilDefn)}}} -- pushback
from the other side is {{{GET-PROP(AffilDefn,PUSHBACK)}}}.

# This should export to:
# AFFIL-VOTE: Affiliate status from voting control -- pushback from the
other side is: Unlikely.

==END==

Thanks in advance,

--D. C.

*D*ell *C*harles "D. C." Toedt III  *(my** last name is pronounced "Tate") *
Attorney and neutral arbitrator -- tech contracts and intellectual property
Lecturer, University of Houston Law Center
​Editor, ​​​Common Draft <http://www.commondraft.org/> project:  A readable
library of best-practices contract clauses,
     with extensive citations and commentary, updated often.
dc@toedt.com     LinkedIn: dctoedt <http://www.linkedin.com/in/dctoedt>
Calendar
<https://www.google.com/calendar/embed?src=dc.toedt@toedt.com&mode=WEEK>
(redacted)
O: +1 (713) 364-6545    C: +1 (713) 516-8968
​​

​
Houston, Texas (Central time zone)

Unless expressly stated otherwise, this message is not intended
to serve as an electronic signature nor as assent to an agreement.

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

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

* Re: Get :PROPERTY: value from drawer in other heading during HTML export?
  2014-09-12 14:54 Get :PROPERTY: value from drawer in other heading during HTML export? D. C. Toedt
@ 2014-09-12 19:06 ` Nicolas Goaziou
  2014-09-12 19:37   ` D. C. Toedt
  0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Goaziou @ 2014-09-12 19:06 UTC (permalink / raw)
  To: D. C. Toedt; +Cc: emacs-orgmode

Hello,

"D. C. Toedt" <dc@toedt.com> writes:

> When generating an HTML file from an org-mode document, I'd like to do a
> GET operation to retrieve a property value from the drawer of an arbitrary
> heading, using the CUSTOM_ID property to identify the heading.  From
> Google-searching, I suspect that "org-heading-components" will be involved,
> but I'm not proficient enough in elisp to be able to figure out how to use
> it from the on-line examples I've found --- and I'm not proficient enough
> in Emacs to use any built-in documentation about it ("apropos" doesn't
> produce any results).
>

[...]

> #+MACRO: get-title [omitted -- thanks to Nicolas Goaziou for the get-title
> macro, at
>
> https://lists.gnu.org/archive/html/emacs-orgmode/2014-02/msg00386.html]

You can use the same macro, replacing

  (org-get-heading nil nil) 

with

  (org-entry-get (point) "$2")

IOW,

  #+MACRO: GET-PROP (eval (or (save-excursion (ignore-errors (let ((org-link-search-inhibit-query t)) (org-open-link-from-string "[[#$1]]") (org-entry-get (point) "$2")))) "UNKNOWN VALUE"))


Regards,

-- 
Nicolas Goaziou

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

* Re: Get :PROPERTY: value from drawer in other heading during HTML export?
  2014-09-12 19:06 ` Nicolas Goaziou
@ 2014-09-12 19:37   ` D. C. Toedt
  0 siblings, 0 replies; 3+ messages in thread
From: D. C. Toedt @ 2014-09-12 19:37 UTC (permalink / raw)
  To: D. C. Toedt, emacs-orgmode

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

Beautiful -- thanks!

Is there any documentation I can read to get a sense of how things work?
 I've done a little bit of browsing inside org.el and its comments, but
that seems like it's not the most effective way to get up to speed.


Regards,

--D. C.

*D*ell *C*harles "D. C." Toedt III  *(my** last name is pronounced "Tate") *
Attorney and neutral arbitrator -- tech contracts and intellectual property
Lecturer, University of Houston Law Center
​Editor, ​​​Common Draft <http://www.commondraft.org/> project:  A readable
library of best-practices contract clauses,
     with extensive citations and commentary, updated often.
dc@toedt.com     LinkedIn: dctoedt <http://www.linkedin.com/in/dctoedt>
Calendar
<https://www.google.com/calendar/embed?src=dc.toedt@toedt.com&mode=WEEK>
(redacted)
O: +1 (713) 364-6545    C: +1 (713) 516-8968
​​

​
Houston, Texas (Central time zone)

Unless expressly stated otherwise, this message is not intended
to serve as an electronic signature nor as assent to an agreement.



On Fri, Sep 12, 2014 at 2:06 PM, Nicolas Goaziou <mail@nicolasgoaziou.fr>
wrote:

> Hello,
>
> "D. C. Toedt" <dc@toedt.com> writes:
>
> > When generating an HTML file from an org-mode document, I'd like to do a
> > GET operation to retrieve a property value from the drawer of an
> arbitrary
> > heading, using the CUSTOM_ID property to identify the heading.  From
> > Google-searching, I suspect that "org-heading-components" will be
> involved,
> > but I'm not proficient enough in elisp to be able to figure out how to
> use
> > it from the on-line examples I've found --- and I'm not proficient enough
> > in Emacs to use any built-in documentation about it ("apropos" doesn't
> > produce any results).
> >
>
> [...]
>
> > #+MACRO: get-title [omitted -- thanks to Nicolas Goaziou for the
> get-title
> > macro, at
> >
> > https://lists.gnu.org/archive/html/emacs-orgmode/2014-02/msg00386.html]
>
> You can use the same macro, replacing
>
>   (org-get-heading nil nil)
>
> with
>
>   (org-entry-get (point) "$2")
>
> IOW,
>
>   #+MACRO: GET-PROP (eval (or (save-excursion (ignore-errors (let
> ((org-link-search-inhibit-query t)) (org-open-link-from-string "[[#$1]]")
> (org-entry-get (point) "$2")))) "UNKNOWN VALUE"))
>
>
> Regards,
>
> --
> Nicolas Goaziou
>

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

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

end of thread, other threads:[~2014-09-12 19:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-12 14:54 Get :PROPERTY: value from drawer in other heading during HTML export? D. C. Toedt
2014-09-12 19:06 ` Nicolas Goaziou
2014-09-12 19:37   ` D. C. Toedt

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