From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thorsten Jolitz Subject: #+ATTR_MY-ASCII: in derived backend? Date: Sun, 22 Sep 2013 11:04:31 +0200 Message-ID: <87fvsxcjmo.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:58007) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VNfb3-0007wb-JR for emacs-orgmode@gnu.org; Sun, 22 Sep 2013 05:05:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VNfaw-0003FH-9s for emacs-orgmode@gnu.org; Sun, 22 Sep 2013 05:04:53 -0400 Received: from plane.gmane.org ([80.91.229.3]:58140) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VNfaw-0003FA-33 for emacs-orgmode@gnu.org; Sun, 22 Sep 2013 05:04:46 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1VNfau-0003rK-An for emacs-orgmode@gnu.org; Sun, 22 Sep 2013 11:04:44 +0200 Received: from e178054182.adsl.alicedsl.de ([85.178.54.182]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 22 Sep 2013 11:04:44 +0200 Received: from tjolitz by e178054182.adsl.alicedsl.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 22 Sep 2013 11:04:44 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org 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