[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] txt2tags exporter: patch & questions

From: Matteo Cypriani
Subject: [O] txt2tags exporter: patch & questions
Date: Tue, 13 Nov 2012 19:40:05 +0100
User-agent: KMail/1.13.7 (Linux/3.2.0-4-amd64; KDE/4.8.4; x86_64; ; )

Hi there,

I worked on an exporter to the txt2tags format (http://txt2tags.org/) via org-
export-generic, and I have got a few questions (that are also included as 
comments in the attached patch).

My first question is about numbered lists: they don't seem to be detected, 
i.e. numbers are kept (despite :body-number-list-leave-number is set to nil), 
and the prefix is not applied. It seems to be the case also for other formats 
handled by the generic exporter, so maybe it is a known issue.

In the same kind of issue, the #+BEGIN_QUOTE blocks does not seem to be 
detected, setting :blockquote-start and :blockquote-end doesn't have any 
effect and the text inside the block is outputted as normal paragraph text.

#+BEGIN_VERSE blocks are the same except they start with “ORG-VERSE-START” and 
end with “ORG-VERSE-END”, but I guess this is more normal since I don't find 
any mention of verse blocks in the org-export-generic code.

That said the txt2tags format doen't handle quote blocks, each line of a quote 
must be indented by a tab. Would it be possible to add something like :body-
line-quote-format and :body-line-verse-format (as :body-line-fixed-format 

I also have a problem with tables, as txt2tags doesn't handle horizontal lines 
in the tables; would it be possible to add an option like :body-line-export-

My last question is about paragraph spacing. To get a blank line between two 
paragraphs (which is the way to separate paragraphs in txt2tags as well as in 
org-mode), I set :body-newline-paragraph to "\n" (by the way that should also 
be the case at least in the MediaWiki exporter). It works as expected for 
normal paragraphs, but it becomes a mess with item lists.

I set the following variables for more visibility:
     :body-line-format              "%s!EOL!\n"
     :body-newline-paragraph        "!NP!\n"
     :body-list-format              "- %s!EOI!"
     :body-list-suffix              "!BLS!\n\n!ELS!"
So we have !EOL! before an end of line, !NP! before a new paragraph, !EOI! at 
the end of a list item (without a trailing new line), !BLS! to begin the list 
suffix and !ELS! to end it. Note that the txt2tags format requires two blank 
lines to close a list.

Now we have the following text in our org-mode buffer:

- First item.
- This is
  an item
  on three lines.
- Bar foo

Which gets exported as:

- First item.!EOI!!NP!
- This is!EOI!!BLS!

!ELS!  an item!EOL!
  on three lines.!EOL!
- Bar foo!EOI!!BLS!

!ELS!  blah.!EOL!

So, it sounds like multi-line items are not handled properly by org-generic-
exporter. In my opinion:
- :body-newline-paragraph should not be added inside a list, we can handle the 
format of an item list with :body-list-format.
- The second and subsequent lines of an item should be handled as special 
elements instead of as normal lines, i.e. :body-line-format should not be 
used, but maybe a :body-list-line-format should be added.
- The end of a list should be detected so that :body-list-suffix is added only 

I am by no mean a Lisp developper, so that is what I *think* should be done to 
get a proper handling of lists, but (1) I may be wrong, and (2) I don't think 
I can do that myself. Comments and advices appreciated.

Also, at the end of my patch is a small list of things missing in org-generic-
exporter to get a complete txt2tags support, in case someone's got some spare 
time and doesn't know where to start :-)

Thanks for reading so far,


P.S.: please keep me CC'ed if you answer this email, as I am not subscribed to 
the list.

Attachment: org-export-generic_txt2tags.diff
Description: Text Data

Attachment: signature.asc
Description: This is a digitally signed message part.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]