emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Kaushal Modi <kaushal.modi@gmail.com>
To: emacs-org list <emacs-orgmode@gnu.org>
Subject: Re: how to convert a non-org list to org headings
Date: Wed, 6 Jul 2022 11:31:54 -0400	[thread overview]
Message-ID: <CAFyQvY19PsjUjD2F7shsHoKG8+s5yOrn5o+bErsiYbuZ5E3y3A@mail.gmail.com> (raw)
In-Reply-To: <87h73up918.fsf@mat.ucm.es>

[-- Attachment #1: Type: text/plain, Size: 1700 bytes --]

On Wed, Jul 6, 2022 at 11:17 AM Uwe Brauer <oub@mat.ucm.es> wrote:

> Hi
>
> I have a file that contains a list as:
>
>
> 1.1 Funciones de una variable
>
> 1.1.1. Catálogo de funciones. Translaciones y dilataciones
>
> 1.1.2. Derivación
>
> 1.1.2.1. Optimización. Tasa de cambio
>
> 1.1.2.2. Aproximación de funciones
>
> 1.1.2.3.1. Interpolación vs. ajuste
>
> 1.1.2.3.2. Polinomio de Taylor
>
> 1.1.2.3. Ceros de funciones (método de Newton-Raphson)
>
> 1.1.3. Integración
>
> 1.1.3.1. Integral definida. Aplicaciones
>
> 1.1.3.2. Integral impropia
>
> 1.1.3.2.1. De 1.ª especie
>
> 1.1.3.2.2. De 2ª especie
>
>
>
> Etc, that is a non org list but I would like to convert
> it to the corresponding headings
>
> ** Funciones de una variable
>
> *** Catálogo de funciones. Translaciones y dilataciones
>
> Etc, any idea how to do this in a quick way?
>

The method that I show below is quick but not robust. You'll need to review
all the replacements.

- Do query-replace-regexp [default binding: C-M-%]
- Search for [0-9]+\.
- Replace with *

Running that on your example gives:

=====
*1 Funciones de una variable

*** Catálogo de funciones. Translaciones y dilataciones

*** Derivación

**** Optimización. Tasa de cambio

**** Aproximación de funciones

***** Interpolación vs. ajuste

***** Polinomio de Taylor

**** Ceros de funciones (método de Newton-Raphson)

*** Integración

**** Integral definida. Aplicaciones

**** Integral impropia

***** De *ª especie

***** De 2ª especie
=====

You'll need to manually fix up the " *1 Funciones de una variable" and "
***** De *ª especie" lines.

[-- Attachment #2: Type: text/html, Size: 2334 bytes --]

  reply	other threads:[~2022-07-06 15:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-06 15:15 how to convert a non-org list to org headings Uwe Brauer
2022-07-06 15:31 ` Kaushal Modi [this message]
2022-07-06 16:12   ` Marcin Borkowski
2022-07-06 19:55     ` Uwe Brauer
2022-07-06 19:53   ` Uwe Brauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAFyQvY19PsjUjD2F7shsHoKG8+s5yOrn5o+bErsiYbuZ5E3y3A@mail.gmail.com \
    --to=kaushal.modi@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).