From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christian Wittern Subject: Re: Tweaking the export Date: Sat, 04 Feb 2012 15:21:27 +0900 Message-ID: <4F2CCE67.2020304@gmail.com> References: <87pqec4xua.fsf@gmail.com> <87obtvk6j0.fsf@gmail.com> <87obtrel2z.fsf@gmail.com> <4F20F779.2060803@gmail.com> <877h0ds39y.fsf@gmail.com> <8162fxjm02.fsf@gmail.com> <4F235BC2.2080903@gmail.com> <87wr8akhc5.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([140.186.70.92]:35094) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RtZ0F-0006Qe-V7 for emacs-orgmode@gnu.org; Sat, 04 Feb 2012 01:21:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RtZ0E-0005Fw-Sd for emacs-orgmode@gnu.org; Sat, 04 Feb 2012 01:21:39 -0500 Received: from mail-pw0-f41.google.com ([209.85.160.41]:35597) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RtZ0E-0005Fr-MO for emacs-orgmode@gnu.org; Sat, 04 Feb 2012 01:21:38 -0500 Received: by pbaa12 with SMTP id a12so3908237pba.0 for ; Fri, 03 Feb 2012 22:21:37 -0800 (PST) In-Reply-To: <87wr8akhc5.fsf@gmail.com> 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: Nicolas Goaziou Cc: emacs-orgmode@gnu.org Hi Nicolas, Thank you very much for taking the time for such a detailed recipe. Today I finally found time to go over it and try to implement my transformer. It turned out to be really easy to get going, but in the end, I hit a roadblock. On 2012-01-29 18:07, Nicolas Goaziou wrote: > > 3. If all went well, you now have an impressive Org to Org converter. > You can even test it with: > > #+begin_src emacs-lisp > (switch-to-buffer (org-export-to-buffer 'translator "*Translation*")) > #+end_src > > Obviously, there is not much to see. It worked wonderful until here. > > Now, we're going to redefine `org-translator-paragraph' to properly > ignore one language or the other, depending on `:translator-side' value. > > #+begin_src emacs-lisp > (defun org-translator-paragraph (paragraph contents info) > "Convert PARAGRAPH to Org, ignoring one language. > Language kept is determined by `:translator-side' value." > (let ((leftp (eq (plist-get info :translator-side) 'left))) > (replace-regexp-in-string > (if leftp "\t+.*$" "^.*\t+") "" contents))) > #+end_src With a little tweaking, I got rid of errors when running this code. However, no changes in the output where observable. Finally, I looked at the output from step 3 above and realized that the parser normalizes my characters away. Only a bunch of spaces in the output! Ouch!! So I guess I would need an option on the parser to switch tab expansion off. I also intended to implement my transformer in a way that I first define the general org-e-org transformer and then derive a specialized transcormer by somehow inheriting the general transformer and then implement my specialized paragraph transformation. It seems that this is at the moment not possible, but I think it would be good to think about this, that will make defining new exporters or even org-file tweakers a breeze. Anyhow, again thanks for writing the new parser / exporter and for your help with my problem! All the best, Christian -- Christian Wittern, Kyoto