* problem setting style after blocktext in docx output
@ 2021-10-27 16:28 Landon Yarrington
[not found] ` <ba599eb3-3129-4658-9701-b9243d6c793en-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
0 siblings, 1 reply; 14+ messages in thread
From: Landon Yarrington @ 2021-10-27 16:28 UTC (permalink / raw)
To: pandoc-discuss
[-- Attachment #1.1: Type: text/plain, Size: 2729 bytes --]
I'm trying to process block quotes in a way such that the following
paragraph directly after a block quote is styled as a continuation of the
paragraph in which the blockquote is nested. I tried several different
styles, but cannot seem to achieve this. I almost filed an issue on GH, but
thought twice :-)
I'm using pandoc 2.15 with the following command.
`pandoc -N -t docx -f
markdown+markdown_attribute+mmd_link_attributes+simple_tables+multiline_tables+auto_identifiers+table_captions+yaml_metadata_block+raw_attribute+implicit_figures+latex_macros+header_attributes
--reference-doc=ref_template.docx example.md -o TEST_example.docx`
Is this a user-error, a problem with my ref_template.docx, or what?
And here's `example.md`
````
# Heading1
Here's some text. Here's some text. Here's some text. Here's some text.
Here's some text. Here's some text. Here's some text. Here's some text.
Here's some text. Here's some text. Here's some text. Here's some text.
Here's some text. Here's some text. Here's some text. Here's some text.
Here's some text. Here's some text. Here's some text. Here's some text.
Here's some text. Here's some text. Here's some text.
Here's some text. Here's some text. Here's some text. Here's some text.
Here's some text. Here's some text. Here's some text. Here's some text.
Here's some text. Here's some text. Here's some text. Here's some text.
## Heading 2
Here's some text. Here's some text. Here's some text. Here's some text.
Here's some text. Here's some text. Here's some text. Here's some text.
Here's some text.
Here's some text. Here's some text. Here's some text. Here's some text.
Here's some text. Here's some text.
> Block quote time. Block quote time. Block quote time. Block quote time.
Block quote time. Block quote time. Block quote time. Block quote time.
Block quote time. Block quote time. Block quote time. Block quote time.
Block quote time. Block quote time. Block quote time. Block quote time.
Block quote time. Block quote time. Block quote time.
Back to the text. Back to the text. Back to the text. Back to the text.
Back to the text.
Here's some text. Here's some text. Here's some text. Here's some text.
Here's some text. Here's some text. Here's some text. Here's some text.
Here's some text. Here's some text.
````
--
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/ba599eb3-3129-4658-9701-b9243d6c793en%40googlegroups.com.
[-- Attachment #1.2: Type: text/html, Size: 3174 bytes --]
[-- Attachment #2: ref_template.docx --]
[-- Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document, Size: 25904 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
[parent not found: <ba599eb3-3129-4658-9701-b9243d6c793en-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>]
* Re: problem setting style after blocktext in docx output [not found] ` <ba599eb3-3129-4658-9701-b9243d6c793en-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> @ 2021-10-27 16:32 ` Landon Yarrington [not found] ` <86c4d6cd-4ea3-41ad-aae9-c301f049a2can-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 2021-10-27 16:47 ` John MacFarlane 1 sibling, 1 reply; 14+ messages in thread From: Landon Yarrington @ 2021-10-27 16:32 UTC (permalink / raw) To: pandoc-discuss [-- Attachment #1.1: Type: text/plain, Size: 3191 bytes --] To clarify, in the MRE above, my goal is to get the paragraph immediately after the blockquote to render as "Body Text 2" according to the style in the ref_template.docx. Using this and every other stylesheet I've made, the following paragraphs always come out as style "First Paragraph." On Wednesday, October 27, 2021 at 12:28:02 PM UTC-4 Landon Yarrington wrote: > I'm trying to process block quotes in a way such that the following > paragraph directly after a block quote is styled as a continuation of the > paragraph in which the blockquote is nested. I tried several different > styles, but cannot seem to achieve this. I almost filed an issue on GH, but > thought twice :-) > > I'm using pandoc 2.15 with the following command. > > `pandoc -N -t docx -f > markdown+markdown_attribute+mmd_link_attributes+simple_tables+multiline_tables+auto_identifiers+table_captions+yaml_metadata_block+raw_attribute+implicit_figures+latex_macros+header_attributes > --reference-doc=ref_template.docx example.md -o TEST_example.docx` > Is this a user-error, a problem with my ref_template.docx, or what? > > And here's `example.md` > ```` > # Heading1 > > Here's some text. Here's some text. Here's some text. Here's some text. > Here's some text. Here's some text. Here's some text. Here's some text. > Here's some text. Here's some text. Here's some text. Here's some text. > Here's some text. Here's some text. Here's some text. Here's some text. > Here's some text. Here's some text. Here's some text. Here's some text. > Here's some text. Here's some text. Here's some text. > > Here's some text. Here's some text. Here's some text. Here's some text. > Here's some text. Here's some text. Here's some text. Here's some text. > Here's some text. Here's some text. Here's some text. Here's some text. > > ## Heading 2 > > Here's some text. Here's some text. Here's some text. Here's some text. > Here's some text. Here's some text. Here's some text. Here's some text. > Here's some text. > > Here's some text. Here's some text. Here's some text. Here's some text. > Here's some text. Here's some text. > > > Block quote time. Block quote time. Block quote time. Block quote time. > Block quote time. Block quote time. Block quote time. Block quote time. > Block quote time. Block quote time. Block quote time. Block quote time. > Block quote time. Block quote time. Block quote time. Block quote time. > Block quote time. Block quote time. Block quote time. > > Back to the text. Back to the text. Back to the text. Back to the text. > Back to the text. > > Here's some text. Here's some text. Here's some text. Here's some text. > Here's some text. Here's some text. Here's some text. Here's some text. > Here's some text. Here's some text. > ```` > -- 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/86c4d6cd-4ea3-41ad-aae9-c301f049a2can%40googlegroups.com. [-- Attachment #1.2: Type: text/html, Size: 4033 bytes --] ^ permalink raw reply [flat|nested] 14+ messages in thread
[parent not found: <86c4d6cd-4ea3-41ad-aae9-c301f049a2can-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>]
* AW: problem setting style after blocktext in docx output [not found] ` <86c4d6cd-4ea3-41ad-aae9-c301f049a2can-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> @ 2021-10-27 16:38 ` denis.maier-NSENcxR/0n0 [not found] ` <a1d780a852754aec85dbf01a13456754-NSENcxR/0n0@public.gmane.org> 2021-10-27 16:56 ` Bastien DUMONT 1 sibling, 1 reply; 14+ messages in thread From: denis.maier-NSENcxR/0n0 @ 2021-10-27 16:38 UTC (permalink / raw) To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw What do you want to achieve visually? Suppress indents? If so, just style first paragraph accordingly. Best Denis ________________________________________ Von: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> im Auftrag von Landon Yarrington <lyarrington-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> Gesendet: Mittwoch, 27. Oktober 2021 18:32:34 An: pandoc-discuss Betreff: Re: problem setting style after blocktext in docx output To clarify, in the MRE above, my goal is to get the paragraph immediately after the blockquote to render as "Body Text 2" according to the style in the ref_template.docx. Using this and every other stylesheet I've made, the following paragraphs always come out as style "First Paragraph." On Wednesday, October 27, 2021 at 12:28:02 PM UTC-4 Landon Yarrington wrote: I'm trying to process block quotes in a way such that the following paragraph directly after a block quote is styled as a continuation of the paragraph in which the blockquote is nested. I tried several different styles, but cannot seem to achieve this. I almost filed an issue on GH, but thought twice :-) I'm using pandoc 2.15 with the following command. `pandoc -N -t docx -f markdown+markdown_attribute+mmd_link_attributes+simple_tables+multiline_tables+auto_identifiers+table_captions+yaml_metadata_block+raw_attribute+implicit_figures+latex_macros+header_attributes --reference-doc=ref_template.docx example.md -o TEST_example.docx` Is this a user-error, a problem with my ref_template.docx, or what? And here's `example.md` ```` # Heading1 Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. ## Heading 2 Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. > Block quote time. Block quote time. Block quote time. Block quote time. Block quote time. Block quote time. Block quote time. Block quote time. Block quote time. Block quote time. Block quote time. Block quote time. Block quote time. Block quote time. Block quote time. Block quote time. Block quote time. Block quote time. Block quote time. Back to the text. Back to the text. Back to the text. Back to the text. Back to the text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. ```` -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>. To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/86c4d6cd-4ea3-41ad-aae9-c301f049a2can%40googlegroups.com<https://groups.google.com/d/msgid/pandoc-discuss/86c4d6cd-4ea3-41ad-aae9-c301f049a2can%40googlegroups.com?utm_medium=email&utm_source=footer>. -- 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/a1d780a852754aec85dbf01a13456754%40unibe.ch. ^ permalink raw reply [flat|nested] 14+ messages in thread
[parent not found: <a1d780a852754aec85dbf01a13456754-NSENcxR/0n0@public.gmane.org>]
* AW: problem setting style after blocktext in docx output [not found] ` <a1d780a852754aec85dbf01a13456754-NSENcxR/0n0@public.gmane.org> @ 2021-10-27 16:40 ` denis.maier-NSENcxR/0n0 0 siblings, 0 replies; 14+ messages in thread From: denis.maier-NSENcxR/0n0 @ 2021-10-27 16:40 UTC (permalink / raw) To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw Ah should have looked at your ref-doc first. Now I understand. First-paragraph is already used for something else, and has indents... ________________________________________ Von: Maier, Denis Christian (UB) Gesendet: Mittwoch, 27. Oktober 2021 18:38:12 An: pandoc-discuss Betreff: AW: problem setting style after blocktext in docx output What do you want to achieve visually? Suppress indents? If so, just style first paragraph accordingly. Best Denis ________________________________________ Von: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> im Auftrag von Landon Yarrington <lyarrington-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> Gesendet: Mittwoch, 27. Oktober 2021 18:32:34 An: pandoc-discuss Betreff: Re: problem setting style after blocktext in docx output To clarify, in the MRE above, my goal is to get the paragraph immediately after the blockquote to render as "Body Text 2" according to the style in the ref_template.docx. Using this and every other stylesheet I've made, the following paragraphs always come out as style "First Paragraph." On Wednesday, October 27, 2021 at 12:28:02 PM UTC-4 Landon Yarrington wrote: I'm trying to process block quotes in a way such that the following paragraph directly after a block quote is styled as a continuation of the paragraph in which the blockquote is nested. I tried several different styles, but cannot seem to achieve this. I almost filed an issue on GH, but thought twice :-) I'm using pandoc 2.15 with the following command. `pandoc -N -t docx -f markdown+markdown_attribute+mmd_link_attributes+simple_tables+multiline_tables+auto_identifiers+table_captions+yaml_metadata_block+raw_attribute+implicit_figures+latex_macros+header_attributes --reference-doc=ref_template.docx example.md -o TEST_example.docx` Is this a user-error, a problem with my ref_template.docx, or what? And here's `example.md` ```` # Heading1 Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. ## Heading 2 Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. > Block quote time. Block quote time. Block quote time. Block quote time. Block quote time. Block quote time. Block quote time. Block quote time. Block quote time. Block quote time. Block quote time. Block quote time. Block quote time. Block quote time. Block quote time. Block quote time. Block quote time. Block quote time. Block quote time. Back to the text. Back to the text. Back to the text. Back to the text. Back to the text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. Here's some text. ```` -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>. To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/86c4d6cd-4ea3-41ad-aae9-c301f049a2can%40googlegroups.com<https://groups.google.com/d/msgid/pandoc-discuss/86c4d6cd-4ea3-41ad-aae9-c301f049a2can%40googlegroups.com?utm_medium=email&utm_source=footer>. -- 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/102f575f1f984012ae27789420543c6f%40unibe.ch. ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: problem setting style after blocktext in docx output [not found] ` <86c4d6cd-4ea3-41ad-aae9-c301f049a2can-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 2021-10-27 16:38 ` AW: " denis.maier-NSENcxR/0n0 @ 2021-10-27 16:56 ` Bastien DUMONT 2021-10-27 20:19 ` Landon Yarrington 2022-03-10 20:44 ` Paul Kelleher 1 sibling, 2 replies; 14+ messages in thread From: Bastien DUMONT @ 2021-10-27 16:56 UTC (permalink / raw) To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw If all you want is to prevent indentation, you can use a filter that I wrote for a similar need: https://github.com/badumont/lua-filters/tree/complex-paragraphs/complex-paragraphs (which supports other output formats and enables you to control more precisely what is indented or not). If you really need to set a style, the following filter should work: ``` is_preceding_BlockQuote = false function Block(block) if block.t == 'BlockQuote' then is_preceding_BlockQuote = true elseif is_preceding_BlockQuote == true then is_preceding_BlockQuote = false return pandoc.Div(block, {['custom-style'] = 'Body Text 2'}) end end ``` Le Wednesday 27 October 2021 à 09:32:34AM, Landon Yarrington a écrit : > To clarify, in the MRE above, my goal is to get the paragraph immediately after > the blockquote to render as "Body Text 2" according to the style in the > ref_template.docx. Using this and every other stylesheet I've made, the > following paragraphs always come out as style "First Paragraph." > > On Wednesday, October 27, 2021 at 12:28:02 PM UTC-4 Landon Yarrington wrote: > > I'm trying to process block quotes in a way such that the following > paragraph directly after a block quote is styled as a continuation of the > paragraph in which the blockquote is nested. I tried several different > styles, but cannot seem to achieve this. I almost filed an issue on GH, but > thought twice :-) > > I'm using pandoc 2.15 with the following command. > > `pandoc -N -t docx -f > markdown+markdown_attribute+mmd_link_attributes+simple_tables+multiline_tables+auto_identifiers+table_captions+yaml_metadata_block+raw_attribute+implicit_figures+latex_macros+header_attributes > --reference-doc=ref_template.docx example.md -o TEST_example.docx` > Is this a user-error, a problem with my ref_template.docx, or what? > > And here's `example.md` > ```` > # Heading1 > > Here's some text. Here's some text. Here's some text. Here's some text. > Here's some text. Here's some text. Here's some text. Here's some text. > Here's some text. Here's some text. Here's some text. Here's some text. > Here's some text. Here's some text. Here's some text. Here's some text. > Here's some text. Here's some text. Here's some text. Here's some text. > Here's some text. Here's some text. Here's some text. > > Here's some text. Here's some text. Here's some text. Here's some text. > Here's some text. Here's some text. Here's some text. Here's some text. > Here's some text. Here's some text. Here's some text. Here's some text. > > ## Heading 2 > > Here's some text. Here's some text. Here's some text. Here's some text. > Here's some text. Here's some text. Here's some text. Here's some text. > Here's some text. > > Here's some text. Here's some text. Here's some text. Here's some text. > Here's some text. Here's some text. > > > Block quote time. Block quote time. Block quote time. Block quote time. > Block quote time. Block quote time. Block quote time. Block quote time. > Block quote time. Block quote time. Block quote time. Block quote time. > Block quote time. Block quote time. Block quote time. Block quote time. > Block quote time. Block quote time. Block quote time. > > Back to the text. Back to the text. Back to the text. Back to the text. > Back to the text. > > Here's some text. Here's some text. Here's some text. Here's some text. > Here's some text. Here's some text. Here's some text. Here's some text. > Here's some text. Here's some text. > ```` > > -- > 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 [1]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit [2]https://groups.google.com/d/msgid/ > pandoc-discuss/86c4d6cd-4ea3-41ad-aae9-c301f049a2can%40googlegroups.com. > > References: > > [1] mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > [2] https://groups.google.com/d/msgid/pandoc-discuss/86c4d6cd-4ea3-41ad-aae9-c301f049a2can%40googlegroups.com?utm_medium=email&utm_source=footer -- 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/YXmErrRbpkRNsEje%40localhost. ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: problem setting style after blocktext in docx output 2021-10-27 16:56 ` Bastien DUMONT @ 2021-10-27 20:19 ` Landon Yarrington [not found] ` <1b625016-e8cd-4400-9492-fae034e235d8n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 2022-03-10 20:44 ` Paul Kelleher 1 sibling, 1 reply; 14+ messages in thread From: Landon Yarrington @ 2021-10-27 20:19 UTC (permalink / raw) To: pandoc-discuss [-- Attachment #1.1: Type: text/plain, Size: 6542 bytes --] Thanks for the prompt responses and earnest help. *John*: I had defined the custom style in the style sheet I attached, specifying that the `Block Text` style should be followed by `Body Text 2` style. I assumed that was enough because this functionality seems to work with regard to `First Paragraph` and `Body Text` styles ("this functionality" meaning that pandoc seems to abide by the `Style for following paragraph` feature). Is this assumption incorrect? At any rate, following through with the `+fenced_divs` attribute worked and implemented the `Body Text 2` style. For future reference, you must do as the manual indicates and surround the chunk immediately following the blockquote in: ::: {custom-style="Body Text 2"} Rest of chunk. ::: *Bastien*: Thanks for pointing me to your lua filter. I had a hard time getting the snippet you shared in this thread to work, most likely because I don't know lua and trying to put out 1million fires. However, when I examined your lua filter on github, I was able to work that. For my particular case, I didn't like the fact it rendered the subsequent hunk as `First Paragraph + unindented` (or some such). It was instructive to see the exact openxml code required to implement the fix, which I was able to reproduce in an Rmarkdown document as: ```{=openxml} <w:pPr> <w:pStyle w:val="BodyText"/> <w:ind w:hanging="0"/> <w:rPr></w:rPr></w:pPr> ``` So for Rmarkdown users looking to render text after blockquotes in a sort of "keep with preceding" style, then pasting the above snippet works. On Wednesday, October 27, 2021 at 12:57:34 PM UTC-4 Bastien Dumont wrote: > If all you want is to prevent indentation, you can use a filter that I > wrote for a similar need: > https://github.com/badumont/lua-filters/tree/complex-paragraphs/complex-paragraphs > (which supports other output formats and enables you to control more > precisely what is indented or not). If you really need to set a style, the > following filter should work: > > ``` > is_preceding_BlockQuote = false > > function Block(block) > if block.t == 'BlockQuote' then > is_preceding_BlockQuote = true > elseif is_preceding_BlockQuote == true then > is_preceding_BlockQuote = false > return pandoc.Div(block, {['custom-style'] = 'Body Text 2'}) > end > end > ``` > > Le Wednesday 27 October 2021 à 09:32:34AM, Landon Yarrington a écrit : > > To clarify, in the MRE above, my goal is to get the paragraph > immediately after > > the blockquote to render as "Body Text 2" according to the style in the > > ref_template.docx. Using this and every other stylesheet I've made, the > > following paragraphs always come out as style "First Paragraph." > > > > On Wednesday, October 27, 2021 at 12:28:02 PM UTC-4 Landon Yarrington > wrote: > > > > I'm trying to process block quotes in a way such that the following > > paragraph directly after a block quote is styled as a continuation of the > > paragraph in which the blockquote is nested. I tried several different > > styles, but cannot seem to achieve this. I almost filed an issue on GH, > but > > thought twice :-) > > > > I'm using pandoc 2.15 with the following command. > > > > `pandoc -N -t docx -f > > > markdown+markdown_attribute+mmd_link_attributes+simple_tables+multiline_tables+auto_identifiers+table_captions+yaml_metadata_block+raw_attribute+implicit_figures+latex_macros+header_attributes > > --reference-doc=ref_template.docx example.md -o TEST_example.docx` > > Is this a user-error, a problem with my ref_template.docx, or what? > > > > And here's `example.md` > > ```` > > # Heading1 > > > > Here's some text. Here's some text. Here's some text. Here's some text. > > Here's some text. Here's some text. Here's some text. Here's some text. > > Here's some text. Here's some text. Here's some text. Here's some text. > > Here's some text. Here's some text. Here's some text. Here's some text. > > Here's some text. Here's some text. Here's some text. Here's some text. > > Here's some text. Here's some text. Here's some text. > > > > Here's some text. Here's some text. Here's some text. Here's some text. > > Here's some text. Here's some text. Here's some text. Here's some text. > > Here's some text. Here's some text. Here's some text. Here's some text. > > > > ## Heading 2 > > > > Here's some text. Here's some text. Here's some text. Here's some text. > > Here's some text. Here's some text. Here's some text. Here's some text. > > Here's some text. > > > > Here's some text. Here's some text. Here's some text. Here's some text. > > Here's some text. Here's some text. > > > > > Block quote time. Block quote time. Block quote time. Block quote time. > > Block quote time. Block quote time. Block quote time. Block quote time. > > Block quote time. Block quote time. Block quote time. Block quote time. > > Block quote time. Block quote time. Block quote time. Block quote time. > > Block quote time. Block quote time. Block quote time. > > > > Back to the text. Back to the text. Back to the text. Back to the text. > > Back to the text. > > > > Here's some text. Here's some text. Here's some text. Here's some text. > > Here's some text. Here's some text. Here's some text. Here's some text. > > Here's some text. Here's some text. > > ```` > > > > -- > > 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 [1]pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To view this discussion on the web visit [2] > https://groups.google.com/d/msgid/ > > pandoc-discuss/86c4d6cd-4ea3-41ad-aae9-c301f049a2can%40googlegroups.com. > > > > References: > > > > [1] mailto:pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > [2] > https://groups.google.com/d/msgid/pandoc-discuss/86c4d6cd-4ea3-41ad-aae9-c301f049a2can%40googlegroups.com?utm_medium=email&utm_source=footer > > -- 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/1b625016-e8cd-4400-9492-fae034e235d8n%40googlegroups.com. [-- Attachment #1.2: Type: text/html, Size: 9507 bytes --] ^ permalink raw reply [flat|nested] 14+ messages in thread
[parent not found: <1b625016-e8cd-4400-9492-fae034e235d8n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>]
* Re: problem setting style after blocktext in docx output [not found] ` <1b625016-e8cd-4400-9492-fae034e235d8n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> @ 2021-10-27 22:48 ` Bastien DUMONT 0 siblings, 0 replies; 14+ messages in thread From: Bastien DUMONT @ 2021-10-27 22:48 UTC (permalink / raw) To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw In principle, the code snippet is a filter on its own that should just work as is. Hoever, you may have some complexities in your file that I hadn't anticipated. Just as a side note, the solution implemented in "complex-paragraphs.lua" produces invalid OOXML code, but it turns out that both Word and LibreOffice handle it in the way we want. Le Wednesday 27 October 2021 à 01:19:33PM, Landon Yarrington a écrit : > Thanks for the prompt responses and earnest help. > > John: I had defined the custom style in the style sheet I attached, specifying > that the `Block Text` style should be followed by `Body Text 2` style. I > assumed that was enough because this functionality seems to work with regard to > `First Paragraph` and `Body Text` styles ("this functionality" meaning that > pandoc seems to abide by the `Style for following paragraph` feature). Is this > assumption incorrect? At any rate, following through with the `+fenced_divs` > attribute worked and implemented the `Body Text 2` style. For future reference, > you must do as the manual indicates and surround the chunk immediately > following the blockquote in: > > ::: {custom-style="Body Text 2"} > Rest of chunk. > ::: > > Bastien: Thanks for pointing me to your lua filter. I had a hard time getting > the snippet you shared in this thread to work, most likely because I don't know > lua and trying to put out 1million fires. However, when I examined your lua > filter on github, I was able to work that. For my particular case, I didn't > like the fact it rendered the subsequent hunk as `First Paragraph + unindented` > (or some such). It was instructive to see the exact openxml code required to > implement the fix, which I was able to reproduce in an Rmarkdown document as: > > ```{=openxml} > <w:pPr> > <w:pStyle w:val="BodyText"/> > <w:ind w:hanging="0"/> > <w:rPr></w:rPr></w:pPr> > ``` > > So for Rmarkdown users looking to render text after blockquotes in a sort of > "keep with preceding" style, then pasting the above snippet works. > On Wednesday, October 27, 2021 at 12:57:34 PM UTC-4 Bastien Dumont wrote: > > If all you want is to prevent indentation, you can use a filter that I > wrote for a similar need: [1]https://github.com/badumont/lua-filters/tree/ > complex-paragraphs/complex-paragraphs (which supports other output formats > and enables you to control more precisely what is indented or not). If you > really need to set a style, the following filter should work: > > ``` > is_preceding_BlockQuote = false > > function Block(block) > if block.t == 'BlockQuote' then > is_preceding_BlockQuote = true > elseif is_preceding_BlockQuote == true then > is_preceding_BlockQuote = false > return pandoc.Div(block, {['custom-style'] = 'Body Text 2'}) > end > end > ``` > > Le Wednesday 27 October 2021 à 09:32:34AM, Landon Yarrington a écrit : > > To clarify, in the MRE above, my goal is to get the paragraph immediately > after > > the blockquote to render as "Body Text 2" according to the style in the > > ref_template.docx. Using this and every other stylesheet I've made, the > > following paragraphs always come out as style "First Paragraph." > > > > On Wednesday, October 27, 2021 at 12:28:02 PM UTC-4 Landon Yarrington > wrote: > > > > I'm trying to process block quotes in a way such that the following > > paragraph directly after a block quote is styled as a continuation of the > > paragraph in which the blockquote is nested. I tried several different > > styles, but cannot seem to achieve this. I almost filed an issue on GH, > but > > thought twice :-) > > > > I'm using pandoc 2.15 with the following command. > > > > `pandoc -N -t docx -f > > > markdown+markdown_attribute+mmd_link_attributes+simple_tables+multiline_tables+auto_identifiers+table_captions+yaml_metadata_block+raw_attribute+implicit_figures+latex_macros+header_attributes > > > --reference-doc=ref_template.docx example.md -o TEST_example.docx` > > Is this a user-error, a problem with my ref_template.docx, or what? > > > > And here's `example.md` > > ```` > > # Heading1 > > > > Here's some text. Here's some text. Here's some text. Here's some text. > > Here's some text. Here's some text. Here's some text. Here's some text. > > Here's some text. Here's some text. Here's some text. Here's some text. > > Here's some text. Here's some text. Here's some text. Here's some text. > > Here's some text. Here's some text. Here's some text. Here's some text. > > Here's some text. Here's some text. Here's some text. > > > > Here's some text. Here's some text. Here's some text. Here's some text. > > Here's some text. Here's some text. Here's some text. Here's some text. > > Here's some text. Here's some text. Here's some text. Here's some text. > > > > ## Heading 2 > > > > Here's some text. Here's some text. Here's some text. Here's some text. > > Here's some text. Here's some text. Here's some text. Here's some text. > > Here's some text. > > > > Here's some text. Here's some text. Here's some text. Here's some text. > > Here's some text. Here's some text. > > > > > Block quote time. Block quote time. Block quote time. Block quote time. > > Block quote time. Block quote time. Block quote time. Block quote time. > > Block quote time. Block quote time. Block quote time. Block quote time. > > Block quote time. Block quote time. Block quote time. Block quote time. > > Block quote time. Block quote time. Block quote time. > > > > Back to the text. Back to the text. Back to the text. Back to the text. > > Back to the text. > > > > Here's some text. Here's some text. Here's some text. Here's some text. > > Here's some text. Here's some text. Here's some text. Here's some text. > > Here's some text. Here's some text. > > ```` > > > > -- > > 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 [1]pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To view this discussion on the web visit [2][2]https://groups.google.com/ > d/msgid/ > > pandoc-discuss/86c4d6cd-4ea3-41ad-aae9-c301f049a2can%[3] > 40googlegroups.com. > > > > References: > > > > [1] mailto:pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > [2] [4]https://groups.google.com/d/msgid/pandoc-discuss/ > 86c4d6cd-4ea3-41ad-aae9-c301f049a2can%40googlegroups.com?utm_medium=email& > utm_source=footer > > > -- > 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 [5]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit [6]https://groups.google.com/d/msgid/ > pandoc-discuss/1b625016-e8cd-4400-9492-fae034e235d8n%40googlegroups.com. > > References: > > [1] https://github.com/badumont/lua-filters/tree/complex-paragraphs/complex-paragraphs > [2] https://groups.google.com/d/msgid/ > [3] http://40googlegroups.com/ > [4] https://groups.google.com/d/msgid/pandoc-discuss/86c4d6cd-4ea3-41ad-aae9-c301f049a2can%40googlegroups.com?utm_medium=email&utm_source=footer > [5] mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > [6] https://groups.google.com/d/msgid/pandoc-discuss/1b625016-e8cd-4400-9492-fae034e235d8n%40googlegroups.com?utm_medium=email&utm_source=footer -- 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/YXnXJHiV4/gMPaz0%40localhost. ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: problem setting style after blocktext in docx output 2021-10-27 16:56 ` Bastien DUMONT 2021-10-27 20:19 ` Landon Yarrington @ 2022-03-10 20:44 ` Paul Kelleher [not found] ` <bc83b25d-d676-4582-ba04-830e3f378c2an-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 1 sibling, 1 reply; 14+ messages in thread From: Paul Kelleher @ 2022-03-10 20:44 UTC (permalink / raw) To: pandoc-discuss [-- Attachment #1.1: Type: text/plain, Size: 5546 bytes --] Thank you so much for posting this filter that converts the paragraph after block quote to Body Text 2! It worked great for me. But: I also have other element environments (e.g. equations) that I'd like to suppress indents after when I use pandoc to compile md to docx. I couldn't get your complex paragraphs filter to work for me. However, I'm already used to writing "\noindent" from my LaTeX days (and it helps to have that if I want to compile md to tex anyway). Would it be possible to write a filter that assigns the Block Text 2 style to every paragraph that starts with "\noindent"? On Wednesday, October 27, 2021 at 11:57:34 AM UTC-5 Bastien Dumont wrote: > If all you want is to prevent indentation, you can use a filter that I > wrote for a similar need: > https://github.com/badumont/lua-filters/tree/complex-paragraphs/complex-paragraphs > (which supports other output formats and enables you to control more > precisely what is indented or not). If you really need to set a style, the > following filter should work: > > ``` > is_preceding_BlockQuote = false > > function Block(block) > if block.t == 'BlockQuote' then > is_preceding_BlockQuote = true > elseif is_preceding_BlockQuote == true then > is_preceding_BlockQuote = false > return pandoc.Div(block, {['custom-style'] = 'Body Text 2'}) > end > end > ``` > > Le Wednesday 27 October 2021 à 09:32:34AM, Landon Yarrington a écrit : > > To clarify, in the MRE above, my goal is to get the paragraph > immediately after > > the blockquote to render as "Body Text 2" according to the style in the > > ref_template.docx. Using this and every other stylesheet I've made, the > > following paragraphs always come out as style "First Paragraph." > > > > On Wednesday, October 27, 2021 at 12:28:02 PM UTC-4 Landon Yarrington > wrote: > > > > I'm trying to process block quotes in a way such that the following > > paragraph directly after a block quote is styled as a continuation of the > > paragraph in which the blockquote is nested. I tried several different > > styles, but cannot seem to achieve this. I almost filed an issue on GH, > but > > thought twice :-) > > > > I'm using pandoc 2.15 with the following command. > > > > `pandoc -N -t docx -f > > > markdown+markdown_attribute+mmd_link_attributes+simple_tables+multiline_tables+auto_identifiers+table_captions+yaml_metadata_block+raw_attribute+implicit_figures+latex_macros+header_attributes > > --reference-doc=ref_template.docx example.md -o TEST_example.docx` > > Is this a user-error, a problem with my ref_template.docx, or what? > > > > And here's `example.md` > > ```` > > # Heading1 > > > > Here's some text. Here's some text. Here's some text. Here's some text. > > Here's some text. Here's some text. Here's some text. Here's some text. > > Here's some text. Here's some text. Here's some text. Here's some text. > > Here's some text. Here's some text. Here's some text. Here's some text. > > Here's some text. Here's some text. Here's some text. Here's some text. > > Here's some text. Here's some text. Here's some text. > > > > Here's some text. Here's some text. Here's some text. Here's some text. > > Here's some text. Here's some text. Here's some text. Here's some text. > > Here's some text. Here's some text. Here's some text. Here's some text. > > > > ## Heading 2 > > > > Here's some text. Here's some text. Here's some text. Here's some text. > > Here's some text. Here's some text. Here's some text. Here's some text. > > Here's some text. > > > > Here's some text. Here's some text. Here's some text. Here's some text. > > Here's some text. Here's some text. > > > > > Block quote time. Block quote time. Block quote time. Block quote time. > > Block quote time. Block quote time. Block quote time. Block quote time. > > Block quote time. Block quote time. Block quote time. Block quote time. > > Block quote time. Block quote time. Block quote time. Block quote time. > > Block quote time. Block quote time. Block quote time. > > > > Back to the text. Back to the text. Back to the text. Back to the text. > > Back to the text. > > > > Here's some text. Here's some text. Here's some text. Here's some text. > > Here's some text. Here's some text. Here's some text. Here's some text. > > Here's some text. Here's some text. > > ```` > > > > -- > > 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 [1]pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To view this discussion on the web visit [2] > https://groups.google.com/d/msgid/ > > pandoc-discuss/86c4d6cd-4ea3-41ad-aae9-c301f049a2can%40googlegroups.com. > > > > References: > > > > [1] mailto:pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > [2] > https://groups.google.com/d/msgid/pandoc-discuss/86c4d6cd-4ea3-41ad-aae9-c301f049a2can%40googlegroups.com?utm_medium=email&utm_source=footer > > -- 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/bc83b25d-d676-4582-ba04-830e3f378c2an%40googlegroups.com. [-- Attachment #1.2: Type: text/html, Size: 8270 bytes --] ^ permalink raw reply [flat|nested] 14+ messages in thread
[parent not found: <bc83b25d-d676-4582-ba04-830e3f378c2an-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>]
* Re: problem setting style after blocktext in docx output [not found] ` <bc83b25d-d676-4582-ba04-830e3f378c2an-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> @ 2022-03-11 7:22 ` BPJ [not found] ` <CADAJKhDFJSM=6eeoNszTwjKczgKPDTzAZZSN1O+jO6C7cCoKCw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 14+ messages in thread From: BPJ @ 2022-03-11 7:22 UTC (permalink / raw) To: pandoc-discuss [-- Attachment #1: Type: text/plain, Size: 6466 bytes --] You can use a custom-style div: ``````markdown ::: {custom-style="Body Text 2"} Paragraph text. ::: `````` Den tors 10 mars 2022 21:45Paul Kelleher <paul-JZTKsBFbLNkkm2bSNb+QWw@public.gmane.org> skrev: > Thank you so much for posting this filter that converts the paragraph > after block quote to Body Text 2! It worked great for me. But: I also have > other element environments (e.g. equations) that I'd like to suppress > indents after when I use pandoc to compile md to docx. I couldn't get your > complex paragraphs filter to work for me. However, I'm already used to > writing "\noindent" from my LaTeX days (and it helps to have that if I want > to compile md to tex anyway). Would it be possible to write a filter that > assigns the Block Text 2 style to every paragraph that starts with > "\noindent"? > > On Wednesday, October 27, 2021 at 11:57:34 AM UTC-5 Bastien Dumont wrote: > >> If all you want is to prevent indentation, you can use a filter that I >> wrote for a similar need: >> https://github.com/badumont/lua-filters/tree/complex-paragraphs/complex-paragraphs >> (which supports other output formats and enables you to control more >> precisely what is indented or not). If you really need to set a style, the >> following filter should work: >> >> ``` >> is_preceding_BlockQuote = false >> >> function Block(block) >> if block.t == 'BlockQuote' then >> is_preceding_BlockQuote = true >> elseif is_preceding_BlockQuote == true then >> is_preceding_BlockQuote = false >> return pandoc.Div(block, {['custom-style'] = 'Body Text 2'}) >> end >> end >> ``` >> >> Le Wednesday 27 October 2021 à 09:32:34AM, Landon Yarrington a écrit : >> > To clarify, in the MRE above, my goal is to get the paragraph >> immediately after >> > the blockquote to render as "Body Text 2" according to the style in the >> > ref_template.docx. Using this and every other stylesheet I've made, the >> > following paragraphs always come out as style "First Paragraph." >> > >> > On Wednesday, October 27, 2021 at 12:28:02 PM UTC-4 Landon Yarrington >> wrote: >> > >> > I'm trying to process block quotes in a way such that the following >> > paragraph directly after a block quote is styled as a continuation of >> the >> > paragraph in which the blockquote is nested. I tried several different >> > styles, but cannot seem to achieve this. I almost filed an issue on GH, >> but >> > thought twice :-) >> > >> > I'm using pandoc 2.15 with the following command. >> > >> > `pandoc -N -t docx -f >> > >> markdown+markdown_attribute+mmd_link_attributes+simple_tables+multiline_tables+auto_identifiers+table_captions+yaml_metadata_block+raw_attribute+implicit_figures+latex_macros+header_attributes >> >> > --reference-doc=ref_template.docx example.md -o TEST_example.docx` >> > Is this a user-error, a problem with my ref_template.docx, or what? >> > >> > And here's `example.md` >> > ```` >> > # Heading1 >> > >> > Here's some text. Here's some text. Here's some text. Here's some text. >> > Here's some text. Here's some text. Here's some text. Here's some text. >> > Here's some text. Here's some text. Here's some text. Here's some text. >> > Here's some text. Here's some text. Here's some text. Here's some text. >> > Here's some text. Here's some text. Here's some text. Here's some text. >> > Here's some text. Here's some text. Here's some text. >> > >> > Here's some text. Here's some text. Here's some text. Here's some text. >> > Here's some text. Here's some text. Here's some text. Here's some text. >> > Here's some text. Here's some text. Here's some text. Here's some text. >> > >> > ## Heading 2 >> > >> > Here's some text. Here's some text. Here's some text. Here's some text. >> > Here's some text. Here's some text. Here's some text. Here's some text. >> > Here's some text. >> > >> > Here's some text. Here's some text. Here's some text. Here's some text. >> > Here's some text. Here's some text. >> > >> > > Block quote time. Block quote time. Block quote time. Block quote >> time. >> > Block quote time. Block quote time. Block quote time. Block quote time. >> > Block quote time. Block quote time. Block quote time. Block quote time. >> > Block quote time. Block quote time. Block quote time. Block quote time. >> > Block quote time. Block quote time. Block quote time. >> > >> > Back to the text. Back to the text. Back to the text. Back to the text. >> > Back to the text. >> > >> > Here's some text. Here's some text. Here's some text. Here's some text. >> > Here's some text. Here's some text. Here's some text. Here's some text. >> > Here's some text. Here's some text. >> > ```` >> > >> > -- >> > 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 [1]pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> > To view this discussion on the web visit [2] >> https://groups.google.com/d/msgid/ >> > pandoc-discuss/86c4d6cd-4ea3-41ad-aae9-c301f049a2can%40googlegroups.com. >> >> > >> > References: >> > >> > [1] mailto:pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org >> > [2] >> https://groups.google.com/d/msgid/pandoc-discuss/86c4d6cd-4ea3-41ad-aae9-c301f049a2can%40googlegroups.com?utm_medium=email&utm_source=footer >> >> -- > 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/bc83b25d-d676-4582-ba04-830e3f378c2an%40googlegroups.com > <https://groups.google.com/d/msgid/pandoc-discuss/bc83b25d-d676-4582-ba04-830e3f378c2an%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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/CADAJKhDFJSM%3D6eeoNszTwjKczgKPDTzAZZSN1O%2BjO6C7cCoKCw%40mail.gmail.com. [-- Attachment #2: Type: text/html, Size: 8874 bytes --] ^ permalink raw reply [flat|nested] 14+ messages in thread
[parent not found: <CADAJKhDFJSM=6eeoNszTwjKczgKPDTzAZZSN1O+jO6C7cCoKCw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: problem setting style after blocktext in docx output [not found] ` <CADAJKhDFJSM=6eeoNszTwjKczgKPDTzAZZSN1O+jO6C7cCoKCw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2022-03-11 16:20 ` Paul Kelleher [not found] ` <58f80fd9-5017-4ae2-8a86-225d3fa79463n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 0 siblings, 1 reply; 14+ messages in thread From: Paul Kelleher @ 2022-03-11 16:20 UTC (permalink / raw) To: pandoc-discuss [-- Attachment #1.1: Type: text/plain, Size: 7163 bytes --] Thank you! I was able to get this to work great for compiling from md to docx. But if want to compile from md to pdf, I need "\noindent". If I wrote using \noindent, could a filter be used to strip out that latex command and then wrap the paragraph in that custom-style div? On Friday, March 11, 2022 at 1:23:03 AM UTC-6 BP wrote: > You can use a custom-style div: > > ``````markdown > ::: {custom-style="Body Text 2"} > Paragraph text. > ::: > `````` > > > > Den tors 10 mars 2022 21:45Paul Kelleher <pa...-JZTKsBFbLNkkm2bSNb+QWw@public.gmane.org> skrev: > >> Thank you so much for posting this filter that converts the paragraph >> after block quote to Body Text 2! It worked great for me. But: I also have >> other element environments (e.g. equations) that I'd like to suppress >> indents after when I use pandoc to compile md to docx. I couldn't get your >> complex paragraphs filter to work for me. However, I'm already used to >> writing "\noindent" from my LaTeX days (and it helps to have that if I want >> to compile md to tex anyway). Would it be possible to write a filter that >> assigns the Block Text 2 style to every paragraph that starts with >> "\noindent"? >> >> On Wednesday, October 27, 2021 at 11:57:34 AM UTC-5 Bastien Dumont wrote: >> >>> If all you want is to prevent indentation, you can use a filter that I >>> wrote for a similar need: >>> https://github.com/badumont/lua-filters/tree/complex-paragraphs/complex-paragraphs >>> (which supports other output formats and enables you to control more >>> precisely what is indented or not). If you really need to set a style, the >>> following filter should work: >>> >>> ``` >>> is_preceding_BlockQuote = false >>> >>> function Block(block) >>> if block.t == 'BlockQuote' then >>> is_preceding_BlockQuote = true >>> elseif is_preceding_BlockQuote == true then >>> is_preceding_BlockQuote = false >>> return pandoc.Div(block, {['custom-style'] = 'Body Text 2'}) >>> end >>> end >>> ``` >>> >>> Le Wednesday 27 October 2021 à 09:32:34AM, Landon Yarrington a écrit : >>> > To clarify, in the MRE above, my goal is to get the paragraph >>> immediately after >>> > the blockquote to render as "Body Text 2" according to the style in >>> the >>> > ref_template.docx. Using this and every other stylesheet I've made, >>> the >>> > following paragraphs always come out as style "First Paragraph." >>> > >>> > On Wednesday, October 27, 2021 at 12:28:02 PM UTC-4 Landon Yarrington >>> wrote: >>> > >>> > I'm trying to process block quotes in a way such that the following >>> > paragraph directly after a block quote is styled as a continuation of >>> the >>> > paragraph in which the blockquote is nested. I tried several different >>> > styles, but cannot seem to achieve this. I almost filed an issue on >>> GH, but >>> > thought twice :-) >>> > >>> > I'm using pandoc 2.15 with the following command. >>> > >>> > `pandoc -N -t docx -f >>> > >>> markdown+markdown_attribute+mmd_link_attributes+simple_tables+multiline_tables+auto_identifiers+table_captions+yaml_metadata_block+raw_attribute+implicit_figures+latex_macros+header_attributes >>> >>> > --reference-doc=ref_template.docx example.md -o TEST_example.docx` >>> > Is this a user-error, a problem with my ref_template.docx, or what? >>> > >>> > And here's `example.md` >>> > ```` >>> > # Heading1 >>> > >>> > Here's some text. Here's some text. Here's some text. Here's some >>> text. >>> > Here's some text. Here's some text. Here's some text. Here's some >>> text. >>> > Here's some text. Here's some text. Here's some text. Here's some >>> text. >>> > Here's some text. Here's some text. Here's some text. Here's some >>> text. >>> > Here's some text. Here's some text. Here's some text. Here's some >>> text. >>> > Here's some text. Here's some text. Here's some text. >>> > >>> > Here's some text. Here's some text. Here's some text. Here's some >>> text. >>> > Here's some text. Here's some text. Here's some text. Here's some >>> text. >>> > Here's some text. Here's some text. Here's some text. Here's some >>> text. >>> > >>> > ## Heading 2 >>> > >>> > Here's some text. Here's some text. Here's some text. Here's some >>> text. >>> > Here's some text. Here's some text. Here's some text. Here's some >>> text. >>> > Here's some text. >>> > >>> > Here's some text. Here's some text. Here's some text. Here's some >>> text. >>> > Here's some text. Here's some text. >>> > >>> > > Block quote time. Block quote time. Block quote time. Block quote >>> time. >>> > Block quote time. Block quote time. Block quote time. Block quote >>> time. >>> > Block quote time. Block quote time. Block quote time. Block quote >>> time. >>> > Block quote time. Block quote time. Block quote time. Block quote >>> time. >>> > Block quote time. Block quote time. Block quote time. >>> > >>> > Back to the text. Back to the text. Back to the text. Back to the >>> text. >>> > Back to the text. >>> > >>> > Here's some text. Here's some text. Here's some text. Here's some >>> text. >>> > Here's some text. Here's some text. Here's some text. Here's some >>> text. >>> > Here's some text. Here's some text. >>> > ```` >>> > >>> > -- >>> > 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 [1]pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>> > To view this discussion on the web visit [2] >>> https://groups.google.com/d/msgid/ >>> > pandoc-discuss/86c4d6cd-4ea3-41ad-aae9-c301f049a2can% >>> 40googlegroups.com. >>> > >>> > References: >>> > >>> > [1] mailto:pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org >>> > [2] >>> https://groups.google.com/d/msgid/pandoc-discuss/86c4d6cd-4ea3-41ad-aae9-c301f049a2can%40googlegroups.com?utm_medium=email&utm_source=footer >>> >>> -- >> 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-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/pandoc-discuss/bc83b25d-d676-4582-ba04-830e3f378c2an%40googlegroups.com >> <https://groups.google.com/d/msgid/pandoc-discuss/bc83b25d-d676-4582-ba04-830e3f378c2an%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- 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/58f80fd9-5017-4ae2-8a86-225d3fa79463n%40googlegroups.com. [-- Attachment #1.2: Type: text/html, Size: 10675 bytes --] ^ permalink raw reply [flat|nested] 14+ messages in thread
[parent not found: <58f80fd9-5017-4ae2-8a86-225d3fa79463n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>]
* Re: problem setting style after blocktext in docx output [not found] ` <58f80fd9-5017-4ae2-8a86-225d3fa79463n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> @ 2022-03-11 17:14 ` BPJ [not found] ` <CADAJKhBBTXWbvkdARhZTA=eNvmS+48=0wS5_EGb9CCduJVJ4EA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 14+ messages in thread From: BPJ @ 2022-03-11 17:14 UTC (permalink / raw) To: pandoc-discuss [-- Attachment #1: Type: text/plain, Size: 8989 bytes --] You can do it, but there are quite a few things you need to think about: ``````lua function Para (para) if 'RawInline' == para.content[1].tag then -- Format may be 'tex' or 'latex' if para.content[1].format:match('tex$') then para.content:remove(1) -- It may be followed by a space if 'Space' == para.content[1].tag then para.content:remove(1) end return pandoc.Div( {para}, {['custom-style'] = 'Body Text 2'} ) end end return nil end `````` I would do it the other way around and insert the `\noindent` when producing LaTeX (although I think it is not needed, since Pandoc sets `parindent` to zero). The code is much simpler! ``````lua function Div (div) if 'Body Text 2' == div.attributes['custom-style'] then if 'Para' == div.content[1].tag then div.content[1].content:insert( 1, pandoc.RawInline('latex', "\\noindent ") -- Note the trailing space! ) return div end end return nil end `````` HTH, /bpj Den fre 11 mars 2022 17:21Paul Kelleher <paul-JZTKsBFbLNkkm2bSNb+QWw@public.gmane.org> skrev: > Thank you! I was able to get this to work great for compiling from md to > docx. But if want to compile from md to pdf, I need "\noindent". If I wrote > using \noindent, could a filter be used to strip out that latex command and > then wrap the paragraph in that custom-style div? > > On Friday, March 11, 2022 at 1:23:03 AM UTC-6 BP wrote: > >> You can use a custom-style div: >> >> ``````markdown >> ::: {custom-style="Body Text 2"} >> Paragraph text. >> ::: >> `````` >> >> >> >> Den tors 10 mars 2022 21:45Paul Kelleher <pa...-JZTKsBFbLNkkm2bSNb+QWw@public.gmane.org> skrev: >> >>> Thank you so much for posting this filter that converts the paragraph >>> after block quote to Body Text 2! It worked great for me. But: I also have >>> other element environments (e.g. equations) that I'd like to suppress >>> indents after when I use pandoc to compile md to docx. I couldn't get your >>> complex paragraphs filter to work for me. However, I'm already used to >>> writing "\noindent" from my LaTeX days (and it helps to have that if I want >>> to compile md to tex anyway). Would it be possible to write a filter that >>> assigns the Block Text 2 style to every paragraph that starts with >>> "\noindent"? >>> >>> On Wednesday, October 27, 2021 at 11:57:34 AM UTC-5 Bastien Dumont wrote: >>> >>>> If all you want is to prevent indentation, you can use a filter that I >>>> wrote for a similar need: >>>> https://github.com/badumont/lua-filters/tree/complex-paragraphs/complex-paragraphs >>>> (which supports other output formats and enables you to control more >>>> precisely what is indented or not). If you really need to set a style, the >>>> following filter should work: >>>> >>>> ``` >>>> is_preceding_BlockQuote = false >>>> >>>> function Block(block) >>>> if block.t == 'BlockQuote' then >>>> is_preceding_BlockQuote = true >>>> elseif is_preceding_BlockQuote == true then >>>> is_preceding_BlockQuote = false >>>> return pandoc.Div(block, {['custom-style'] = 'Body Text 2'}) >>>> end >>>> end >>>> ``` >>>> >>>> Le Wednesday 27 October 2021 à 09:32:34AM, Landon Yarrington a écrit : >>>> > To clarify, in the MRE above, my goal is to get the paragraph >>>> immediately after >>>> > the blockquote to render as "Body Text 2" according to the style in >>>> the >>>> > ref_template.docx. Using this and every other stylesheet I've made, >>>> the >>>> > following paragraphs always come out as style "First Paragraph." >>>> > >>>> > On Wednesday, October 27, 2021 at 12:28:02 PM UTC-4 Landon Yarrington >>>> wrote: >>>> > >>>> > I'm trying to process block quotes in a way such that the following >>>> > paragraph directly after a block quote is styled as a continuation of >>>> the >>>> > paragraph in which the blockquote is nested. I tried several >>>> different >>>> > styles, but cannot seem to achieve this. I almost filed an issue on >>>> GH, but >>>> > thought twice :-) >>>> > >>>> > I'm using pandoc 2.15 with the following command. >>>> > >>>> > `pandoc -N -t docx -f >>>> > >>>> markdown+markdown_attribute+mmd_link_attributes+simple_tables+multiline_tables+auto_identifiers+table_captions+yaml_metadata_block+raw_attribute+implicit_figures+latex_macros+header_attributes >>>> >>>> > --reference-doc=ref_template.docx example.md -o TEST_example.docx` >>>> > Is this a user-error, a problem with my ref_template.docx, or what? >>>> > >>>> > And here's `example.md` >>>> > ```` >>>> > # Heading1 >>>> > >>>> > Here's some text. Here's some text. Here's some text. Here's some >>>> text. >>>> > Here's some text. Here's some text. Here's some text. Here's some >>>> text. >>>> > Here's some text. Here's some text. Here's some text. Here's some >>>> text. >>>> > Here's some text. Here's some text. Here's some text. Here's some >>>> text. >>>> > Here's some text. Here's some text. Here's some text. Here's some >>>> text. >>>> > Here's some text. Here's some text. Here's some text. >>>> > >>>> > Here's some text. Here's some text. Here's some text. Here's some >>>> text. >>>> > Here's some text. Here's some text. Here's some text. Here's some >>>> text. >>>> > Here's some text. Here's some text. Here's some text. Here's some >>>> text. >>>> > >>>> > ## Heading 2 >>>> > >>>> > Here's some text. Here's some text. Here's some text. Here's some >>>> text. >>>> > Here's some text. Here's some text. Here's some text. Here's some >>>> text. >>>> > Here's some text. >>>> > >>>> > Here's some text. Here's some text. Here's some text. Here's some >>>> text. >>>> > Here's some text. Here's some text. >>>> > >>>> > > Block quote time. Block quote time. Block quote time. Block quote >>>> time. >>>> > Block quote time. Block quote time. Block quote time. Block quote >>>> time. >>>> > Block quote time. Block quote time. Block quote time. Block quote >>>> time. >>>> > Block quote time. Block quote time. Block quote time. Block quote >>>> time. >>>> > Block quote time. Block quote time. Block quote time. >>>> > >>>> > Back to the text. Back to the text. Back to the text. Back to the >>>> text. >>>> > Back to the text. >>>> > >>>> > Here's some text. Here's some text. Here's some text. Here's some >>>> text. >>>> > Here's some text. Here's some text. Here's some text. Here's some >>>> text. >>>> > Here's some text. Here's some text. >>>> > ```` >>>> > >>>> > -- >>>> > 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 [1]pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>>> > To view this discussion on the web visit [2] >>>> https://groups.google.com/d/msgid/ >>>> > pandoc-discuss/86c4d6cd-4ea3-41ad-aae9-c301f049a2can% >>>> 40googlegroups.com. >>>> > >>>> > References: >>>> > >>>> > [1] mailto:pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org >>>> > [2] >>>> https://groups.google.com/d/msgid/pandoc-discuss/86c4d6cd-4ea3-41ad-aae9-c301f049a2can%40googlegroups.com?utm_medium=email&utm_source=footer >>>> >>>> -- >>> 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-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/pandoc-discuss/bc83b25d-d676-4582-ba04-830e3f378c2an%40googlegroups.com >>> <https://groups.google.com/d/msgid/pandoc-discuss/bc83b25d-d676-4582-ba04-830e3f378c2an%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- > 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/58f80fd9-5017-4ae2-8a86-225d3fa79463n%40googlegroups.com > <https://groups.google.com/d/msgid/pandoc-discuss/58f80fd9-5017-4ae2-8a86-225d3fa79463n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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/CADAJKhBBTXWbvkdARhZTA%3DeNvmS%2B48%3D0wS5_EGb9CCduJVJ4EA%40mail.gmail.com. [-- Attachment #2: Type: text/html, Size: 12836 bytes --] ^ permalink raw reply [flat|nested] 14+ messages in thread
[parent not found: <CADAJKhBBTXWbvkdARhZTA=eNvmS+48=0wS5_EGb9CCduJVJ4EA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: problem setting style after blocktext in docx output [not found] ` <CADAJKhBBTXWbvkdARhZTA=eNvmS+48=0wS5_EGb9CCduJVJ4EA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2022-03-11 17:54 ` Paul Kelleher [not found] ` <fd41c606-6011-4bfc-9a6e-33103faaba75n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 0 siblings, 1 reply; 14+ messages in thread From: Paul Kelleher @ 2022-03-11 17:54 UTC (permalink / raw) To: pandoc-discuss [-- Attachment #1.1: Type: text/plain, Size: 9819 bytes --] Thank you! I also just realized that since I write md with Scrivener, I can create a component type "noindent" and then change the prefix (and, if needed, suffix) of the block of text contained in that component. I just played with that and it's working wonderfully. But your solutions will be very useful if/when I'm unable to use Scrivener. Thanks again! On Friday, March 11, 2022 at 11:14:55 AM UTC-6 BP wrote: > You can do it, but there are quite a few things you need to think about: > > ``````lua > function Para (para) > if 'RawInline' == para.content[1].tag then > -- Format may be 'tex' or 'latex' > if para.content[1].format:match('tex$') then > para.content:remove(1) > -- It may be followed by a space > if 'Space' == para.content[1].tag then > para.content:remove(1) > end > return pandoc.Div( > {para}, > {['custom-style'] = 'Body Text 2'} > ) > end > end > return nil > end > `````` > > I would do it the other way around and insert the `\noindent` when > producing LaTeX (although I think it is not needed, since Pandoc sets > `parindent` to zero). The code is much simpler! > > ``````lua > function Div (div) > if 'Body Text 2' == div.attributes['custom-style'] then > if 'Para' == div.content[1].tag then > div.content[1].content:insert( > 1, > pandoc.RawInline('latex', "\\noindent ") -- Note the trailing > space! > ) > return div > end > end > return nil > end > `````` > > HTH, > > /bpj > > Den fre 11 mars 2022 17:21Paul Kelleher <pa...-JZTKsBFbLNkkm2bSNb+QWw@public.gmane.org> skrev: > >> Thank you! I was able to get this to work great for compiling from md to >> docx. But if want to compile from md to pdf, I need "\noindent". If I wrote >> using \noindent, could a filter be used to strip out that latex command and >> then wrap the paragraph in that custom-style div? >> >> On Friday, March 11, 2022 at 1:23:03 AM UTC-6 BP wrote: >> >>> You can use a custom-style div: >>> >>> ``````markdown >>> ::: {custom-style="Body Text 2"} >>> Paragraph text. >>> ::: >>> `````` >>> >>> >>> >>> Den tors 10 mars 2022 21:45Paul Kelleher <pa...-JZTKsBFbLNkkm2bSNb+QWw@public.gmane.org> skrev: >>> >>>> Thank you so much for posting this filter that converts the paragraph >>>> after block quote to Body Text 2! It worked great for me. But: I also have >>>> other element environments (e.g. equations) that I'd like to suppress >>>> indents after when I use pandoc to compile md to docx. I couldn't get your >>>> complex paragraphs filter to work for me. However, I'm already used to >>>> writing "\noindent" from my LaTeX days (and it helps to have that if I want >>>> to compile md to tex anyway). Would it be possible to write a filter that >>>> assigns the Block Text 2 style to every paragraph that starts with >>>> "\noindent"? >>>> >>>> On Wednesday, October 27, 2021 at 11:57:34 AM UTC-5 Bastien Dumont >>>> wrote: >>>> >>>>> If all you want is to prevent indentation, you can use a filter that I >>>>> wrote for a similar need: >>>>> https://github.com/badumont/lua-filters/tree/complex-paragraphs/complex-paragraphs >>>>> (which supports other output formats and enables you to control more >>>>> precisely what is indented or not). If you really need to set a style, the >>>>> following filter should work: >>>>> >>>>> ``` >>>>> is_preceding_BlockQuote = false >>>>> >>>>> function Block(block) >>>>> if block.t == 'BlockQuote' then >>>>> is_preceding_BlockQuote = true >>>>> elseif is_preceding_BlockQuote == true then >>>>> is_preceding_BlockQuote = false >>>>> return pandoc.Div(block, {['custom-style'] = 'Body Text 2'}) >>>>> end >>>>> end >>>>> ``` >>>>> >>>>> Le Wednesday 27 October 2021 à 09:32:34AM, Landon Yarrington a écrit : >>>>> > To clarify, in the MRE above, my goal is to get the paragraph >>>>> immediately after >>>>> > the blockquote to render as "Body Text 2" according to the style in >>>>> the >>>>> > ref_template.docx. Using this and every other stylesheet I've made, >>>>> the >>>>> > following paragraphs always come out as style "First Paragraph." >>>>> > >>>>> > On Wednesday, October 27, 2021 at 12:28:02 PM UTC-4 Landon >>>>> Yarrington wrote: >>>>> > >>>>> > I'm trying to process block quotes in a way such that the following >>>>> > paragraph directly after a block quote is styled as a continuation >>>>> of the >>>>> > paragraph in which the blockquote is nested. I tried several >>>>> different >>>>> > styles, but cannot seem to achieve this. I almost filed an issue on >>>>> GH, but >>>>> > thought twice :-) >>>>> > >>>>> > I'm using pandoc 2.15 with the following command. >>>>> > >>>>> > `pandoc -N -t docx -f >>>>> > >>>>> markdown+markdown_attribute+mmd_link_attributes+simple_tables+multiline_tables+auto_identifiers+table_captions+yaml_metadata_block+raw_attribute+implicit_figures+latex_macros+header_attributes >>>>> >>>>> > --reference-doc=ref_template.docx example.md -o TEST_example.docx` >>>>> > Is this a user-error, a problem with my ref_template.docx, or what? >>>>> > >>>>> > And here's `example.md` >>>>> > ```` >>>>> > # Heading1 >>>>> > >>>>> > Here's some text. Here's some text. Here's some text. Here's some >>>>> text. >>>>> > Here's some text. Here's some text. Here's some text. Here's some >>>>> text. >>>>> > Here's some text. Here's some text. Here's some text. Here's some >>>>> text. >>>>> > Here's some text. Here's some text. Here's some text. Here's some >>>>> text. >>>>> > Here's some text. Here's some text. Here's some text. Here's some >>>>> text. >>>>> > Here's some text. Here's some text. Here's some text. >>>>> > >>>>> > Here's some text. Here's some text. Here's some text. Here's some >>>>> text. >>>>> > Here's some text. Here's some text. Here's some text. Here's some >>>>> text. >>>>> > Here's some text. Here's some text. Here's some text. Here's some >>>>> text. >>>>> > >>>>> > ## Heading 2 >>>>> > >>>>> > Here's some text. Here's some text. Here's some text. Here's some >>>>> text. >>>>> > Here's some text. Here's some text. Here's some text. Here's some >>>>> text. >>>>> > Here's some text. >>>>> > >>>>> > Here's some text. Here's some text. Here's some text. Here's some >>>>> text. >>>>> > Here's some text. Here's some text. >>>>> > >>>>> > > Block quote time. Block quote time. Block quote time. Block quote >>>>> time. >>>>> > Block quote time. Block quote time. Block quote time. Block quote >>>>> time. >>>>> > Block quote time. Block quote time. Block quote time. Block quote >>>>> time. >>>>> > Block quote time. Block quote time. Block quote time. Block quote >>>>> time. >>>>> > Block quote time. Block quote time. Block quote time. >>>>> > >>>>> > Back to the text. Back to the text. Back to the text. Back to the >>>>> text. >>>>> > Back to the text. >>>>> > >>>>> > Here's some text. Here's some text. Here's some text. Here's some >>>>> text. >>>>> > Here's some text. Here's some text. Here's some text. Here's some >>>>> text. >>>>> > Here's some text. Here's some text. >>>>> > ```` >>>>> > >>>>> > -- >>>>> > 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 [1]pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>>>> > To view this discussion on the web visit [2] >>>>> https://groups.google.com/d/msgid/ >>>>> > pandoc-discuss/86c4d6cd-4ea3-41ad-aae9-c301f049a2can% >>>>> 40googlegroups.com. >>>>> > >>>>> > References: >>>>> > >>>>> > [1] mailto:pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org >>>>> > [2] >>>>> https://groups.google.com/d/msgid/pandoc-discuss/86c4d6cd-4ea3-41ad-aae9-c301f049a2can%40googlegroups.com?utm_medium=email&utm_source=footer >>>>> >>>>> -- >>>> 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-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/pandoc-discuss/bc83b25d-d676-4582-ba04-830e3f378c2an%40googlegroups.com >>>> <https://groups.google.com/d/msgid/pandoc-discuss/bc83b25d-d676-4582-ba04-830e3f378c2an%40googlegroups.com?utm_medium=email&utm_source=footer> >>>> . >>>> >>> -- >> 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-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> > To view this discussion on the web visit >> https://groups.google.com/d/msgid/pandoc-discuss/58f80fd9-5017-4ae2-8a86-225d3fa79463n%40googlegroups.com >> <https://groups.google.com/d/msgid/pandoc-discuss/58f80fd9-5017-4ae2-8a86-225d3fa79463n%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- 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/fd41c606-6011-4bfc-9a6e-33103faaba75n%40googlegroups.com. [-- Attachment #1.2: Type: text/html, Size: 15081 bytes --] ^ permalink raw reply [flat|nested] 14+ messages in thread
[parent not found: <fd41c606-6011-4bfc-9a6e-33103faaba75n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>]
* Re: problem setting style after blocktext in docx output [not found] ` <fd41c606-6011-4bfc-9a6e-33103faaba75n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> @ 2022-03-12 8:53 ` BPJ 0 siblings, 0 replies; 14+ messages in thread From: BPJ @ 2022-03-12 8:53 UTC (permalink / raw) To: pandoc-discuss; +Cc: paul-JZTKsBFbLNkkm2bSNb+QWw [-- Attachment #1: Type: text/plain, Size: 11392 bytes --] I just realized that I forgot one essential part: to check that the raw LaTeX element contains `\noindent`! Here is the corrected version: ``````lua function Para (para) if 'RawInline' == para.content[1].tag then -- Format may be 'tex' or 'latex' if para.content[1].format:match('tex$') then -- Don't forget this: if para.content[1].text:match('\\noindent') then para.content:remove(1) -- It may be followed by a space if 'Space' == para.content[1].tag then para.content:remove(1) end return pandoc.Div( {para}, {['custom-style'] = 'Body Text 2'} ) end end end return nil end `````` Den fre 11 mars 2022 18:55Paul Kelleher <paul-JZTKsBFbLNkkm2bSNb+QWw@public.gmane.org> skrev: > Thank you! > > I also just realized that since I write md with Scrivener, I can create a > component type "noindent" and then change the prefix (and, if needed, > suffix) of the block of text contained in that component. I just played > with that and it's working wonderfully. But your solutions will be very > useful if/when I'm unable to use Scrivener. Thanks again! > > On Friday, March 11, 2022 at 11:14:55 AM UTC-6 BP wrote: > >> You can do it, but there are quite a few things you need to think about: >> >> ``````lua >> function Para (para) >> if 'RawInline' == para.content[1].tag then >> -- Format may be 'tex' or 'latex' >> if para.content[1].format:match('tex$') then >> para.content:remove(1) >> -- It may be followed by a space >> if 'Space' == para.content[1].tag then >> para.content:remove(1) >> end >> return pandoc.Div( >> {para}, >> {['custom-style'] = 'Body Text 2'} >> ) >> end >> end >> return nil >> end >> `````` >> >> I would do it the other way around and insert the `\noindent` when >> producing LaTeX (although I think it is not needed, since Pandoc sets >> `parindent` to zero). The code is much simpler! >> >> ``````lua >> function Div (div) >> if 'Body Text 2' == div.attributes['custom-style'] then >> if 'Para' == div.content[1].tag then >> div.content[1].content:insert( >> 1, >> pandoc.RawInline('latex', "\\noindent ") -- Note the trailing >> space! >> ) >> return div >> end >> end >> return nil >> end >> `````` >> >> HTH, >> >> /bpj >> >> Den fre 11 mars 2022 17:21Paul Kelleher <pa...-JZTKsBFbLNkkm2bSNb+QWw@public.gmane.org> skrev: >> >>> Thank you! I was able to get this to work great for compiling from md to >>> docx. But if want to compile from md to pdf, I need "\noindent". If I wrote >>> using \noindent, could a filter be used to strip out that latex command and >>> then wrap the paragraph in that custom-style div? >>> >>> On Friday, March 11, 2022 at 1:23:03 AM UTC-6 BP wrote: >>> >>>> You can use a custom-style div: >>>> >>>> ``````markdown >>>> ::: {custom-style="Body Text 2"} >>>> Paragraph text. >>>> ::: >>>> `````` >>>> >>>> >>>> >>>> Den tors 10 mars 2022 21:45Paul Kelleher <pa...-JZTKsBFbLNkkm2bSNb+QWw@public.gmane.org> >>>> skrev: >>>> >>>>> Thank you so much for posting this filter that converts the paragraph >>>>> after block quote to Body Text 2! It worked great for me. But: I also have >>>>> other element environments (e.g. equations) that I'd like to suppress >>>>> indents after when I use pandoc to compile md to docx. I couldn't get your >>>>> complex paragraphs filter to work for me. However, I'm already used to >>>>> writing "\noindent" from my LaTeX days (and it helps to have that if I want >>>>> to compile md to tex anyway). Would it be possible to write a filter that >>>>> assigns the Block Text 2 style to every paragraph that starts with >>>>> "\noindent"? >>>>> >>>>> On Wednesday, October 27, 2021 at 11:57:34 AM UTC-5 Bastien Dumont >>>>> wrote: >>>>> >>>>>> If all you want is to prevent indentation, you can use a filter that >>>>>> I wrote for a similar need: >>>>>> https://github.com/badumont/lua-filters/tree/complex-paragraphs/complex-paragraphs >>>>>> (which supports other output formats and enables you to control more >>>>>> precisely what is indented or not). If you really need to set a style, the >>>>>> following filter should work: >>>>>> >>>>>> ``` >>>>>> is_preceding_BlockQuote = false >>>>>> >>>>>> function Block(block) >>>>>> if block.t == 'BlockQuote' then >>>>>> is_preceding_BlockQuote = true >>>>>> elseif is_preceding_BlockQuote == true then >>>>>> is_preceding_BlockQuote = false >>>>>> return pandoc.Div(block, {['custom-style'] = 'Body Text 2'}) >>>>>> end >>>>>> end >>>>>> ``` >>>>>> >>>>>> Le Wednesday 27 October 2021 à 09:32:34AM, Landon Yarrington a écrit >>>>>> : >>>>>> > To clarify, in the MRE above, my goal is to get the paragraph >>>>>> immediately after >>>>>> > the blockquote to render as "Body Text 2" according to the style in >>>>>> the >>>>>> > ref_template.docx. Using this and every other stylesheet I've made, >>>>>> the >>>>>> > following paragraphs always come out as style "First Paragraph." >>>>>> > >>>>>> > On Wednesday, October 27, 2021 at 12:28:02 PM UTC-4 Landon >>>>>> Yarrington wrote: >>>>>> > >>>>>> > I'm trying to process block quotes in a way such that the following >>>>>> > paragraph directly after a block quote is styled as a continuation >>>>>> of the >>>>>> > paragraph in which the blockquote is nested. I tried several >>>>>> different >>>>>> > styles, but cannot seem to achieve this. I almost filed an issue on >>>>>> GH, but >>>>>> > thought twice :-) >>>>>> > >>>>>> > I'm using pandoc 2.15 with the following command. >>>>>> > >>>>>> > `pandoc -N -t docx -f >>>>>> > >>>>>> markdown+markdown_attribute+mmd_link_attributes+simple_tables+multiline_tables+auto_identifiers+table_captions+yaml_metadata_block+raw_attribute+implicit_figures+latex_macros+header_attributes >>>>>> >>>>>> > --reference-doc=ref_template.docx example.md -o TEST_example.docx` >>>>>> > Is this a user-error, a problem with my ref_template.docx, or what? >>>>>> > >>>>>> > And here's `example.md` >>>>>> > ```` >>>>>> > # Heading1 >>>>>> > >>>>>> > Here's some text. Here's some text. Here's some text. Here's some >>>>>> text. >>>>>> > Here's some text. Here's some text. Here's some text. Here's some >>>>>> text. >>>>>> > Here's some text. Here's some text. Here's some text. Here's some >>>>>> text. >>>>>> > Here's some text. Here's some text. Here's some text. Here's some >>>>>> text. >>>>>> > Here's some text. Here's some text. Here's some text. Here's some >>>>>> text. >>>>>> > Here's some text. Here's some text. Here's some text. >>>>>> > >>>>>> > Here's some text. Here's some text. Here's some text. Here's some >>>>>> text. >>>>>> > Here's some text. Here's some text. Here's some text. Here's some >>>>>> text. >>>>>> > Here's some text. Here's some text. Here's some text. Here's some >>>>>> text. >>>>>> > >>>>>> > ## Heading 2 >>>>>> > >>>>>> > Here's some text. Here's some text. Here's some text. Here's some >>>>>> text. >>>>>> > Here's some text. Here's some text. Here's some text. Here's some >>>>>> text. >>>>>> > Here's some text. >>>>>> > >>>>>> > Here's some text. Here's some text. Here's some text. Here's some >>>>>> text. >>>>>> > Here's some text. Here's some text. >>>>>> > >>>>>> > > Block quote time. Block quote time. Block quote time. Block quote >>>>>> time. >>>>>> > Block quote time. Block quote time. Block quote time. Block quote >>>>>> time. >>>>>> > Block quote time. Block quote time. Block quote time. Block quote >>>>>> time. >>>>>> > Block quote time. Block quote time. Block quote time. Block quote >>>>>> time. >>>>>> > Block quote time. Block quote time. Block quote time. >>>>>> > >>>>>> > Back to the text. Back to the text. Back to the text. Back to the >>>>>> text. >>>>>> > Back to the text. >>>>>> > >>>>>> > Here's some text. Here's some text. Here's some text. Here's some >>>>>> text. >>>>>> > Here's some text. Here's some text. Here's some text. Here's some >>>>>> text. >>>>>> > Here's some text. Here's some text. >>>>>> > ```` >>>>>> > >>>>>> > -- >>>>>> > 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 [1]pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>>>>> > To view this discussion on the web visit [2] >>>>>> https://groups.google.com/d/msgid/ >>>>>> > pandoc-discuss/86c4d6cd-4ea3-41ad-aae9-c301f049a2can% >>>>>> 40googlegroups.com. >>>>>> > >>>>>> > References: >>>>>> > >>>>>> > [1] mailto:pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org >>>>>> > [2] >>>>>> https://groups.google.com/d/msgid/pandoc-discuss/86c4d6cd-4ea3-41ad-aae9-c301f049a2can%40googlegroups.com?utm_medium=email&utm_source=footer >>>>>> >>>>>> -- >>>>> 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-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>>>> To view this discussion on the web visit >>>>> https://groups.google.com/d/msgid/pandoc-discuss/bc83b25d-d676-4582-ba04-830e3f378c2an%40googlegroups.com >>>>> <https://groups.google.com/d/msgid/pandoc-discuss/bc83b25d-d676-4582-ba04-830e3f378c2an%40googlegroups.com?utm_medium=email&utm_source=footer> >>>>> . >>>>> >>>> -- >>> 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-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>> >> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/pandoc-discuss/58f80fd9-5017-4ae2-8a86-225d3fa79463n%40googlegroups.com >>> <https://groups.google.com/d/msgid/pandoc-discuss/58f80fd9-5017-4ae2-8a86-225d3fa79463n%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- > 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/fd41c606-6011-4bfc-9a6e-33103faaba75n%40googlegroups.com > <https://groups.google.com/d/msgid/pandoc-discuss/fd41c606-6011-4bfc-9a6e-33103faaba75n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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/CADAJKhBXRLeMnxhuud-N4qx_QW7PTTdv_5CsWj0sTB%3DOeu-70Q%40mail.gmail.com. [-- Attachment #2: Type: text/html, Size: 16139 bytes --] ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: problem setting style after blocktext in docx output [not found] ` <ba599eb3-3129-4658-9701-b9243d6c793en-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 2021-10-27 16:32 ` Landon Yarrington @ 2021-10-27 16:47 ` John MacFarlane 1 sibling, 0 replies; 14+ messages in thread From: John MacFarlane @ 2021-10-27 16:47 UTC (permalink / raw) To: Landon Yarrington, pandoc-discuss The pandoc document model doesn't permit a distinction between (blockquote + continuation) and (blockquote + new paragraph). Since by default we use whitespace between paragraphs and no paragraph indentation, this isn't a big issue for the default output, but if you change settings to use indented paragraphs without surrounding whitespace, then it becomes an issue. For LaTeX/PDF output, I work around this by adding an explicit \noindent before the following paragraph, but that doesn't work if you're targeting docx. Does anyonoe know of a good workaround for docx output? One possibility would be to use a custom style (see the manual). Landon Yarrington <lyarrington-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes: > I'm trying to process block quotes in a way such that the following > paragraph directly after a block quote is styled as a continuation of the > paragraph in which the blockquote is nested. I tried several different > styles, but cannot seem to achieve this. I almost filed an issue on GH, but > thought twice :-) > > I'm using pandoc 2.15 with the following command. > > `pandoc -N -t docx -f > markdown+markdown_attribute+mmd_link_attributes+simple_tables+multiline_tables+auto_identifiers+table_captions+yaml_metadata_block+raw_attribute+implicit_figures+latex_macros+header_attributes > --reference-doc=ref_template.docx example.md -o TEST_example.docx` > Is this a user-error, a problem with my ref_template.docx, or what? > > And here's `example.md` > ```` > # Heading1 > > Here's some text. Here's some text. Here's some text. Here's some text. > Here's some text. Here's some text. Here's some text. Here's some text. > Here's some text. Here's some text. Here's some text. Here's some text. > Here's some text. Here's some text. Here's some text. Here's some text. > Here's some text. Here's some text. Here's some text. Here's some text. > Here's some text. Here's some text. Here's some text. > > Here's some text. Here's some text. Here's some text. Here's some text. > Here's some text. Here's some text. Here's some text. Here's some text. > Here's some text. Here's some text. Here's some text. Here's some text. > > ## Heading 2 > > Here's some text. Here's some text. Here's some text. Here's some text. > Here's some text. Here's some text. Here's some text. Here's some text. > Here's some text. > > Here's some text. Here's some text. Here's some text. Here's some text. > Here's some text. Here's some text. > >> Block quote time. Block quote time. Block quote time. Block quote time. > Block quote time. Block quote time. Block quote time. Block quote time. > Block quote time. Block quote time. Block quote time. Block quote time. > Block quote time. Block quote time. Block quote time. Block quote time. > Block quote time. Block quote time. Block quote time. > > Back to the text. Back to the text. Back to the text. Back to the text. > Back to the text. > > Here's some text. Here's some text. Here's some text. Here's some text. > Here's some text. Here's some text. Here's some text. Here's some text. > Here's some text. Here's some text. > ```` > > -- > 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/ba599eb3-3129-4658-9701-b9243d6c793en%40googlegroups.com. ^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2022-03-12 8:53 UTC | newest] Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-10-27 16:28 problem setting style after blocktext in docx output Landon Yarrington [not found] ` <ba599eb3-3129-4658-9701-b9243d6c793en-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 2021-10-27 16:32 ` Landon Yarrington [not found] ` <86c4d6cd-4ea3-41ad-aae9-c301f049a2can-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 2021-10-27 16:38 ` AW: " denis.maier-NSENcxR/0n0 [not found] ` <a1d780a852754aec85dbf01a13456754-NSENcxR/0n0@public.gmane.org> 2021-10-27 16:40 ` denis.maier-NSENcxR/0n0 2021-10-27 16:56 ` Bastien DUMONT 2021-10-27 20:19 ` Landon Yarrington [not found] ` <1b625016-e8cd-4400-9492-fae034e235d8n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 2021-10-27 22:48 ` Bastien DUMONT 2022-03-10 20:44 ` Paul Kelleher [not found] ` <bc83b25d-d676-4582-ba04-830e3f378c2an-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 2022-03-11 7:22 ` BPJ [not found] ` <CADAJKhDFJSM=6eeoNszTwjKczgKPDTzAZZSN1O+jO6C7cCoKCw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2022-03-11 16:20 ` Paul Kelleher [not found] ` <58f80fd9-5017-4ae2-8a86-225d3fa79463n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 2022-03-11 17:14 ` BPJ [not found] ` <CADAJKhBBTXWbvkdARhZTA=eNvmS+48=0wS5_EGb9CCduJVJ4EA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2022-03-11 17:54 ` Paul Kelleher [not found] ` <fd41c606-6011-4bfc-9a6e-33103faaba75n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 2022-03-12 8:53 ` BPJ 2021-10-27 16:47 ` 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).