emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Org-publish: adding a new format?
@ 2010-02-11  4:43 Bill Powell
  2010-02-11  6:41 ` Carsten Dominik
  2010-02-11 13:53 ` OrgmodeOrg-publish: " Wes Hardaker
  0 siblings, 2 replies; 4+ messages in thread
From: Bill Powell @ 2010-02-11  4:43 UTC (permalink / raw)
  To: emacs-orgmode


Hi all,

Does anyone have any suggestions for adding a new format to
"org-publish"? Any articles, or threads on the mailing list? I've
looked around but haven't found anywhere to start.

I want to convert an org file to a tab-separated format, so that it
can be imported into a flashcard program called Anki
[[http://ichi2.net/anki/]]. The basic idea is that each *** header is
a prompt, and the following text is the answer.

*** Who wrote /War and Peace/?

Leo Tolstoy.

*** What is the preferred editor for using Org-mode?

Windows Notepad.


and so on.

The catch is, I'd also like to preserve the *bold* and /italic/ formatting.
Not to mention those awesome org-tables.

Now, Anki understands HTML formatting. So, ideally, I can use the
excellent export to HTML that org-publish already does. That's 95% of
the work right there.

In fact, I have already written a Perl script that takes an exported
HTML file and chomps it into a .tsv. (Almost.)

But although my elisp is pretty rudimentary, I have a couple reasons
I'd like to implement this within org-publish instead:

1) I could share my work (at least by posting it on my web site; my elisp
isn't ready for official contributions yet), and

2) It might make it easier to access the different org-elements
directly. For instance, I use *** headers as prompts, so that I can
use * and ** to organize the flashcards in the org-file. But, I would
like to be able to save the * and ** headers, and use them as "tags" in
the final Anki flashcard. (Anki lets you tag your flashcard.)
Similarly, I'd like to convert org-mode :tags: as well.

I can do all this in Perl, but it feels messy and inelegant, not to
mention brittle.

On the other hand, those who know org-publish may feel that this is a
tall order for org-export-html-final-hook, and just the sort of job
that Perl does best.

Any thoughts?

Thanks,
Bill Powell

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

* Re: Org-publish: adding a new format?
  2010-02-11  4:43 Org-publish: adding a new format? Bill Powell
@ 2010-02-11  6:41 ` Carsten Dominik
  2010-02-11 18:12   ` Bill Powell
  2010-02-11 13:53 ` OrgmodeOrg-publish: " Wes Hardaker
  1 sibling, 1 reply; 4+ messages in thread
From: Carsten Dominik @ 2010-02-11  6:41 UTC (permalink / raw)
  To: Bill Powell; +Cc: emacs-orgmode

Hi Bill,

the best approach might be to write an elisp program to do the post  
processing you do now in perl, and then to hook this function into  
`org-publish-after-export-hook'.

- Carsten

On Feb 11, 2010, at 5:43 AM, Bill Powell wrote:

>
> Hi all,
>
> Does anyone have any suggestions for adding a new format to
> "org-publish"? Any articles, or threads on the mailing list? I've
> looked around but haven't found anywhere to start.
>
> I want to convert an org file to a tab-separated format, so that it
> can be imported into a flashcard program called Anki
> [[http://ichi2.net/anki/]]. The basic idea is that each *** header is
> a prompt, and the following text is the answer.
>
> *** Who wrote /War and Peace/?
>
> Leo Tolstoy.
>
> *** What is the preferred editor for using Org-mode?
>
> Windows Notepad.
>
>
> and so on.
>
> The catch is, I'd also like to preserve the *bold* and /italic/  
> formatting.
> Not to mention those awesome org-tables.
>
> Now, Anki understands HTML formatting. So, ideally, I can use the
> excellent export to HTML that org-publish already does. That's 95% of
> the work right there.
>
> In fact, I have already written a Perl script that takes an exported
> HTML file and chomps it into a .tsv. (Almost.)
>
> But although my elisp is pretty rudimentary, I have a couple reasons
> I'd like to implement this within org-publish instead:
>
> 1) I could share my work (at least by posting it on my web site; my  
> elisp
> isn't ready for official contributions yet), and
>
> 2) It might make it easier to access the different org-elements
> directly. For instance, I use *** headers as prompts, so that I can
> use * and ** to organize the flashcards in the org-file. But, I would
> like to be able to save the * and ** headers, and use them as "tags"  
> in
> the final Anki flashcard. (Anki lets you tag your flashcard.)
> Similarly, I'd like to convert org-mode :tags: as well.
>
> I can do all this in Perl, but it feels messy and inelegant, not to
> mention brittle.
>
> On the other hand, those who know org-publish may feel that this is a
> tall order for org-export-html-final-hook, and just the sort of job
> that Perl does best.
>
> Any thoughts?
>
> Thanks,
> Bill Powell
>
>
>
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

- Carsten

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

* Re: OrgmodeOrg-publish: adding a new format?
  2010-02-11  4:43 Org-publish: adding a new format? Bill Powell
  2010-02-11  6:41 ` Carsten Dominik
@ 2010-02-11 13:53 ` Wes Hardaker
  1 sibling, 0 replies; 4+ messages in thread
From: Wes Hardaker @ 2010-02-11 13:53 UTC (permalink / raw)
  To: Bill Powell; +Cc: emacs-orgmode

>>>>> On Wed, 10 Feb 2010 23:43:05 -0500, Bill Powell <bill@billpowellisalive.com> said:

BP> Does anyone have any suggestions for adding a new format to
BP> "org-publish"? Any articles, or threads on the mailing list? I've
BP> looked around but haven't found anywhere to start.

You might check out org-export-generic in the contrib directory.

http://orgmode.org/worg/org-contrib/org-export-generic.php
-- 
Wes Hardaker                                     
My Pictures:  http://capturedonearth.com/
My Thoughts:  http://pontifications.hardakers.net/

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

* Re: Org-publish: adding a new format?
  2010-02-11  6:41 ` Carsten Dominik
@ 2010-02-11 18:12   ` Bill Powell
  0 siblings, 0 replies; 4+ messages in thread
From: Bill Powell @ 2010-02-11 18:12 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode

At Thu, 11 Feb 2010 07:41:10 +0100,
Carsten Dominik wrote:
> 
> Hi Bill,
> 
> the best approach might be to write an elisp program to do the post  
> processing you do now in perl, and then to hook this function into  
> `org-publish-after-export-hook'.
> 
> - Carsten

Thanks, Carsten! I will look into that.

Thanks also to Wes for pointing out your org-export-generic. (It was
already on my export screen, and I only noticed it this morning.) The
problem there is that all the *bold* and /italic/ and unicode
characters and tables and things won't be converted to HTML, unless
I'm mistaken. On the other hand, I'm glad to have this brought to my
attention, as I'm sure I'll find a use for it. :)

Bill Powell


> 
> On Feb 11, 2010, at 5:43 AM, Bill Powell wrote:
> 
> >
> > Hi all,
> >
> > Does anyone have any suggestions for adding a new format to
> > "org-publish"? Any articles, or threads on the mailing list? I've
> > looked around but haven't found anywhere to start.
> >
> > I want to convert an org file to a tab-separated format, so that it
> > can be imported into a flashcard program called Anki
> > [[http://ichi2.net/anki/]]. The basic idea is that each *** header is
> > a prompt, and the following text is the answer.
> >
> > *** Who wrote /War and Peace/?
> >
> > Leo Tolstoy.
> >
> > *** What is the preferred editor for using Org-mode?
> >
> > Windows Notepad.
> >
> >
> > and so on.
> >
> > The catch is, I'd also like to preserve the *bold* and /italic/  
> > formatting.
> > Not to mention those awesome org-tables.
> >
> > Now, Anki understands HTML formatting. So, ideally, I can use the
> > excellent export to HTML that org-publish already does. That's 95% of
> > the work right there.
> >
> > In fact, I have already written a Perl script that takes an exported
> > HTML file and chomps it into a .tsv. (Almost.)
> >
> > But although my elisp is pretty rudimentary, I have a couple reasons
> > I'd like to implement this within org-publish instead:
> >
> > 1) I could share my work (at least by posting it on my web site; my  
> > elisp
> > isn't ready for official contributions yet), and
> >
> > 2) It might make it easier to access the different org-elements
> > directly. For instance, I use *** headers as prompts, so that I can
> > use * and ** to organize the flashcards in the org-file. But, I would
> > like to be able to save the * and ** headers, and use them as "tags"  
> > in
> > the final Anki flashcard. (Anki lets you tag your flashcard.)
> > Similarly, I'd like to convert org-mode :tags: as well.
> >
> > I can do all this in Perl, but it feels messy and inelegant, not to
> > mention brittle.
> >
> > On the other hand, those who know org-publish may feel that this is a
> > tall order for org-export-html-final-hook, and just the sort of job
> > that Perl does best.
> >
> > Any thoughts?
> >
> > Thanks,
> > Bill Powell
> >
> >
> >
> >
> >
> >
> > _______________________________________________
> > Emacs-orgmode mailing list
> > Please use `Reply All' to send replies to the list.
> > Emacs-orgmode@gnu.org
> > http://lists.gnu.org/mailman/listinfo/emacs-orgmode
> 
> - Carsten
> 
> 
> 

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

end of thread, other threads:[~2010-02-11 18:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-11  4:43 Org-publish: adding a new format? Bill Powell
2010-02-11  6:41 ` Carsten Dominik
2010-02-11 18:12   ` Bill Powell
2010-02-11 13:53 ` OrgmodeOrg-publish: " Wes Hardaker

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