* Top level header lost @ 2020-02-21 13:57 Dmitriy Krasilnikov [not found] ` <a9db644a-43b0-4b2b-9b80-7f34cb9694ba-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 0 siblings, 1 reply; 4+ messages in thread From: Dmitriy Krasilnikov @ 2020-02-21 13:57 UTC (permalink / raw) To: pandoc-discuss [-- Attachment #1.1: Type: text/plain, Size: 1249 bytes --] I'm trying to bind Header_1 to some docx style. This sample Lua filter function should output a header level each time it finds one: function Header(el) print(el.level) end The source reStructured text code: *************** Header 1 sample *************** Text Header 2 sample =============== Text2 Header 2 sample =============== Text2 In a command line this should print 1, 2, 2: pandoc --lua-filter=rst2docxHead.lua -f rst -t json test.rst 1 2 2 {"blocks":[{"t":"Header","c":[1,["header-1-sample",[],[] So, let's see how in converts to docx… $ pandoc --lua-filter=rst2docxHead.lua -f rst -t docx -o test.docx test.rst 1 1 For some reason in this configuration the top level header is not processed and seems to be directly passed to docx output as a document title. -- 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-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/a9db644a-43b0-4b2b-9b80-7f34cb9694ba%40googlegroups.com. [-- Attachment #1.2: Type: text/html, Size: 9070 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <a9db644a-43b0-4b2b-9b80-7f34cb9694ba-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>]
* Re: Top level header lost [not found] ` <a9db644a-43b0-4b2b-9b80-7f34cb9694ba-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> @ 2020-02-21 17:42 ` John MacFarlane [not found] ` <m2sgj3x2f2.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org> 0 siblings, 1 reply; 4+ messages in thread From: John MacFarlane @ 2020-02-21 17:42 UTC (permalink / raw) To: Dmitriy Krasilnikov, pandoc-discuss 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? It's because pandoc automatically enables standalone when you have a non-text format for output (docx, pdf, etc.). Dmitriy Krasilnikov <dmitriy.krasilnikov-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 > finds one: > > function Header(el) > print(el.level) > end > > The source reStructured text code: > *************** > Header 1 sample > *************** > > Text > > Header 2 sample > =============== > > Text2 > > > Header 2 sample > =============== > > Text2 > > In a command line this should print 1, 2, 2: > pandoc --lua-filter=rst2docxHead.lua -f rst -t json test.rst > > 1 > 2 > 2 > {"blocks":[{"t":"Header","c":[1,["header-1-sample",[],[] > > So, let's see how in converts to docx… > > $ pandoc --lua-filter=rst2docxHead.lua -f rst -t docx -o test.docx test.rst > 1 > 1 > > For some reason in this configuration the top level header is not processed > and seems to be directly passed to docx output as a document title. > > -- > 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-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/a9db644a-43b0-4b2b-9b80-7f34cb9694ba%40googlegroups.com. -- 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-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/m2sgj3x2f2.fsf%40johnmacfarlane.net. ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <m2sgj3x2f2.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>]
* Re: Top level header lost [not found] ` <m2sgj3x2f2.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org> @ 2020-02-25 16:04 ` Dmitriy Krasilnikov [not found] ` <120c0525-969a-495b-a031-a0bb8fdd26ba-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 0 siblings, 1 reply; 4+ messages in thread From: Dmitriy Krasilnikov @ 2020-02-25 16:04 UTC (permalink / raw) To: pandoc-discuss [-- Attachment #1.1: Type: text/plain, Size: 2859 bytes --] Thanks for clarification. How can this top-level document title be accessed with Lua script? пятница, 21 февраля 2020 г., 20:42:44 UTC+3 пользователь John MacFarlane написал: > > > 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 > <https://www.google.com/url?q=https%3A%2F%2Fdocutils.sourceforge.io%2Fdocs%2Fuser%2Frst%2Fquickstart.html%23document-title-subtitle&sa=D&sntz=1&usg=AFQjCNEZH9joZkO4IkzazpAZrKigOPD9mA> > > If you add `-s` to your `-t json` you'll see the difference. > > So why the difference with docx output? It'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 <javascript:>> 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 > > finds one: > > > > function Header(el) > > print(el.level) > > end > > > > The source reStructured text code: > > *************** > > Header 1 sample > > *************** > > > > Text > > > > Header 2 sample > > =============== > > > > Text2 > > > > > > Header 2 sample > > =============== > > > > Text2 > > > > In a command line this should print 1, 2, 2: > > pandoc --lua-filter=rst2docxHead.lua -f rst -t json test.rst > > > > 1 > > 2 > > 2 > > {"blocks":[{"t":"Header","c":[1,["header-1-sample",[],[] > > > > So, let's see how in converts to docx… > > > > $ pandoc --lua-filter=rst2docxHead.lua -f rst -t docx -o test.docx > test.rst > > 1 > > 1 > > > > For some reason in this configuration the top level header is not > processed > > and seems to be directly passed to docx output as a document title. > > > > -- > > 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-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <javascript:>. > > To view this discussion on the web visit > https://groups.google.com/d/msgid/pandoc-discuss/a9db644a-43b0-4b2b-9b80-7f34cb9694ba%40googlegroups.com. > > -- 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-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. [-- Attachment #1.2: Type: text/html, Size: 5002 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <120c0525-969a-495b-a031-a0bb8fdd26ba-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>]
* Re: Top level header lost [not found] ` <120c0525-969a-495b-a031-a0bb8fdd26ba-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> @ 2020-02-25 18:08 ` John MacFarlane 0 siblings, 0 replies; 4+ messages in thread From: John MacFarlane @ 2020-02-25 18:08 UTC (permalink / raw) To: Dmitriy Krasilnikov, pandoc-discuss It's the title field in the metadata. See the docs on lua scripts for how to access the metadata. Dmitriy Krasilnikov <dmitriy.krasilnikov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes: > Thanks for clarification. > > How can this top-level document title be accessed with Lua script? > > пятница, 21 февраля 2020 г., 20:42:44 UTC+3 пользователь John MacFarlane > написал: >> >> >> 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 >> <https://www.google.com/url?q=https%3A%2F%2Fdocutils.sourceforge.io%2Fdocs%2Fuser%2Frst%2Fquickstart.html%23document-title-subtitle&sa=D&sntz=1&usg=AFQjCNEZH9joZkO4IkzazpAZrKigOPD9mA> >> >> If you add `-s` to your `-t json` you'll see the difference. >> >> So why the difference with docx output? It'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 <javascript:>> 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 >> > finds one: >> > >> > function Header(el) >> > print(el.level) >> > end >> > >> > The source reStructured text code: >> > *************** >> > Header 1 sample >> > *************** >> > >> > Text >> > >> > Header 2 sample >> > =============== >> > >> > Text2 >> > >> > >> > Header 2 sample >> > =============== >> > >> > Text2 >> > >> > In a command line this should print 1, 2, 2: >> > pandoc --lua-filter=rst2docxHead.lua -f rst -t json test.rst >> > >> > 1 >> > 2 >> > 2 >> > {"blocks":[{"t":"Header","c":[1,["header-1-sample",[],[] >> > >> > So, let's see how in converts to docx… >> > >> > $ pandoc --lua-filter=rst2docxHead.lua -f rst -t docx -o test.docx >> test.rst >> > 1 >> > 1 >> > >> > For some reason in this configuration the top level header is not >> processed >> > and seems to be directly passed to docx output as a document title. >> > >> > -- >> > 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-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <javascript:>. >> > To view this discussion on the web visit >> https://groups.google.com/d/msgid/pandoc-discuss/a9db644a-43b0-4b2b-9b80-7f34cb9694ba%40googlegroups.com. >> >> > > -- > 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-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. -- 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-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/m2sgiytu9r.fsf%40johnmacfarlane.net. ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-02-25 18:08 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2020-02-21 13:57 Top level header lost Dmitriy Krasilnikov [not found] ` <a9db644a-43b0-4b2b-9b80-7f34cb9694ba-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 2020-02-21 17:42 ` John MacFarlane [not found] ` <m2sgj3x2f2.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org> 2020-02-25 16:04 ` Dmitriy Krasilnikov [not found] ` <120c0525-969a-495b-a031-a0bb8fdd26ba-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 2020-02-25 18:08 ` John MacFarlane
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 NNTP newsgroup(s).