* #+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
* Re: #+ATTR_MY-ASCII: in derived backend?
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
0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Goaziou @ 2013-09-22 12:36 UTC (permalink / raw)
To: Thorsten Jolitz; +Cc: emacs-orgmode
Hello,
Thorsten Jolitz <tjolitz@gmail.com> writes:
> 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?
You can use any name you want for attributes
#+attr_my-special-name
and then retrieve it with
(org-export-read-attribute :attr_my-special-name element)
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: #+ATTR_MY-ASCII: in derived backend?
2013-09-22 12:36 ` Nicolas Goaziou
@ 2013-09-22 13:01 ` Thorsten Jolitz
0 siblings, 0 replies; 3+ messages in thread
From: Thorsten Jolitz @ 2013-09-22 13:01 UTC (permalink / raw)
To: emacs-orgmode
Nicolas Goaziou <n.goaziou@gmail.com> writes:
Hello,
> Thorsten Jolitz <tjolitz@gmail.com> writes:
>
>> 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?
>
> You can use any name you want for attributes
>
> #+attr_my-special-name
>
> and then retrieve it with
>
> (org-export-read-attribute :attr_my-special-name element)
I've seen this in ox backends, but since I sometimes simply use the
parse-tree as produced by `org-element-parse-buffer', I wonder why
something like
,------------------------------------------------
| #+CAPTION: My minimal table
| #+ATTR_HTML: :border 2 :rules all :frame border
| | col1 | col2 |
| |------+------|
| | val1 | val2 |
`------------------------------------------------
actually is included in the tables property list
,--------------------------------------------------------------------------
| (table (begin 205... attr_html (":border 2 ... :frame border") ...) )
`--------------------------------------------------------------------------
although the exporter is never called - only org-element?
PS
I would like to have that too - how is that achieved?
--
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).