emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Thorsten Jolitz <tjolitz@gmail.com>
To: emacs-orgmode@gnu.org
Subject: #+ATTR_MY-ASCII: in derived backend?
Date: Sun, 22 Sep 2013 11:04:31 +0200	[thread overview]
Message-ID: <87fvsxcjmo.fsf@gmail.com> (raw)



Hi List, 

do derived backends set their attributes always via the 

,--------------
| +ATTR_BACKEND:
`--------------

construct of the parent backend and don't have their own 

,--------------
| +ATTR_MY-BACKEND:
`--------------

construct?

The following excerpt from the manual suggests this - and I actually
tried it out and the latter is not added as ':attr_my-backend "value"'
to the property list of the following element, but the former is added
as ':attr_backend "value"'.

,-----------------------------------------------------------------------------
| As an example, imagine we want the ascii back-end to display the
| language used in a source block, when it is available, but only when
| some attribute is non-nil, like the following:
|
|      #+ATTR_ASCII: :language t
|
| Because that back-end is lacking in that area, we are going to create a
| new back-end, my-ascii that will do the job.
|
|      (defun my-ascii-src-block (src-block contents info)
|        "Transcode a SRC-BLOCK element from Org to ASCII.
|      CONTENTS is nil.  INFO is a plist used as a communication
|      channel."
|        (if (not (org-export-read-attribute :attr_ascii src-block :language))
|          (org-export-with-backend 'ascii src-block contents info)
|        (concat
|         (format ",--[ %s ]--\n%s`----"
|                 (org-element-property :language src-block)
|                 (replace-regexp-in-string
|                  "^" "| "
|                  (org-element-normalize-string
|                   (org-export-format-code-default src-block info)))))))
|
|      (org-export-define-derived-backend 'my-ascii 'ascii
|        :translate-alist '((src-block . my-ascii-src-block)))
`-----------------------------------------------------------------------------

But OTOH, aren't things like 

,--------------
| +ATTR_BEAMER:
`--------------

working although its a derived backend? 

--
cheers,
Thorsten

             reply	other threads:[~2013-09-22  9:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-22  9:04 Thorsten Jolitz [this message]
2013-09-22 12:36 ` #+ATTR_MY-ASCII: in derived backend? Nicolas Goaziou
2013-09-22 13:01   ` Thorsten Jolitz

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=87fvsxcjmo.fsf@gmail.com \
    --to=tjolitz@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).