emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Seong-Kook Shin <cinsky@gmail.com>
To: emacs-orgmode@gnu.org
Subject: accessing ATTR_HTML and CAPTION from custom
Date: Fri, 9 Mar 2018 19:53:49 -0800	[thread overview]
Message-ID: <5095d0b6-787e-1ac0-fd71-2c1e73454d22@gmail.com> (raw)

Hello,

I'm using Nikola (https://getnikola.com/) with its orgmode plugin to 
write blog posts.  Their script contains following custom link for HTML 
export:

     (defun org-custom-link-img-url-export (path desc format)
       (cond
        ((eq format 'html)
         (format "<img src=\"%s\" alt=\"%s\"/>" path desc))))
     (org-add-link-type "img-url" nil 'org-custom-link-img-url-export)


And I have org-mode contents like this:

     #+CAPTION: some caption for the image
     #+ATTR_HTML: width="60%"
     [[img-url:/img/a.jpg]]

I found that somehow DESC parameter passed to above 
org-custom-link-img-url-export function contains all information 
regarding CAPTION and ATTR_HTML but unable to retrieve it properly.  Is 
there any org utility functions to retrieve them?  For example, I want 
to access 'width' parameter from ATTR_HTML like this:

     (defun org-custom-link-img-url-export (path desc format)
       (cond
        ((eq format 'html)
         (let ((width (SOME-FUNCTION desc :width)))
           (if (null width)
               (format "<img ... width=\"%s\"/>" ... width)
             (format "<img .../>" ...))))))

Could you help me how to do that?

Thank you.

                 reply	other threads:[~2018-03-10  3:53 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=5095d0b6-787e-1ac0-fd71-2c1e73454d22@gmail.com \
    --to=cinsky@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).