* two simple derived backend questions
@ 2015-10-14 18:22 Matt Price
2015-10-14 22:55 ` Rasmus
0 siblings, 1 reply; 6+ messages in thread
From: Matt Price @ 2015-10-14 18:22 UTC (permalink / raw)
To: Org Mode
[-- Attachment #1: Type: text/plain, Size: 1132 bytes --]
Hi folks,
I apologize fro relying on your charity for htis question -- I ought to
figure this out myself, but am so slow that I've run out of time.
I dhave a number of lecture slides writen in org-mode. Normally I simply
export to reveal.js using org-reveal. However, I now have to share these
notes with a co-instructor who uses markdown, but not org. This is not
fatal; I can export to markdown mode and use pandoc to create the reveal.js
slideshows.
However, there are two small difficulties:
a) add a horizontal rule
pandoc expects a horizontal rule at each slide division. So, if possible,
I would like to add an hhr element at the end of every headline.
b) speker notes
More importantly, org-reveal allows the use of speaker notes, thus:
#+BEGIN_NOTES
whatever I put here
#+ END_NOTES
is exported as:
<aside class="speaker-notes">
whaever I put here
</aside>
However, these blocks are ignored by the markdown exporter.
Presumably I need to add a filter, or build a very simple derived backend,
but my attempts thus far haven't been very successful. I would really
appreciate some suggestions! Thank you,
matt
[-- Attachment #2: Type: text/html, Size: 1525 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: two simple derived backend questions
2015-10-14 18:22 two simple derived backend questions Matt Price
@ 2015-10-14 22:55 ` Rasmus
2015-10-15 1:59 ` Matt Price
0 siblings, 1 reply; 6+ messages in thread
From: Rasmus @ 2015-10-14 22:55 UTC (permalink / raw)
To: emacs-orgmode
Hi Matt,
Matt Price <moptop99@gmail.com> writes:
> a) add a horizontal rule
>
> pandoc expects a horizontal rule at each slide division. So, if possible,
> I would like to add an hhr element at the end of every headline.
What’s a hhr element?
Can you just use something like
---------------------------
for a horizontal rule? AFAIK, it’s inserted as "---".
> b) speker notes
>
> More importantly, org-reveal allows the use of speaker notes, thus:
>
> #+BEGIN_NOTES
>
> whatever I put here
>
> #+ END_NOTES
>
> is exported as:
>
> <aside class="speaker-notes">
> whaever I put here
> </aside>
For me it’s inserted as
<div class="notes">
whatever I put here
</div>
Cheers,
Rasmus
--
Don't panic!!!
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: two simple derived backend questions
2015-10-14 22:55 ` Rasmus
@ 2015-10-15 1:59 ` Matt Price
2015-10-15 3:35 ` Charles C. Berry
2015-10-15 7:46 ` Rasmus
0 siblings, 2 replies; 6+ messages in thread
From: Matt Price @ 2015-10-15 1:59 UTC (permalink / raw)
To: Rasmus; +Cc: Org Mode
[-- Attachment #1: Type: text/plain, Size: 1468 bytes --]
On Wed, Oct 14, 2015 at 6:55 PM, Rasmus <rasmus@gmx.us> wrote:
> Hi Matt,
>
> Matt Price <moptop99@gmail.com> writes:
>
> > a) add a horizontal rule
> >
> > pandoc expects a horizontal rule at each slide division. So, if
> possible,
> > I would like to add an hhr element at the end of every headline.
>
> What’s a hhr element?
>
> <hr>, I meant
> Can you just use something like
> ---------------------------
>
> for a horizontal rule? AFAIK, it’s inserted as "---".
>
> yes. but then I will have to take out all the "---------------------"
elements if I want to go back to using my original org documents again.
The point is that I have lots of these lecture notes, and would prefer not
to alter them too severely if possible.
> b) speaker notes
> >
> > More importantly, org-reveal allows the use of speaker notes, thus:
> >
> > #+BEGIN_NOTES
> >
> > whatever I put here
> >
> > #+ END_NOTES
> >
> > is exported as:
> >
> > <aside class="speaker-notes">
> > whaever I put here
> > </aside>
>
> For me it’s inserted as
>
>
> <div class="notes">
> whatever I put here
>
> </div>
>
>
yes, that's right, I was being hasty. In any case, what I would like to do
is reproduce this behaviour in the markdown export; I have tried modifying
the md export but I am doing something wrong, clearly, and had hoped to get
some hints from the list...
> Cheers,
> Rasmus
>
> --
> Don't panic!!!
>
>
>
[-- Attachment #2: Type: text/html, Size: 2568 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: two simple derived backend questions
2015-10-15 1:59 ` Matt Price
@ 2015-10-15 3:35 ` Charles C. Berry
2015-10-23 18:04 ` Matt Price
2015-10-15 7:46 ` Rasmus
1 sibling, 1 reply; 6+ messages in thread
From: Charles C. Berry @ 2015-10-15 3:35 UTC (permalink / raw)
To: Matt Price; +Cc: Org Mode, Rasmus
[-- Attachment #1: Type: text/plain, Size: 2787 bytes --]
On Wed, 14 Oct 2015, Matt Price wrote:
> On Wed, Oct 14, 2015 at 6:55 PM, Rasmus <rasmus@gmx.us> wrote:
>
>> Hi Matt,
>>
>> Matt Price <moptop99@gmail.com> writes:
>>
>>> a) add a horizontal rule
>>>
>>> pandoc expects a horizontal rule at each slide division. So, if
>> possible,
>>> I would like to add an hhr element at the end of every headline.
>>
>> What’s a hhr element?
>>
>> <hr>, I meant
>
>> Can you just use something like
>> ---------------------------
>>
>> for a horizontal rule? AFAIK, it’s inserted as "---".
>>
>> yes. but then I will have to take out all the "---------------------"
> elements if I want to go back to using my original org documents again.
> The point is that I have lots of these lecture notes, and would prefer not
> to alter them too severely if possible.
Err, what about
--8<---------------cut here---------------start------------->8---
#+MACRO: hhr #+MD: ---
* abc
first slide
{{{hhr}}}
* def
second slide
{{{hhr}}}
--8<---------------cut here---------------end--------------->8---
>
>> b) speaker notes
>>>
>>> More importantly, org-reveal allows the use of speaker notes, thus:
>>>
>>> #+BEGIN_NOTES
>>>
>>> whatever I put here
>>>
>>> #+ END_NOTES
>>>
>>> is exported as:
>>>
>>> <aside class="speaker-notes">
>>> whaever I put here
>>> </aside>
>>
>> For me it’s inserted as
>>
>>
>> <div class="notes">
>> whatever I put here
>>
>> </div>
>>
>>
> yes, that's right, I was being hasty. In any case, what I would like to do
> is reproduce this behaviour in the markdown export; I have tried modifying
> the md export but I am doing something wrong, clearly, and had hoped to get
> some hints from the list...
>
>
Ok here is a hint. You can add a menu item if you really need it.
--8<---------------cut here---------------start------------->8---
#+BEGIN_SRC emacs-lisp
(org-export-define-derived-backend
'md-plus
'md
:translate-alist '(
(export-block . org-md-plus-export-block))
:export-block '("NOTES"))
(defun org-md-plus-export-block
(export-block contents info)
"Transcode a EXPORT-BLOCK NOTES element from Org to md-plus.
CONTENTS is nil. INFO is a plist holding contextual information."
(if (equal (org-element-property :type export-block) "NOTES")
(concat "<aside class=\"speaker-notes\">\n"
(org-element-property :value export-block)
"</aside>\n")
(let ((parent-backend (org-export-backend-parent backend)))
(if parent-backend
(org-export-with-backend
parent-backend export-block contents info)))))
#+END_SRC
#+BEGIN_NOTES
just for the note takers...
#+END_NOTES
: Run like this
: M-x (org-export-to-buffer 'md-plus "***md-plus-out***")
--8<---------------cut here---------------end--------------->8---
HTH,
Chuck
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: two simple derived backend questions
2015-10-15 3:35 ` Charles C. Berry
@ 2015-10-23 18:04 ` Matt Price
0 siblings, 0 replies; 6+ messages in thread
From: Matt Price @ 2015-10-23 18:04 UTC (permalink / raw)
To: Charles C. Berry; +Cc: Org Mode, Rasmus
[-- Attachment #1: Type: text/plain, Size: 3385 bytes --]
Hi, I realize I never responded to say thank you.
This is a big help, and I now have things working the way I like!
matt
On Wed, Oct 14, 2015 at 11:35 PM, Charles C. Berry <ccberry@ucsd.edu> wrote:
> On Wed, 14 Oct 2015, Matt Price wrote:
>
> On Wed, Oct 14, 2015 at 6:55 PM, Rasmus <rasmus@gmx.us> wrote:
>>
>> Hi Matt,
>>>
>>> Matt Price <moptop99@gmail.com> writes:
>>>
>>> a) add a horizontal rule
>>>>
>>>> pandoc expects a horizontal rule at each slide division. So, if
>>>>
>>> possible,
>>>
>>>> I would like to add an hhr element at the end of every headline.
>>>>
>>>
>>> What’s a hhr element?
>>>
>>> <hr>, I meant
>>>
>>
>> Can you just use something like
>>> ---------------------------
>>>
>>> for a horizontal rule? AFAIK, it’s inserted as "---".
>>>
>>> yes. but then I will have to take out all the "---------------------"
>>>
>> elements if I want to go back to using my original org documents again.
>> The point is that I have lots of these lecture notes, and would prefer not
>> to alter them too severely if possible.
>>
>
>
> Err, what about
>
>
>
> --8<---------------cut here---------------start------------->8---
> #+MACRO: hhr #+MD: ---
>
> * abc
>
> first slide
>
> {{{hhr}}}
>
> * def
>
> second slide
>
> {{{hhr}}}
>
> --8<---------------cut here---------------end--------------->8---
>
>
>> b) speaker notes
>>>
>>>>
>>>> More importantly, org-reveal allows the use of speaker notes, thus:
>>>>
>>>> #+BEGIN_NOTES
>>>>
>>>> whatever I put here
>>>>
>>>> #+ END_NOTES
>>>>
>>>> is exported as:
>>>>
>>>> <aside class="speaker-notes">
>>>> whaever I put here
>>>> </aside>
>>>>
>>>
>>> For me it’s inserted as
>>>
>>>
>>> <div class="notes">
>>> whatever I put here
>>>
>>> </div>
>>>
>>>
>>> yes, that's right, I was being hasty. In any case, what I would like to
>> do
>> is reproduce this behaviour in the markdown export; I have tried modifying
>> the md export but I am doing something wrong, clearly, and had hoped to
>> get
>> some hints from the list...
>>
>>
>>
> Ok here is a hint. You can add a menu item if you really need it.
>
>
> --8<---------------cut here---------------start------------->8---
> #+BEGIN_SRC emacs-lisp
> (org-export-define-derived-backend
> 'md-plus
> 'md
> :translate-alist '(
> (export-block . org-md-plus-export-block))
> :export-block '("NOTES"))
>
> (defun org-md-plus-export-block
> (export-block contents info)
> "Transcode a EXPORT-BLOCK NOTES element from Org to md-plus.
> CONTENTS is nil. INFO is a plist holding contextual information."
> (if (equal (org-element-property :type export-block) "NOTES")
> (concat "<aside class=\"speaker-notes\">\n"
> (org-element-property :value export-block)
> "</aside>\n")
> (let ((parent-backend (org-export-backend-parent backend)))
> (if parent-backend
> (org-export-with-backend
> parent-backend export-block contents info)))))
>
> #+END_SRC
>
>
> #+BEGIN_NOTES
> just for the note takers...
> #+END_NOTES
>
> : Run like this
> : M-x (org-export-to-buffer 'md-plus "***md-plus-out***")
> --8<---------------cut here---------------end--------------->8---
>
>
> HTH,
>
> Chuck
>
[-- Attachment #2: Type: text/html, Size: 5227 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: two simple derived backend questions
2015-10-15 1:59 ` Matt Price
2015-10-15 3:35 ` Charles C. Berry
@ 2015-10-15 7:46 ` Rasmus
1 sibling, 0 replies; 6+ messages in thread
From: Rasmus @ 2015-10-15 7:46 UTC (permalink / raw)
To: moptop99; +Cc: emacs-orgmode
Hi Matt,
Matt Price <moptop99@gmail.com> writes:
>> > a) add a horizontal rule
>> >
>> > pandoc expects a horizontal rule at each slide division. So, if
>> possible,
>> > I would like to add an hhr element at the end of every headline.
>>
>> What’s a hhr element?
>>
>> <hr>, I meant
>
>> Can you just use something like
>> ---------------------------
>>
>> for a horizontal rule? AFAIK, it’s inserted as "---".
>>
>> yes. but then I will have to take out all the "---------------------"
> elements if I want to go back to using my original org documents again.
> The point is that I have lots of these lecture notes, and would prefer not
> to alter them too severely if possible.
In that case I would indeed use a filter and run it conditional on the
file path, available through the info plist.
You could can add lines via org-export-before-processing-hook. Combine,
outline-next-heading (or just re-search-forward and org-heading-regexp),
check with org-element-at-point or org-outline-level and go to the end of
the headline and insert your line (if you use org-element-at-point for
this, remember to skip backwards through the " \n\t").
> yes, that's right, I was being hasty. In any case, what I would like to do
> is reproduce this behaviour in the markdown export; I have tried modifying
> the md export but I am doing something wrong, clearly, and had hoped to get
> some hints from the list...
It gives a div already with ox-md, right? What do you want more? Do you
want it to be an <aside ...></aside ...> element? If so, use a filter on
org-export-filter-special-block-functions that does a regexp replacement.
Rasmus
--
Don't panic!!!
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-10-23 18:04 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-14 18:22 two simple derived backend questions Matt Price
2015-10-14 22:55 ` Rasmus
2015-10-15 1:59 ` Matt Price
2015-10-15 3:35 ` Charles C. Berry
2015-10-23 18:04 ` Matt Price
2015-10-15 7:46 ` Rasmus
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.