From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matteo Cypriani Subject: txt2tags exporter: patch & questions Date: Tue, 13 Nov 2012 19:40:05 +0100 Message-ID: <201211131940.06044.mcy@lm7.fr> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart1428163.WQRs1by5cq"; protocol="application/pgp-signature"; micalg=pgp-sha256 Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([208.118.235.92]:60963) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TYLOb-00015R-Qg for emacs-orgmode@gnu.org; Tue, 13 Nov 2012 13:39:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TYLOY-0001OT-Op for emacs-orgmode@gnu.org; Tue, 13 Nov 2012 13:39:37 -0500 Received: from adagio.lm7.fr ([91.121.68.23]:51495) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TYLOY-0001OO-FY for emacs-orgmode@gnu.org; Tue, 13 Nov 2012 13:39:34 -0500 Received: from silence.localnet (modemcable164.26-82-70.mc.videotron.ca [70.82.26.164]) by adagio.lm7.fr (Postfix) with ESMTPSA id 32B3F309A3 for ; Tue, 13 Nov 2012 19:39:32 +0100 (CET) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --nextPart1428163.WQRs1by5cq Content-Type: multipart/mixed; boundary="Boundary-01=_FQpoQHpzoHg1bZk" Content-Transfer-Encoding: 7bit --Boundary-01=_FQpoQHpzoHg1bZk Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi there, I worked on an exporter to the txt2tags format (http://txt2tags.org/) via o= rg- export-generic, and I have got a few questions (that are also included as=20 comments in the attached patch). My first question is about numbered lists: they don't seem to be detected,= =20 i.e. numbers are kept (despite :body-number-list-leave-number is set to nil= ),=20 and the prefix is not applied. It seems to be the case also for other forma= ts=20 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=20 detected, setting :blockquote-start and :blockquote-end doesn't have any=20 effect and the text inside the block is outputted as normal paragraph text. #+BEGIN_VERSE blocks are the same except they start with =E2=80=9CORG-VERSE= =2DSTART=E2=80=9D and=20 end with =E2=80=9CORG-VERSE-END=E2=80=9D, but I guess this is more normal s= ince I don't find=20 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 qu= ote=20 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=20 exists)? I also have a problem with tables, as txt2tags doesn't handle horizontal li= nes=20 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 tw= o=20 paragraphs (which is the way to separate paragraphs in txt2tags as well as = in=20 org-mode), I set :body-newline-paragraph to "\n" (by the way that should al= so=20 be the case at least in the MediaWiki exporter). It works as expected for=20 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=20 the end of a list item (without a trailing new line), !BLS! to begin the li= st=20 suffix and !ELS! to end it. Note that the txt2tags format requires two blan= k=20 lines to close a list. Now we have the following text in our org-mode buffer: =2D First item. =2D This is an item on three lines. =2D Bar foo blah. Which gets exported as: =2D First item.!EOI!!NP! =2D This is!EOI!!BLS! !ELS! an item!EOL! on three lines.!EOL! !NP! =2D 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: =2D :body-newline-paragraph should not be added inside a list, we can handl= e the=20 format of an item list with :body-list-format. =2D The second and subsequent lines of an item should be handled as special= =20 elements instead of as normal lines, i.e. :body-line-format should not be=20 used, but maybe a :body-list-line-format should be added. =2D The end of a list should be detected so that :body-list-suffix is added= only=20 there. I am by no mean a Lisp developper, so that is what I *think* should be done= to=20 get a proper handling of lists, but (1) I may be wrong, and (2) I don't thi= nk=20 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-gener= ic- exporter to get a complete txt2tags support, in case someone's got some spa= re=20 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=20 the list. --Boundary-01=_FQpoQHpzoHg1bZk Content-Type: text/x-patch; charset="UTF-8"; name="org-export-generic_txt2tags.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="org-export-generic_txt2tags.diff" =2D-- 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 @@ =20 ) ;; + ;; txt2tags + ;; + ("txt2tags" + :file-suffix ".t2t" + :key-binding ?2 + + ; Header + :title-format "%s\n" + :author-export t + :date-export t + :date-suffix "\n" + :toc-export nil + + ; Titles & sections + :body-section-prefix "" + :body-header-section-numbers nil + :body-section-header-prefix ("\n\n\n=3D " "\n=3D=3D " "=3D=3D=3D " + "=3D=3D=3D=3D " "=3D=3D=3D=3D=3D " "= =3D=3D=3D=3D=3D=3D ") + :body-section-header-format "%s" + :body-section-header-suffix (" =3D\n" " =3D=3D\n" " =3D=3D=3D\n" + " =3D=3D=3D=3D\n" " =3D=3D=3D=3D=3D\n"= " =3D=3D=3D=3D=3D=3D\n") + + ; General line format + :body-line-format "%s\n" + :body-line-wrap 72 + ; 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" + :body-list-suffix "\n\n" + + ; Numbered lists + ; /!\ Numbered lists does not seem to be detected in the Org source + ; file! + :body-number-list-format "+ %s\n" + :body-number-list-suffix "\n\n" + :body-number-list-leave-number nil + + ; Checkboxes + :body-list-checkbox-todo "\\1 " + :body-list-checkbox-done "\\1 " + :body-list-checkbox-half "\\1 " + :body-list-checkbox-todo-end "" + :body-list-checkbox-done-end "" + :body-list-checkbox-half-end "\n" + + ; Text style formats + :bold-format "**%s**" + :italic-format "//%s//" + :underline-format "__%s__" + :strikethrough-format "--%s--" + :code-format "``%s``" + :verbatim-format "``%s``" + + ; Block formats + :body-line-export-preformated t + :body-line-fixed-format "``` %s\n" + ; /!\ #+BEGIN_QUOTE does not seem to work (neither do #+BEGIN_VERSE) +; :blockquote-start "!BLOCKQUOTE-START!" +; :blockquote-end "!BLOCKQUOTE-END!" + + ; Tables + :body-table-start "" + :body-table-end "" + :body-table-row-start "|" + :body-table-row-end "|" + :body-table-cell-start "" + :body-table-cell-end "" + :body-table-first-cell-start "" + :body-table-interior-cell-start "| " + :body-table-interior-cell-end " " + :body-table-last-cell-end "" + ; /!\ Horizontal lines are not handled by txt2tags, but there is + ; apparently no way to avoid them + :body-table-hline-start "" + :body-table-hline-end "" + + ; Other stuff handled by txt2tags and org-mode but not yet by + ; org-export-generic: + ; - definition/description lists + ; - comments (# lines and #+BEGIN_COMMENT blocks) + ; - verbatim/literal blocks (#+BEGIN_EXAMPLE and #+BEGIN_SRC) + ; - horizontal rule (currently detected as a list item) + ; - links + ; - images + ; - included files (#+INCLUDE) (what would be nice is an option to + ; allow choosing between inclusion of sub-files as #+INCLUDEs or + ; directly in the text) + ; - macros + ) + ;; ;; internet-draft .xml for xml2rfc exporter ;; ("ietfid" --Boundary-01=_FQpoQHpzoHg1bZk-- --nextPart1428163.WQRs1by5cq Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iQIcBAABCAAGBQJQopQFAAoJEE6QGOCjKRJrZb4P+weKo/NCdZqT9IJDO6FWUfQr wbj2ESPxa9pd961S9POmy2tlEBCf+9yG9R4VjA9xtZ4WWBm729g4/78W6Zu/ndZL NG4Nez10gul0UwACpXp+AC1ce21/VcWzSGzbor3u7qXkXyA7y6fGVpjcW9sq+5dp 6eAGXtjOCjAYcfuU/cqfMiiLnjgfej2p9GFG29Y4pso/YSdgNI/b2lfwoSM9Pjwh OhDz7N81iX5miHGswDZ7/28XsvadAYf8w1Zd/Geb1RJoQR+/nbQeE7QKCBypW3HD 36YLKaxc6nlxWIgu28MpPSH1Szf8V/dDSBqSHWYTv2s+1sMxG7CuUYXcEiObbH1i 4z+rxnFzj/77AmK9WMKm4NxFpdPwPCmUwZ/dF7uH/cM8TmF1iZSLvF7O1+Avr+yZ dj0p4JyxdOyBMAc58SnmAX1G3+1IxrcwX9CuRHaYTt3s5gmpb8WSDsxfH39gkigq yoFS6ZhOPYJ3LeCbbk0RpElSlQNv1MeYdHr+KEacra9udshfvw7MfVL2/XM488PW j6AG8pN4WeI/raq0gWptIb6MGs5No9rvW9J8kSVupBFTLcYmAPKLZV55M/7y2qkY GVJGuo7G9F5oRuwVDJZggf6cU5VdiGtWaauPWupeDub9UQ2VwM0qhuZo++o/zVVf ZHejGv4Fb1XnXdrF+zMQ =G38H -----END PGP SIGNATURE----- --nextPart1428163.WQRs1by5cq--