emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eduardo Bellani <ebellani@gmail.com>
To: emacs-org list <emacs-orgmode@gnu.org>
Subject: How to change the export semantics of the property-drawer?
Date: Fri, 15 Sep 2017 14:54:42 -0300	[thread overview]
Message-ID: <87y3pfyhi5.fsf@personal> (raw)

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

Hello list.

I am trying to export the property-drawer as a description list on an
html derived backend, but I'm afraid I got stuck after some effort in
it.

Basically, I wanted this:

,----
| * Some
|   :PROPERTIES:
|   :CUSTOM_ID: 123
|   :END:
`----

To be exported *as if* it was this

,----
| * Some
|   - custom_id :: 123
`----

The problem I am facing is, how to resolve links in properties? The
example below illustrates the maximum point I've reached in my efforts

If someone can point me to a path, I'll be happy to follow it.

Thanks.

,----
| #+options: prop:t
|
| * some
|   :PROPERTIES:
|   :CUSTOM_ID: qwe123
|   :END:
|
| * another
|   :PROPERTIES:
|   :link:   [[#qwe123]]
|   :END:
|
|
|
| #+BEGIN_SRC emacs-lisp
|   (defun fee-html-property-drawer (property-drawer contents info)
|     "Transcode a property-drawer into a descriptive list."
|     (let* ((drawer-properties
|             (with-temp-buffer
|               (org-mode)
|               (insert (format "* H\n%s" (org-element-interpret-data property-drawer)))
|               (goto-char (point-min))
|               (org-element--get-node-properties)))
|            (dlist))
|       (--> drawer-properties
|            (ht<-plist it)
|            (ht-map (-lambda (key value)
|                      (format "- %s :: %s"
|                              (string-trim (symbol-name key) ":") value))
|                    it)
|            (string-join it "\n")
|            (org-export-string-as it
|                                  'html
|                                  t
|                                  info))))
|
|   (org-export-define-derived-backend 'fee-html 'html
|     :translate-alist '((property-drawer . fee-html-property-drawer)))
| #+END_SRC
|
`----

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 180 bytes --]

             reply	other threads:[~2017-09-15 17:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-15 17:54 Eduardo Bellani [this message]
2017-09-15 19:49 ` How to change the export semantics of the property-drawer? Eduardo Bellani
2017-09-15 20:02 ` Nicolas Goaziou

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=87y3pfyhi5.fsf@personal \
    --to=ebellani@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).