[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[O] #+ATTR_MY-ASCII: in derived backend?
From: |
Thorsten Jolitz |
Subject: |
[O] #+ATTR_MY-ASCII: in derived backend? |
Date: |
Sun, 22 Sep 2013 11:04:31 +0200 |
User-agent: |
Gnus/5.130002 (Ma Gnus v0.2) Emacs/24.3 (gnu/linux) |
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
- [O] #+ATTR_MY-ASCII: in derived backend?,
Thorsten Jolitz <=