From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/24506 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Dmitriy Krasilnikov Newsgroups: gmane.text.pandoc Subject: Re: Top level header lost Date: Tue, 25 Feb 2020 08:04:37 -0800 (PST) Message-ID: <120c0525-969a-495b-a031-a0bb8fdd26ba@googlegroups.com> References: Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_1544_1186329712.1582646677469" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="69067"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBCW6BWX4WAKBBFUL2XZAKGQECA2U6XY-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Tue Feb 25 17:04:42 2020 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-ot1-f58.google.com ([209.85.210.58]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1j6chN-000HsY-SG for gtp-pandoc-discuss@m.gmane-mx.org; Tue, 25 Feb 2020 17:04:41 +0100 Original-Received: by mail-ot1-f58.google.com with SMTP id t17sf8107920otk.22 for ; Tue, 25 Feb 2020 08:04:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:date:from:to:message-id:in-reply-to:references:subject :mime-version:x-original-sender:reply-to:precedence:mailing-list :list-id:list-post:list-help:list-archive:list-subscribe :list-unsubscribe; bh=t9E9G70qwSGtmpFRwlxr2PApWveBR7/mekNICfiga3I=; b=bg2BMaD3KhmYoPP9iJpJiXC5bYKhATMJ71V4kSUNy/kSVl94ux8DF6Ua1iE+BT6ujp DHhrnu4CA+3wg5vp5J8kHK0VDJLNa+KQjKv2izGJF+D+YYod3QwPBO00IMnj2Q2vgK+a 1HwsgB/EVT6fvEqI02wlOeDAKWi+mUY7+Om8JLNZUgKgc/hC/TzmpD4JbLs3iJ9/96Ba lSZg08AghVIDGzd2q+5Bv89XaH7I3zgVH0OIRkX0lC+Fby+vXLivf4kAF33XkEVGOvav 1QWyqPdfWomWVM+pcnB7muAZtaopszba7wjCm5jLFtwwmn34l+UGxC9MuhhgC7/uRTFy dgpQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:message-id:in-reply-to:references:subject:mime-version :x-original-sender:reply-to:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-subscribe:list-unsubscribe; bh=t9E9G70qwSGtmpFRwlxr2PApWveBR7/mekNICfiga3I=; b=K5FlaCpNRwEl0YcvJmKJExV0DaS7uS3Af/ANQAmL+dmkM6cba4vGZzyky7Kzy/zp99 PFkb0t/5NB98zpySAtgW9APUmryNbE1Z+n1bGkc1oqfTqjG2HgGMJpS1yT5k5EQtkE0i WqpfnBFpNogYZpOCcf481YhAPtlhZzeAW+ZrCxlUp8zFEB01nZ0RVmRzIkfPf2aPfeW+ pFflDSpOqiStpR7LQBFADxr/ukVuTkWcVEiwChSdhvLZjrNow0sgFN3g276DNYz8SfVT yH3CYOyjXwuCPDHZa5utr2DBnDsOMOTsCBwDJHNyWH3qaT/KKNDuW0N4HMGCS8QYx7zw EmZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:date:from:to:message-id:in-reply-to :references:subject:mime-version:x-original-sender:reply-to :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post :list-help:list-archive:list-subscribe:list-unsubscribe; bh=t9E9G70qwSGtmpFRwlxr2PApWveBR7/mekNICfiga3I=; b=hPnr6dYi9gykEKdaLOlCJ+ZFI0DgFFRwN24kTyde5u4/kOcKwTnxPQH1Mqq6tipygM PYMPxmCJj9vYqAaJcKQdbFdENCGDXMc4kWw/J9s+E1i1qQfiOB4rompxqe6fEaqDQomE RaAZ9t7M5RupPNQSAGZzM+1wt+RJcoTET1hnil3+IJAFm0z4TIX0YjZvn3KjP3EPadoD FW9GJrf6tLfz89o6kA6vSSz2Dm2M79pXqfcHzzvEUrzXD10NUe3YLCmXSu6CIKWoTgpG k262o9jMWV6CyjcYRddFnP0FbxmnmMk4qAI/8cw8thxaDpi6/cgZwvn5u4uTV9ZIj8D3 yXkA== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: APjAAAVCHCucg84JpblQDFNlhFIC6fj+ignLFOKYC/S4vwGeff0d8L6P RaqP++Ors6VP8g30hE4bE3k= X-Google-Smtp-Source: APXvYqy0hh6Ywmr0XjVb4IlouUtXkg6qPGwwdaRu1vCouCdPnTnIFKU0nprvcvGJ0/DZ33TbLwHJHg== X-Received: by 2002:a9d:7590:: with SMTP id s16mr42651019otk.89.1582646680796; Tue, 25 Feb 2020 08:04:40 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a9d:4a96:: with SMTP id i22ls4142408otf.9.gmail; Tue, 25 Feb 2020 08:04:38 -0800 (PST) X-Received: by 2002:a9d:1ca3:: with SMTP id l35mr44182318ota.271.1582646678109; Tue, 25 Feb 2020 08:04:38 -0800 (PST) In-Reply-To: X-Original-Sender: dmitriy.krasilnikov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org 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:24506 Archived-At: ------=_Part_1544_1186329712.1582646677469 Content-Type: multipart/alternative; boundary="----=_Part_1545_1239382483.1582646677469" ------=_Part_1545_1239382483.1582646677469 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Thanks for clarification. How can this top-level document title be accessed with Lua script? =D0=BF=D1=8F=D1=82=D0=BD=D0=B8=D1=86=D0=B0, 21 =D1=84=D0=B5=D0=B2=D1=80=D0= =B0=D0=BB=D1=8F 2020 =D0=B3., 20:42:44 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7= =D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8C John MacFarlane=20 =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB: > > > This is because it's a convention in rST that the top-level=20 > heading is the document title:=20 > > > https://docutils.sourceforge.io/docs/user/rst/quickstart.html#document-ti= tle-subtitle=20 > =20 > > If you add `-s` to your `-t json` you'll see the difference.=20 > > So why the difference with docx output? It's because pandoc=20 > automatically enables standalone when you have a non-text format=20 > for output (docx, pdf, etc.).=20 > > > Dmitriy Krasilnikov > writes:=20 > > > I'm trying to bind Header_1 to some docx style.=20 > >=20 > > This sample Lua filter function should output a header level each time= =20 > it=20 > > finds one:=20 > >=20 > > function Header(el)=20 > > print(el.level)=20 > > end=20 > >=20 > > The source reStructured text code:=20 > > ***************=20 > > Header 1 sample=20 > > ***************=20 > >=20 > > Text=20 > >=20 > > Header 2 sample=20 > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=20 > >=20 > > Text2=20 > >=20 > >=20 > > Header 2 sample=20 > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=20 > >=20 > > Text2=20 > >=20 > > In a command line this should print 1, 2, 2:=20 > > pandoc --lua-filter=3Drst2docxHead.lua -f rst -t json test.rst=20 > >=20 > > 1=20 > > 2=20 > > 2=20 > > {"blocks":[{"t":"Header","c":[1,["header-1-sample",[],[]=20 > >=20 > > So, let's see how in converts to docx=E2=80=A6=20 > >=20 > > $ pandoc --lua-filter=3Drst2docxHead.lua -f rst -t docx -o test.docx=20 > test.rst=20 > > 1=20 > > 1=20 > >=20 > > For some reason in this configuration the top level header is not=20 > processed=20 > > and seems to be directly passed to docx output as a document title.=20 > >=20 > > --=20 > > You received this message because you are subscribed to the Google=20 > Groups "pandoc-discuss" group.=20 > > To unsubscribe from this group and stop receiving emails from it, send= =20 > an email to pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org .=20 > > To view this discussion on the web visit=20 > https://groups.google.com/d/msgid/pandoc-discuss/a9db644a-43b0-4b2b-9b80-= 7f34cb9694ba%40googlegroups.com.=20 > > --=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/120c0525-969a-495b-a031-a0bb8fdd26ba%40googlegroups.com. ------=_Part_1545_1239382483.1582646677469 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thanks for clarification.

Ho= w can this top-level document title be accessed with Lua script?
<= br>=D0=BF=D1=8F=D1=82=D0=BD=D0=B8=D1=86=D0=B0, 21 =D1=84=D0=B5=D0=B2=D1=80= =D0=B0=D0=BB=D1=8F 2020 =D0=B3., 20:42:44 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0= =B7=D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8C John MacFarlane =D0=BD=D0=B0= =D0=BF=D0=B8=D1=81=D0=B0=D0=BB:

This is because it's a convention in rST that the top-level
heading is the document title:

https://docutils.sourceforge.io/docs/user/rst/quickstart.= html#document-title-subtitle

If you add `-s` to your `-t json` you'll see the difference.

So why the difference with docx output? =C2=A0It's because pandoc
automatically enables standalone when you have a non-text format
for output (docx, pdf, etc.).


Dmitriy Krasilnikov <dmitriy.k...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

> I'm trying to bind Header_1 to some docx style.
>
> This sample Lua filter function should output a header level each = time it=20
> finds one:
>
> function Header(el)
> =C2=A0 print(el.level)
> end
>
> The source reStructured text code:
> ***************
> Header 1 sample
> ***************
>
> Text
>
> Header 2 sample
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>
> Text2
>
>
> Header 2 sample
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>
> Text2
>
> In a command line this should print 1, 2, 2:=20
> pandoc --lua-filter=3Drst2docxHead.lua -f rst -t json test.rst
>
> 1
> 2
> 2
> {"blocks":[{"t":"Header","c&quo= t;:[1,["header-1-sample",[],[]
>
> So, let's see how in converts to docx=E2=80=A6
>
> $ pandoc --lua-filter=3Drst2docxHead.lua -f rst -t docx -o test.do= cx test.rst
> 1
> 1=20
>
> For some reason in this configuration the top level header is not = processed=20
> and seems to be directly passed to docx output as a document title= .
>
> --=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 pandoc-...@googlegroups.com.
> To view this discussion on the web visit https://groups.= google.com/d/msgid/pandoc-discuss/a9db644a-43b0-4b2b-9b80-7f34cb9= 694ba%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups &= quot;pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an e= mail to pand= oc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d/= msgid/pandoc-discuss/120c0525-969a-495b-a031-a0bb8fdd26ba%40googlegroups.co= m.
------=_Part_1545_1239382483.1582646677469-- ------=_Part_1544_1186329712.1582646677469--