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
exists)?
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-
hline?
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
blah.
Which gets exported as:
- First item.!EOI!!NP!
- This is!EOI!!BLS!
!ELS! an item!EOL!
on three lines.!EOL!
!NP!
- Bar foo!EOI!!BLS!
!ELS! blah.!EOL!
!NP!
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
there.
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,
Matteo
P.S.: please keep me CC'ed if you answer this email, as I am not subscribed to
the list.
--- org-export-generic.el.orig 2012-11-13 17:59:22.795585712 +0100
+++ org-export-generic.el 2012-11-13 19:33:15.458769199 +0100
@@ -371,6 +371,103 @@
)
;;
+;; txt2tags
+;;
+(txt2tags
+ :file-suffix .t2t
+ :key-binding ?2
+
+ ; Header
+ :title-format %s\n
+ :author-export t
+ :date-export t
+ :date-suffix \n
+ :toc-exportnil
+
+ ; Titles sections
+ :body-section-prefix
+ :body-header-section-numbers nil
+ :body-section-header-prefix (\n\n\n= \n== ===
+ = == )
+ :body-section-header-format%s
+ :body-section-header-suffix ( =\n ==\n ===\n
+ \n =\n ==\n)
+
+ ; General line format
+ :body-line-format %s\n
+ :body-line-wrap72
+ ; To have a new line after each paragraph:
+ :body-newline-paragraph\n
+ :body-text-prefix
+ :body-text-suffix
+
+ ; Lists
+ ; Note: nested lists are not handled by org-export-generic yet.
+ ; /!\ Multi-line items get a new line after their first line
+ ; (because of :body-newline-paragraph)
+ :body-list-format - %s
+