emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] How to change the export semantics of the property-drawer?


From: Eduardo Bellani
Subject: Re: [O] How to change the export semantics of the property-drawer?
Date: Fri, 15 Sep 2017 16:49:44 -0300
User-agent: mu4e 0.9.17; emacs 26.0.50

Sorry, I forgot about the subject tag.

Eduardo Bellani writes:

> 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: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]