emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* #+ATTR_MY-ASCII: in derived backend?
@ 2013-09-22  9:04 Thorsten Jolitz
  2013-09-22 12:36 ` Nicolas Goaziou
  0 siblings, 1 reply; 3+ messages in thread
From: Thorsten Jolitz @ 2013-09-22  9:04 UTC (permalink / raw)
  To: emacs-orgmode



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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-09-22 13:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-22  9:04 #+ATTR_MY-ASCII: in derived backend? Thorsten Jolitz
2013-09-22 12:36 ` Nicolas Goaziou
2013-09-22 13:01   ` Thorsten Jolitz

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).