Re: [O] two simple derived backend questions

2015-10-23 Thread Matt Price
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  wrote:

> On Wed, 14 Oct 2015, Matt Price wrote:
>
> On Wed, Oct 14, 2015 at 6:55 PM, Rasmus  wrote:
>>
>> Hi Matt,
>>>
>>> Matt Price  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?
>>>
>>> , 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:

 
 whaever I put here
 

>>>
>>> For me it’s inserted as
>>>
>>>
>>> 
>>> whatever I put here
>>>
>>> 
>>>
>>>
>>> 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 "\n"
> (org-element-property :value export-block)
> "\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
>


Re: [O] two simple derived backend questions

2015-10-15 Thread Rasmus
Hi Matt,

Matt Price  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?
>>
>> , 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  element?  If so, use a filter on
org-export-filter-special-block-functions that does a regexp replacement.

Rasmus

-- 
Don't panic!!!



Re: [O] two simple derived backend questions

2015-10-14 Thread Charles C. Berry

On Wed, 14 Oct 2015, Matt Price wrote:


On Wed, Oct 14, 2015 at 6:55 PM, Rasmus  wrote:


Hi Matt,

Matt Price  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?

, 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:


whaever I put here



For me it’s inserted as



whatever I put here





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 "\n"
(org-element-property :value export-block)
"\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


Re: [O] two simple derived backend questions

2015-10-14 Thread Matt Price
On Wed, Oct 14, 2015 at 6:55 PM, Rasmus  wrote:

> Hi Matt,
>
> Matt Price  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?
>
> , 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:
> >
> > 
> > whaever I put here
> > 
>
> For me it’s inserted as
>
>
> 
> whatever I put here
>
> 
>
>
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!!!
>
>
>


Re: [O] two simple derived backend questions

2015-10-14 Thread Rasmus
Hi Matt,

Matt Price  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:
>
> 
> whaever I put here
> 

For me it’s inserted as



whatever I put here



Cheers,
Rasmus

-- 
Don't panic!!!




[O] two simple derived backend questions

2015-10-14 Thread Matt Price
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:


whaever I put here


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