From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/30542 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Bastien DUMONT Newsgroups: gmane.text.pandoc Subject: Re: Use --number-sections with markdown output Date: Tue, 10 May 2022 14:23:39 +0000 Message-ID: References: <98ffebc1-b38b-43f5-8234-e222258abb95n@googlegroups.com> <87zgjpzp6j.fsf@zeitkraut.de> <62577c1f-efe5-45b5-ab27-1d8705643afen@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11829"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBDCINCES2QJRBDXL5GJQMGQEL2S5PCI-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Tue May 10 16:24:18 2022 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-ej1-f56.google.com ([209.85.218.56]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1noQmg-0002nc-AW for gtp-pandoc-discuss@m.gmane-mx.org; Tue, 10 May 2022 16:24:18 +0200 Original-Received: by mail-ej1-f56.google.com with SMTP id qf19-20020a1709077f1300b006f439243355sf8505837ejc.3 for ; Tue, 10 May 2022 07:24:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1652192658; cv=pass; d=google.com; s=arc-20160816; b=degAzELVeJCDBOh0rmtqirF8ikF4oYKZxfaigP7xBjMvn0sHTEo2NcXQ0hsWK9DXRN pwyd1QbBT550rUTXe2+o5McIKBG3xx5eL4jCjpWZTGKlDZ860wMFcLFAvnLgxJPE6LbH exafyxySHQn+ECkaCXe9vVQvbDjAWeQS6BYdED/zvPBTxSw3O4R0zVPGbofm+fvGiZIx SyzqkBdxdbNUSsytE03kOYJtJS89nzVNOm5nYO8iD/5D9vSYXLmBxIJ+GU2zgsE5WAf4 edcf9ZT2Xsz7TTZW6vqUFmMlaX5P1K0msdNX118w2q6dnC8rX3TX0wjIuZBZLMvFilgb KjRA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:to:from:date:sender:dkim-signature; bh=92ZWWAZnxZ2jQSUKOFf/1VinRZ6xqV2W9YwwT4iJkSQ=; b=H6FQJS5n8KBvBzBFCNeJuSxldQ9w3kQbCFXZoYsl6rh2y39G13LaJZIhnmFyIrj3Xe lXS7605+pNltzKHRZad3Dokm28y1XouH6Iw4yr5miYMq8yv7CniC42TOBaXnwQQXn15q CT+Lg20Vf/mxbSkz4DdrXOwOdSQ2KKebzK1QNL4AUQhONvwkdWlq/Obffm6UN/DeIosu x0zqc3eSsKkzbRy43Hh/YgOobABmKdE/tSlgREa5iZS1ZWWQwh5LIrxdnFrg73Ya9Dik Prt41PSdfptldp/STrjAoKzk+NavkrNhal6+ZfUi1IiQgV4kkSuPO6zHVKqT4hx8Xgl2 /d2A== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@posteo.net header.s=2017 header.b=iujQSJzp; spf=pass (google.com: domain of bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org designates 185.67.36.65 as permitted sender) smtp.mailfrom=bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=posteo.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; h=sender:date:from:to:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :x-original-sender:x-original-authentication-results:reply-to :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=92ZWWAZnxZ2jQSUKOFf/1VinRZ6xqV2W9YwwT4iJkSQ=; b=jqIkCsAB8v6I5HrbcbupbWb7nl3hQ2m6czc43Ye4nCWoJHTeX5otIskEh0ZORX3n4B R5sG53kA4Rbuz/IQiXobxRvLWXnQpdpNU0QqMlJClEAIr9Qvgl5WN1X/IPGqJKZtHPSU aC+YFwwFiRs9YDo2vaVJ5TYFWc58WGm4IkPm+BfCbfG/d7hq58r0WGe9d/CIQkrGsOJB u0Btv+WHc9xVA6RNPK5QfavITy4UFXsjMXXmrqc+6fw0KWT4OmHY2kLp+g3sHowaGB9X 3SnanIj2z8Vgf/bHR2zyoOpIX3Vido8/LthA2F6QpqRX03jMO39LT8ewj2clw+QqoJGe Jiag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=sender:x-gm-message-state:date:from:to:subject:message-id :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=92ZWWAZnxZ2jQSUKOFf/1VinRZ6xqV2W9YwwT4iJkSQ=; b=P1u+Xv7QxdVz/0zedk9dR9M3M1VnhSiaKZeysCrH7b3vMz3s2SuTJymnx36hBHcQb4 uv9ccIr0+biEn+9L8YrSTCRoOOsWCVYVEjSVzy1ml9ggTAXj5c/8UHzJ/Oo1LRN8ujYZ PZWyQvYZe6ygYZVgqHJGjdJ7whDPIAJmJ5+XFtikUMLVnHGZvcfEyGUyL5kKWat0Iqr0 6Wj4xnz2KOdJiA3CPlnBnVhztbVUfcKR66uBzoBpNTfCPlXITUcatC9PXxPF5lHfdmYP s/fHzuWgasY5LBrguXLay9m+IY/eWw9Y38Ea/GXCAo0i Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOAM531xN8Y9fD6bf1071pMsCIw4M9QhsItOp34D4A//ge56Mt4/kGLh Cmdo1KKNHsJORyE+wv2GzKo= X-Google-Smtp-Source: ABdhPJx+tPvTEU7bnGt3w3M99IzynZKiacdGPy5KrcclQOdhSmtDNOB+TpdXY7cVrVR4CRhugoCbBw== X-Received: by 2002:a05:6402:268f:b0:427:d90e:86a1 with SMTP id w15-20020a056402268f00b00427d90e86a1mr23576599edd.143.1652192657989; Tue, 10 May 2022 07:24:17 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a17:907:7253:b0:6f4:60e6:9f97 with SMTP id ds19-20020a170907725300b006f460e69f97ls1079000ejc.8.gmail; Tue, 10 May 2022 07:24:13 -0700 (PDT) X-Received: by 2002:a17:906:a091:b0:6f4:f5cd:27b0 with SMTP id q17-20020a170906a09100b006f4f5cd27b0mr19592088ejy.531.1652192653825; Tue, 10 May 2022 07:24:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652192653; cv=none; d=google.com; s=arc-20160816; b=xibfPUg1c4qDXj2c413Ju9rGnKtx14I035FUTK+bYqX09cgczdVU9dd6po3Wj+w/so PAi115CzWPhpqt5pphy7K4zprO2n6Q0u7AX+eaj0Cx58CjsFQLL+pYEu4rmJmiBnpwlp Op/4KemyjQ4pUG7RYWAAKQjTfxyi8jFNHnUVXNenPltTtc2REiaNlB2gbddO40x/OIl5 nEp8OWgg/9J6Jn/40ZVE59n6d2SD9JR3n+vYzPgqiFrivIvEsGt+NYFLZWBKR77Cr1Hp VFxZO/3V9SkLNwIxGXzyipEiohaiQgjiI6HvAZA1hWFm2pE4Fcpc05zSdHNs1MFn+9dZ ejKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:to:from:date :dkim-signature; bh=nQdQGHsW2GkaUoNzkw+96UCMnfXcNGcma3uATh1hRIw=; b=MjMP8OQcuLkq8dDUyEtSEL5dgKG7olPqtzxo4mf4Y9rliM6csXicEbGlkWbOuhV6SS 6PV1cxjeQB7qD7ZQmzqKcX0ivbw1umRjCYneZEdqZHQCMw6zS9RxauHYDdyO2cKJcUut +BWJn85D8449itU/iJ6xv53EJIho4tTvWZbuF7xOGc05LYnwQXB6JpgsfJOQCePzMyPs M7jlKrVyqzQbC2TvmJxZm2d/yxhT82hpVHJDKmdBqXOltQRKBvk5HbVvWFdZc6lS5fSd XVzI1pAyy+9cKCZ9vQ8O/a5pKVkYMeR1ziNAZf1D3zEn0FjDpqHE7SYI46PrzYs8Zvx3 ILUw== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@posteo.net header.s=2017 header.b=iujQSJzp; spf=pass (google.com: domain of bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org designates 185.67.36.65 as permitted sender) smtp.mailfrom=bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=posteo.net Original-Received: from mout01.posteo.de (mout01.posteo.de. [185.67.36.65]) by gmr-mx.google.com with ESMTPS id gv43-20020a1709072beb00b006e8421b806dsi1001188ejc.1.2022.05.10.07.24.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 May 2022 07:24:13 -0700 (PDT) Received-SPF: pass (google.com: domain of bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org designates 185.67.36.65 as permitted sender) client-ip=185.67.36.65; Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 5C321240027 for ; Tue, 10 May 2022 16:24:13 +0200 (CEST) Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4KyKzc5hPyz9rxQ for ; Tue, 10 May 2022 16:24:12 +0200 (CEST) Content-Disposition: inline In-Reply-To: <62577c1f-efe5-45b5-ab27-1d8705643afen-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> X-Original-Sender: bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@posteo.net header.s=2017 header.b=iujQSJzp; spf=pass (google.com: domain of bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org designates 185.67.36.65 as permitted sender) smtp.mailfrom=bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=posteo.net Precedence: list Mailing-list: list pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org; contact pandoc-discuss+owners-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org List-ID: X-Google-Group-Id: 1007024079513 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Xref: news.gmane.io gmane.text.pandoc:30542 Archived-At: It is the metamethod pandoc.List:__concat. Indeed, it would be good to add = examples to the metamethods, since not all Lua users know about metatables,= especially those who only learn the basics of the language to write filter= s! Le Tuesday 10 May 2022 =C3=A0 06:59:55AM, Julien Dutant a =C3=A9crit : > Side note: !!! I didn't know pandoc Lists could be concatenated with `..`= , > that's great! Is this a recent addition to the Lua filter module? Would b= e > great to document it (https://pandoc.org/lua-filters.html# > pandoc.list:__concat). Happy to submit a PR, but not sure whether small P= Rs on > Pandoc's documentations are welcome.=20 >=20 > J >=20 > On Tuesday, May 10, 2022 at 10:56:28 AM UTC+1 Albert Krewinkel wrote: >=20 >=20 > relayism writes: >=20 > > I know --number-sections does not support markdown output, but how > > could I achieve this: > > > > I am converting a .docx to .md and the headings in word are configu= red > > to be numbered, when I convert to .md those numbers are lost. > > > > I'd like to have something like this > > > > # 1 title > > ## 1.1 subtitle > > > > ## 1.2 subtitle > > > > # 2 title > > > > ### 2.1.1 subsbutitle > > > > as output, where the numbers are not explicitly part of the docx ra= w > > text input, but could be appended in same way as --number-sections = adds > > it to other formats >=20 > Here's a Lua filter that should do what you need. See > [1]https://pandoc.org/lua-filters.html for details. >=20 > ``` lua >=20 > function Pandoc (doc) > doc.blocks =3D pandoc.utils.make_sections(true, nil, doc.blocks):walk= { > Div =3D function (div) > if div.attributes.number then > -- first child should be a heading > local header =3D div.content[1] > header.content =3D {div.attributes.number, pandoc.Space()} > .. header.content > header.attributes.number =3D nil > return div.content > end > end > } > return doc > end >=20 > ``` >=20 > -- > Albert Krewinkel > GPG: 8eed e3e2 e8c5 6f18 81fe e836 388d c0b2 1f63 1124 >=20 > -- > You received this message because you are subscribed to the Google Groups > "pandoc-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an= email > to [2]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit [3]https://groups.google.com/d/m= sgid/ > pandoc-discuss/62577c1f-efe5-45b5-ab27-1d8705643afen%40googlegroups.com. >=20 > References: >=20 > [1] https://pandoc.org/lua-filters.html > [2] mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > [3] https://groups.google.com/d/msgid/pandoc-discuss/62577c1f-efe5-45b5-a= b27-1d8705643afen%40googlegroups.com?utm_medium=3Demail&utm_source=3Dfooter --=20 You received this message because you are subscribed to the Google Groups "= pandoc-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an e= mail to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/= pandoc-discuss/Ynp1a3s2QDrNq0yq%40localhost.