From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Hugo Schmitt" Subject: Re: Re: How to convert org file to such a plain text Date: Tue, 5 Aug 2008 08:28:57 -0300 Message-ID: <2f1c7d020808050428n16516ba4wac2eea140f7e5c38@mail.gmail.com> References: <87od4m4yvn.fsf@gentoo.hasee.cpu> <67E01FA0-85A3-40C6-932F-BEA625557DFF@uva.nl> <8663qtu7g3.fsf@freebsd.hasee.cpu> <2f1c7d020807260843h1563dcc4h918338aefce0f542@mail.gmail.com> <87ej5gtwnx.fsf@gentoo.hasee.cpu> <5CAE3D36-6412-4A93-B58E-A5AEB4C78D2C@uva.nl> <86k5f4ufio.fsf@freebsd.hasee.cpu> <86k5ewvfw6.fsf@freebsd.hasee.cpu> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0035110677==" Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KQKit-0007Ud-Bp for emacs-orgmode@gnu.org; Tue, 05 Aug 2008 07:29:03 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KQKir-0007RM-Fn for emacs-orgmode@gnu.org; Tue, 05 Aug 2008 07:29:02 -0400 Received: from [199.232.76.173] (port=54417 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KQKiq-0007RB-Ct for emacs-orgmode@gnu.org; Tue, 05 Aug 2008 07:29:01 -0400 Received: from rv-out-0708.google.com ([209.85.198.247]:27776) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KQKip-0002Ls-J4 for emacs-orgmode@gnu.org; Tue, 05 Aug 2008 07:29:00 -0400 Received: by rv-out-0708.google.com with SMTP id k29so2524396rvb.6 for ; Tue, 05 Aug 2008 04:28:57 -0700 (PDT) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Eddward DeVilla Cc: emacs-orgmode@gnu.org, anhnmncb --===============0035110677== Content-Type: multipart/alternative; boundary="----=_Part_33591_33528844.1217935737113" ------=_Part_33591_33528844.1217935737113 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline anhnmncb, this helps you? (defun org-to-anhnmncb () (interactive) (goto-char (point-min)) (let ((curlevel 0)) (while (< (point) (point-max)) (goto-char (point-at-bol)) (cond ((looking-at "\\(\\*+\\)\\s-*") (setq curlevel (1- (length (match-string 1)))) (replace-match (make-string curlevel ?\t))) ((looking-at "\\s-*") (replace-match (concat (make-string curlevel ?\t) "- ")))) (forward-line 1)))) my test was this: * level1 item ** level2 item item *** level3 item item ** level2 again item item which gets converted into: level1 - item level2 - item - item level3 - item - item level2 again - item - item hope this helps, hugo On Mon, Aug 4, 2008 at 10:43 PM, Eddward DeVilla wrote: > I don't know if you use perl at all. My first guess is: > > perl -pe's/^(\*+)(\s+.*)$/("\t"x length$1).$2/e' < TODO.org > TODO.txt > > Having tried it on a live file, I don't think the results are very > pleasing Replacing a single character '*' with a tab creates a > formatting mess with any other text in the file. > > Edd > > On Mon, Aug 4, 2008 at 12:39 PM, anhnmncb wrote: > > anhnmncb writes: > > > >> Carsten Dominik writes: > >> > >>> On Jul 26, 2008, at 9:52 AM, anhnmncb wrote: > >>> > >>>> "Hugo Schmitt" writes: > >>>> > >>>>> What are the odds that Carsten has plans to export to a format > >>>>> *you* just invented? > >>>> Oh, my pda app projekt can import this format of file, but if all of > >>>> you > >>>> think it's no use, nervermind. > >>> > >>> Hey, why the huff? > >>> > >>> The point is, you have not given us any chance at all to > >>> think it might be of any use! > >>> > >>> - Carsten > >>> > >> Sorry for delay, I can't reach the app website[1] right now, when it > >> can, I will provide the relavent information. > >> > >> [1] http://www.kylom.com/ > > > > Sorry, I can't find more useful info, the app just says it can import > > the txt file which has different level of indents. So I think replace > > star(*) with is enough. Such like this: > > > > Org file --> txt file > > -------------------- -------------------- > > |* level 1 |level 1 > > |** level 2 --> |level 2 > > |- item |- item > > |*** level 3 |level 3 > > -------------------- -------------------- > > > > I'm not a programmer, so if my request is stupid and easy to achieve by > > any other way, please let me know. > > > >> > >>>> > >>>>> > >>>>> On Fri, Jul 25, 2008 at 3:47 PM, anhnmncb > wrote: > >>>>> > >>>>> Carsten Dominik writes: > >>>>> > >>>>>> We do not have an exporter that can do this right now. > >>>>>> > >>>>>> - Carsten > >>>>> Will it come in furture? > >>>>>> > >>>>>> On Jul 24, 2008, at 4:59 PM, anhnmncb wrote: > >>>>>> > >>>>>> I want to export org to plan text, which pattern is: > >>>>>> -------------------- > >>>>>> |level 1 > >>>>>> |level 2 > >>>>>> |- item > >>>>>> |level 3 > >>>>>> -------------------- > >>>>>> instead of > >>>>>> -------------------- > >>>>>> |* level 1 > >>>>>> |** level 2 > >>>>>> |- item > >>>>>> |*** level 3 > >>>>>> -------------------- > >>>>>> -- > >>>>>> Regards, > >>>>>> > >>>>>> anhnmncb > >>>>>> gpg key: 44A31344 > >>>>>> > >>>>>> _______________________________________________ > >>>>>> Emacs-orgmode mailing list > >>>>>> Remember: use `Reply All' to send replies to the list. > >>>>>> Emacs-orgmode@gnu.org > >>>>>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode > >>>>>> > >>>>>> _______________________________________________ > >>>>>> Emacs-orgmode mailing list > >>>>>> Remember: use `Reply All' to send replies to the list. > >>>>>> Emacs-orgmode@gnu.org > >>>>>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode > >>>>> > >>>>> -- > >>>>> Regards, > >>>>> > >>>>> anhnmncb > >>>>> gpg key: 44A31344 > >>>>> > >>>>> _______________________________________________ > >>>>> Emacs-orgmode mailing list > >>>>> Remember: use `Reply All' to send replies to the list. > >>>>> Emacs-orgmode@gnu.org > >>>>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode > >>>>> > >>>>> _______________________________________________ > >>>>> Emacs-orgmode mailing list > >>>>> Remember: use `Reply All' to send replies to the list. > >>>>> Emacs-orgmode@gnu.org > >>>>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode > >>>> > >>>> -- > >>>> Regards, > >>>> > >>>> anhnmncb > >>>> gpg key: 44A31344 > >>>> > >>>> > >>>> > >>>> _______________________________________________ > >>>> Emacs-orgmode mailing list > >>>> Remember: use `Reply All' to send replies to the list. > >>>> Emacs-orgmode@gnu.org > >>>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode > >>> > >>> > >>> > >>> _______________________________________________ > >>> Emacs-orgmode mailing list > >>> Remember: use `Reply All' to send replies to the list. > >>> Emacs-orgmode@gnu.org > >>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode > >>> > > > > -- > > Regards, > > > > anhnmncb > > gpg key: 44A31344 > > > > > > > > _______________________________________________ > > Emacs-orgmode mailing list > > Remember: use `Reply All' to send replies to the list. > > Emacs-orgmode@gnu.org > > http://lists.gnu.org/mailman/listinfo/emacs-orgmode > > > > > _______________________________________________ > Emacs-orgmode mailing list > Remember: use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode > ------=_Part_33591_33528844.1217935737113 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline
anhnmncb, this helps you?

(defun org-to-anhnmncb ()
  (interactive)
  (goto-char (point-min))
  (let ((curlevel 0))
    (while (< (point) (point-max))
      (goto-char (point-at-bol))
      (cond
       ((looking-at "\\(\\*+\\)\\s-*")
        (setq curlevel (1- (length (match-string 1))))
        (replace-match (make-string curlevel ?\t)))
       ((looking-at "\\s-*")
        (replace-match (concat (make-string curlevel ?\t) "- "))))
      (forward-line 1))))

my test was this:

* level1
  item
** level2
   item
   item
*** level3
    item
    item
** level2 again
   item
   item

which gets converted into:

level1
- item
    level2
    - item
    - item
        level3
        - item
        - item
    level2 again
    - item
    - item


hope this helps,
hugo



On Mon, Aug 4, 2008 at 10:43 PM, Eddward DeVilla <eddward@gmail.com> wrote:
I don't know if you use perl at all.  My first guess is:

   perl -pe's/^(\*+)(\s+.*)$/("\t"x length$1).$2/e' < TODO.org > TODO.txt

Having tried it on a live file, I don't think the results are very
pleasing  Replacing a single character '*' with a tab creates a
formatting mess with any other text in the file.

Edd

On Mon, Aug 4, 2008 at 12:39 PM, anhnmncb <anhnmncb@gmail.com> wrote:
> anhnmncb <anhnmncb@gmail.com> writes:
>
>> Carsten Dominik <dominik@science.uva.nl> writes:
>>
>>> On Jul 26, 2008, at 9:52 AM, anhnmncb wrote:
>>>
>>>> "Hugo Schmitt" <hugows@gmail.com> writes:
>>>>
>>>>> What are the odds that Carsten has plans to export to a format
>>>>> *you* just invented?
>>>> Oh, my pda app projekt can import this format of file, but if all of
>>>> you
>>>> think it's no use, nervermind.
>>>
>>> Hey, why the huff?
>>>
>>> The point is, you have not given us any chance at all to
>>> think it might be of any use!
>>>
>>> - Carsten
>>>
>> Sorry for delay, I can't reach the app website[1] right now, when it
>> can, I will provide the relavent information.
>>
>> [1] http://www.kylom.com/
>
> Sorry, I can't find more useful info, the app just says it can import
> the txt file which has different level of indents. So I think replace
> star(*) with <tab> is enough. Such like this:
>
> Org file              -->  txt file
> --------------------       --------------------
> |* level 1                 |level 1
> |** level 2           -->  |<tab>level 2
> |<tab>- item               |<tab>- item
> |*** level 3               |<tab><tab>level 3
> --------------------       --------------------
>
> I'm not a programmer, so if my request is stupid and easy to achieve by
> any other way, please let me know.
>
>>
>>>>
>>>>>
>>>>> On Fri, Jul 25, 2008 at 3:47 PM, anhnmncb <anhnmncb@gmail.com> wrote:
>>>>>
>>>>>   Carsten Dominik <dominik@uva.nl> writes:
>>>>>
>>>>>> We do not have an exporter that can do this right now.
>>>>>>
>>>>>> - Carsten
>>>>>   Will it come in furture?
>>>>>>
>>>>>> On Jul 24, 2008, at 4:59 PM, anhnmncb wrote:
>>>>>>
>>>>>>   I want to export org to plan text, which pattern is:
>>>>>>   --------------------
>>>>>>   |level 1
>>>>>>   |<tab>level 2
>>>>>>   |<tab>- item
>>>>>>   |<tab><tab>level 3
>>>>>>   --------------------
>>>>>>   instead of
>>>>>>   --------------------
>>>>>>   |* level 1
>>>>>>   |** level 2
>>>>>>   |<tab>- item
>>>>>>   |*** level 3
>>>>>>   --------------------
>>>>>>   --
>>>>>>   Regards,
>>>>>>
>>>>>>    anhnmncb
>>>>>>   gpg key: 44A31344
>>>>>>
>>>>>>   _______________________________________________
>>>>>>   Emacs-orgmode mailing list
>>>>>>   Remember: use `Reply All' to send replies to the list.
>>>>>>   Emacs-orgmode@gnu.org
>>>>>>   http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>>>>>>
>>>>>> _______________________________________________
>>>>>> Emacs-orgmode mailing list
>>>>>> Remember: use `Reply All' to send replies to the list.
>>>>>> Emacs-orgmode@gnu.org
>>>>>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>>>>>
>>>>>   --
>>>>>   Regards,
>>>>>
>>>>>    anhnmncb
>>>>>    gpg key: 44A31344
>>>>>
>>>>>   _______________________________________________
>>>>>   Emacs-orgmode mailing list
>>>>>   Remember: use `Reply All' to send replies to the list.
>>>>>   Emacs-orgmode@gnu.org
>>>>>   http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>>>>>
>>>>> _______________________________________________
>>>>> Emacs-orgmode mailing list
>>>>> Remember: use `Reply All' to send replies to the list.
>>>>> Emacs-orgmode@gnu.org
>>>>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>>>>
>>>> --
>>>> Regards,
>>>>
>>>> anhnmncb
>>>> gpg key: 44A31344
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Emacs-orgmode mailing list
>>>> Remember: use `Reply All' to send replies to the list.
>>>> Emacs-orgmode@gnu.org
>>>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>>>
>>>
>>>
>>> _______________________________________________
>>> Emacs-orgmode mailing list
>>> Remember: use `Reply All' to send replies to the list.
>>> Emacs-orgmode@gnu.org
>>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>>>
>
> --
> Regards,
>
>  anhnmncb
>  gpg key: 44A31344
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>


_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

------=_Part_33591_33528844.1217935737113-- --===============0035110677== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-orgmode mailing list Remember: use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode --===============0035110677==--