emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Adding new switch or header
@ 2015-11-03 15:54 Phillip Lord
  2015-11-03 16:58 ` Eric S Fraga
  0 siblings, 1 reply; 6+ messages in thread
From: Phillip Lord @ 2015-11-03 15:54 UTC (permalink / raw)
  To: emacs-orgmode



I am trying to implement a new backend based on the HTML export. I need
to do some post-processing to the source blocks that needs to be
optional. For some blocks I need to replace "[" with "\[" and for some I
don't.

I am not sure whether to use headers or switches.

So

#+begin_src java -s
  student[ 4 ]
#+end_src

would produce html with

  student\[ 4 ]

inside, while

#+begin_src java
  student[ 4 ]
#+end_src

would produce just

  student[ 4 ]


Is it possible to add new switches? And in the exporter how do I know
which switches are present on a block?

Phil

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

* Re: Adding new switch or header
  2015-11-03 15:54 Adding new switch or header Phillip Lord
@ 2015-11-03 16:58 ` Eric S Fraga
  2015-11-03 21:57   ` Phillip Lord
  0 siblings, 1 reply; 6+ messages in thread
From: Eric S Fraga @ 2015-11-03 16:58 UTC (permalink / raw)
  To: Phillip Lord; +Cc: emacs-orgmode

On Tuesday,  3 Nov 2015 at 15:54, Phillip Lord wrote:
> I am trying to implement a new backend based on the HTML export. I need
> to do some post-processing to the source blocks that needs to be
> optional. For some blocks I need to replace "[" with "\[" and for some I
> don't.
>
> I am not sure whether to use headers or switches.

What about neither?  Maybe something along #+ATTR_XXX: instead, where
XXX is the name of your derived backend, along the lines of ATTR_HTML
and ATTR_LATEX?

Others may tell us that my suggestion is worse but I think playing
around with the babel syntax is asking for trouble...
-- 
: Eric S Fraga (0xFFFCF67D), Emacs 25.0.50.2, Org release_8.3.2-209-gba4d33

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

* Re: Adding new switch or header
  2015-11-03 16:58 ` Eric S Fraga
@ 2015-11-03 21:57   ` Phillip Lord
  2015-11-04  9:05     ` Eric S Fraga
  0 siblings, 1 reply; 6+ messages in thread
From: Phillip Lord @ 2015-11-03 21:57 UTC (permalink / raw)
  To: emacs-orgmode

Eric S Fraga <e.fraga@ucl.ac.uk> writes:

> On Tuesday,  3 Nov 2015 at 15:54, Phillip Lord wrote:
>> I am trying to implement a new backend based on the HTML export. I need
>> to do some post-processing to the source blocks that needs to be
>> optional. For some blocks I need to replace "[" with "\[" and for some I
>> don't.
>>
>> I am not sure whether to use headers or switches.
>
> What about neither?  Maybe something along #+ATTR_XXX: instead, where
> XXX is the name of your derived backend, along the lines of ATTR_HTML
> and ATTR_LATEX?
>
> Others may tell us that my suggestion is worse but I think playing
> around with the babel syntax is asking for trouble...

That's a good call, I think. The latex example is very clear, so I've
got that implemented now.

Are these form of attributes specific to the source block which they
precede? Or is it possible to do any kind of inheritance with them? For
my use case, all the code blocks inside a Header One block will behave
in the same way (either with \[ escaping or without).

Not a major problem if not, I can template it if not, but useful to
know.


Phil

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

* Re: Adding new switch or header
  2015-11-03 21:57   ` Phillip Lord
@ 2015-11-04  9:05     ` Eric S Fraga
  2015-11-04 17:24       ` Phillip Lord
  2015-11-04 22:50       ` Nicolas Goaziou
  0 siblings, 2 replies; 6+ messages in thread
From: Eric S Fraga @ 2015-11-04  9:05 UTC (permalink / raw)
  To: Phillip Lord; +Cc: emacs-orgmode

On Tuesday,  3 Nov 2015 at 21:57, Phillip Lord wrote:

[...]

> Are these form of attributes specific to the source block which they
> precede? Or is it possible to do any kind of inheritance with them? For
> my use case, all the code blocks inside a Header One block will behave
> in the same way (either with \[ escaping or without).

No idea!  Maybe Nicolas can help here as I assume this is all a function
of the parser.
-- 
: Eric S Fraga (0xFFFCF67D), Emacs 25.0.50.2, Org release_8.3.2-209-gba4d33

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

* Re: Adding new switch or header
  2015-11-04  9:05     ` Eric S Fraga
@ 2015-11-04 17:24       ` Phillip Lord
  2015-11-04 22:50       ` Nicolas Goaziou
  1 sibling, 0 replies; 6+ messages in thread
From: Phillip Lord @ 2015-11-04 17:24 UTC (permalink / raw)
  To: emacs-orgmode

Eric S Fraga <e.fraga@ucl.ac.uk> writes:

> On Tuesday,  3 Nov 2015 at 21:57, Phillip Lord wrote:
>
> [...]
>
>> Are these form of attributes specific to the source block which they
>> precede? Or is it possible to do any kind of inheritance with them? For
>> my use case, all the code blocks inside a Header One block will behave
>> in the same way (either with \[ escaping or without).
>
> No idea!  Maybe Nicolas can help here as I assume this is all a function
> of the parser.

No worries. Many thanks for the feedback.

Phil

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

* Re: Adding new switch or header
  2015-11-04  9:05     ` Eric S Fraga
  2015-11-04 17:24       ` Phillip Lord
@ 2015-11-04 22:50       ` Nicolas Goaziou
  1 sibling, 0 replies; 6+ messages in thread
From: Nicolas Goaziou @ 2015-11-04 22:50 UTC (permalink / raw)
  To: Phillip Lord; +Cc: emacs-orgmode

Hello,

Eric S Fraga <e.fraga@ucl.ac.uk> writes:

> On Tuesday,  3 Nov 2015 at 21:57, Phillip Lord wrote:
>
> [...]
>
>> Are these form of attributes specific to the source block which they
>> precede? Or is it possible to do any kind of inheritance with them? For
>> my use case, all the code blocks inside a Header One block will behave
>> in the same way (either with \[ escaping or without).
>
> No idea!  Maybe Nicolas can help here as I assume this is all a function
> of the parser.

Attributes apply to the block below. However, with a parse tree filter,
it is possible to find a block with some attribute and apply the same
attribute to all blocks in the same level one heading.


Regards,

-- 
Nicolas Goaziou

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

end of thread, other threads:[~2015-11-04 22:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-03 15:54 Adding new switch or header Phillip Lord
2015-11-03 16:58 ` Eric S Fraga
2015-11-03 21:57   ` Phillip Lord
2015-11-04  9:05     ` Eric S Fraga
2015-11-04 17:24       ` Phillip Lord
2015-11-04 22:50       ` Nicolas Goaziou

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