public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Markdown fenced divs to docx with custom-styles results in unwanted line breaks
@ 2018-08-17  5:33 kronicd
       [not found] ` <a8e624af-f709-46d2-86d3-7e181c0c1cf0-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: kronicd @ 2018-08-17  5:33 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 1340 bytes --]

Hi,

When I attempt to use custom docx styles with a markdown input to a docx 
output I get unwanted linebreaks wherever the custom styles begin or end, 
for example with the input of:

Testing testing


asdasdasd <div custom-style="Techfont">this should be tech font idk</div> 
asdasdasd


<div custom-style="CodeBlock">should</div> be for code block.


<div custom-style="Highlight">like/this</div> means things


Testing testing



and the commandline:

cat test.md| pandoc --reference-doc='Client.docx' --output testabcd.docx

I get the output below:

[image: Screen Shot 2018-08-17 at 1.32.10 pm.png] <about:invalid#zClosurez>



Is there a way to fix this so that the styles appear inline, rather than 
adding an additional line break before and after?


Cheers

-- 
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 post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/a8e624af-f709-46d2-86d3-7e181c0c1cf0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #1.2: Type: text/html, Size: 6169 bytes --]

[-- Attachment #2: Screen Shot 2018-08-17 at 1.32.10 pm.png --]
[-- Type: image/png, Size: 17473 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Markdown fenced divs to docx with custom-styles results in unwanted line breaks
       [not found] ` <a8e624af-f709-46d2-86d3-7e181c0c1cf0-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2018-08-17  6:06   ` Pablo Rodríguez
       [not found]     ` <d87eb425-f249-6983-cf1f-a356fd2c293a-S0/GAf8tV78@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Pablo Rodríguez @ 2018-08-17  6:06 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

On 08/17/2018 07:33 AM, kronicd wrote:
> Hi,
> [...] 
> Is there a way to fix this so that the styles appear inline, rather than
> adding an additional line break before and after?
Use spans (such as `[awa]{.class #id}` in Markdown syntax) instead of
divisions.

Divisions are block elements, so they give you a line before and after.
Spans are for inline elements.

I hope it helps,

Pablo
-- 
http://www.ousia.tk


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Markdown fenced divs to docx with custom-styles results in unwanted line breaks
       [not found]     ` <d87eb425-f249-6983-cf1f-a356fd2c293a-S0/GAf8tV78@public.gmane.org>
@ 2018-08-17  6:30       ` kronicd
       [not found]         ` <d838a232-83f3-46f2-b528-62d206e53fcc-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: kronicd @ 2018-08-17  6:30 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 2865 bytes --]

Thanks for that, I've now updated the input to:

Testing testing


asdasdasd <span custom-style="Techfont">this should be tech font idk</span> 
asdasdasd


<span custom-style="CodeBlock">should</span> be for code block.


<span custom-style="Highlight">like/this</span> means things


Testing testing


The commandline remains

cat test.md| pandoc --reference-doc='Client.docx' --output testabcd.docx

and now my output shows as

[image: Screen Shot 2018-08-17 at 2.22.49 pm.png] <about:invalid#zClosurez>

The output is quite interesting, on further examination it appears that a 
new style has been defined in the office xml, unpacking the docx and 
reviewing styles shows the following:

 <w:style w:customStyle="1" w:styleId="Highlight" w:type="paragraph">
 <w:name w:val="Highlight"/>
 <w:basedOn w:val="Normal"/>
 <w:next w:val="Normal"/>
 <w:link w:val="HighlightChar"/>
 <w:qFormat/>
 <w:rsid w:val="00F3388A"/>
 <w:pPr>
 <w:shd w:color="auto" w:fill="FFFF00" w:val="clear"/>
 </w:pPr>
 </w:style>
 <w:style w:customStyle="1" w:styleId="HighlightChar" w:type="character">
 <w:name w:val="Highlight Char"/>
 <w:basedOn w:val="DefaultParagraphFont"/>
 <w:link w:val="Highlight"/>
 <w:rsid w:val="00F3388A"/>
 <w:rPr>
 <w:rFonts w:ascii="Helvetica Neue Light" w:hAnsi="Helvetica Neue Light"/>
 <w:sz w:val="20"/>
 <w:shd w:color="auto" w:fill="FFFF00" w:val="clear"/>
 </w:rPr>
 </w:style>
... snip ...
 


*<w:style w:customStyle="1" w:styleId="Highlight" 
w:type="character"> <w:name w:val="Highlight"/> <w:basedOn 
w:val="BodyTextChar"/> </w:style>*

The portion in bold above shows new style information which was inserted in 
styles.xml, this was not present within the original reference document. Is 
this a bug or am I misusing a commandline param somewhere?

On Friday, August 17, 2018 at 2:06:36 PM UTC+8, ousia wrote:
>
> On 08/17/2018 07:33 AM, kronicd wrote: 
> > Hi, 
> > [...] 
> > Is there a way to fix this so that the styles appear inline, rather than 
> > adding an additional line break before and after? 
> Use spans (such as `[awa]{.class #id}` in Markdown syntax) instead of 
> divisions. 
>
> Divisions are block elements, so they give you a line before and after. 
> Spans are for inline elements. 
>
> I hope it helps, 
>
> Pablo 
> -- 
> http://www.ousia.tk 
>

-- 
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 post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/d838a232-83f3-46f2-b528-62d206e53fcc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #1.2: Type: text/html, Size: 20232 bytes --]

[-- Attachment #2: Screen Shot 2018-08-17 at 2.22.49 pm.png --]
[-- Type: image/png, Size: 12043 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Markdown fenced divs to docx with custom-styles results in unwanted line breaks
       [not found]         ` <d838a232-83f3-46f2-b528-62d206e53fcc-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2018-08-17  9:43           ` BP Jonsson
       [not found]             ` <CAFC_yuTHVGfPjozBKLbCEV=_9CwfjgP7y9fFWJUwMKFTuo=j9A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: BP Jonsson @ 2018-08-17  9:43 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw


[-- Attachment #1.1: Type: text/plain, Size: 4822 bytes --]

Well that is what `custom-style=NAME` does: it causes the docx writer to
define a new named style — a paragraph style for divs and an character
style for spans — and apply that style to the contents of the div or span.
Initially the definition of the style is no different from the default
paragraph or character style, unless an appropriate style of that name was
already defined in your reference-doc in which case that style is used. You
are supposed to open the docx file Pandoc created in your "word processor"
program (typically Word or LibreOffice) and use its facilities for creating
and modifying named styles to modify the newly created style to suit your
needs. The appearance of text tagged with that style will then change
accordingly. On subsequent Pandoc runs you can use the modified docx file
as your --reference-doc and get the modified style(s) applied automatically
to new docx files.

Den fre 17 aug 2018 08:30kronicd <kronicd-yfZBA/zTPvLR7s880joybQ@public.gmane.org> skrev:

> Thanks for that, I've now updated the input to:
>
> Testing testing
>
>
> asdasdasd <span custom-style="Techfont">this should be tech font idk</span>
> asdasdasd
>
>
> <span custom-style="CodeBlock">should</span> be for code block.
>
>
> <span custom-style="Highlight">like/this</span> means things
>
>
> Testing testing
>
>
> The commandline remains
>
> cat test.md| pandoc --reference-doc='Client.docx' --output testabcd.docx
>
> and now my output shows as
>
> [image: Screen Shot 2018-08-17 at 2.22.49 pm.png]
>
> The output is quite interesting, on further examination it appears that a
> new style has been defined in the office xml, unpacking the docx and
> reviewing styles shows the following:
>
>  <w:style w:customStyle="1" w:styleId="Highlight" w:type="paragraph">
>  <w:name w:val="Highlight"/>
>  <w:basedOn w:val="Normal"/>
>  <w:next w:val="Normal"/>
>  <w:link w:val="HighlightChar"/>
>  <w:qFormat/>
>  <w:rsid w:val="00F3388A"/>
>  <w:pPr>
>  <w:shd w:color="auto" w:fill="FFFF00" w:val="clear"/>
>  </w:pPr>
>  </w:style>
>  <w:style w:customStyle="1" w:styleId="HighlightChar" w:type="character">
>  <w:name w:val="Highlight Char"/>
>  <w:basedOn w:val="DefaultParagraphFont"/>
>  <w:link w:val="Highlight"/>
>  <w:rsid w:val="00F3388A"/>
>  <w:rPr>
>  <w:rFonts w:ascii="Helvetica Neue Light" w:hAnsi="Helvetica Neue Light"/>
>  <w:sz w:val="20"/>
>  <w:shd w:color="auto" w:fill="FFFF00" w:val="clear"/>
>  </w:rPr>
>  </w:style>
> ... snip ...
>
>
>
> *<w:style w:customStyle="1" w:styleId="Highlight"
> w:type="character"> <w:name w:val="Highlight"/> <w:basedOn
> w:val="BodyTextChar"/> </w:style>*
>
> The portion in bold above shows new style information which was inserted
> in styles.xml, this was not present within the original reference document.
> Is this a bug or am I misusing a commandline param somewhere?
>
> On Friday, August 17, 2018 at 2:06:36 PM UTC+8, ousia wrote:
>>
>> On 08/17/2018 07:33 AM, kronicd wrote:
>> > Hi,
>> > [...]
>> > Is there a way to fix this so that the styles appear inline, rather
>> than
>> > adding an additional line break before and after?
>> Use spans (such as `[awa]{.class #id}` in Markdown syntax) instead of
>> divisions.
>>
>> Divisions are block elements, so they give you a line before and after.
>> Spans are for inline elements.
>>
>> I hope it helps,
>>
>> Pablo
>> --
>> http://www.ousia.tk
>>
> --
> 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 post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pandoc-discuss/d838a232-83f3-46f2-b528-62d206e53fcc%40googlegroups.com
> <https://groups.google.com/d/msgid/pandoc-discuss/d838a232-83f3-46f2-b528-62d206e53fcc%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CAFC_yuTHVGfPjozBKLbCEV%3D_9CwfjgP7y9fFWJUwMKFTuo%3Dj9A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #1.2: Type: text/html, Size: 32462 bytes --]

[-- Attachment #2: Screen Shot 2018-08-17 at 2.22.49 pm.png --]
[-- Type: image/png, Size: 12043 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Markdown fenced divs to docx with custom-styles results in unwanted line breaks
       [not found]             ` <CAFC_yuTHVGfPjozBKLbCEV=_9CwfjgP7y9fFWJUwMKFTuo=j9A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2018-08-18  0:38               ` kronicd
       [not found]                 ` <65300c88-5090-4326-9967-507e468f1a0c-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: kronicd @ 2018-08-18  0:38 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 6899 bytes --]

Yes,

I understand what you're saying here. I will try to explain the issue that 
I'm coming up against better here.

When I use the DIV form eg:
<div custom-style="Highlight">like/this</div> means things

The style from the reference doc is used, however when I use the span form:

<span custom-style="Highlight">like/this</span> means things

Pandoc will then define a new style, with a duplicate name, techfont does 
exist in the reference document. So in the reference document the following 
style exists and is retained when DIVs are used:

 <w:style w:customStyle="1" w:styleId="Highlight" w:type="paragraph">
 <w:name w:val="Highlight"/>
 <w:basedOn w:val="Normal"/>
 <w:next w:val="Normal"/>
 <w:link w:val="HighlightChar"/>
 <w:qFormat/>
 <w:rsid w:val="00F3388A"/>
 <w:pPr>
 <w:shd w:color="auto" w:fill="FFFF00" w:val="clear"/>
 </w:pPr>
 </w:style>
 <w:style w:customStyle="1" w:styleId="HighlightChar" w:type="character">
 <w:name w:val="Highlight Char"/>
 <w:basedOn w:val="DefaultParagraphFont"/>
 <w:link w:val="Highlight"/>
 <w:rsid w:val="00F3388A"/>
 <w:rPr>
 <w:rFonts w:ascii="Helvetica Neue Light" w:hAnsi="Helvetica Neue Light"/>
 <w:sz w:val="20"/>
 <w:shd w:color="auto" w:fill="FFFF00" w:val="clear"/>
 </w:rPr>
 </w:style>


However, when I use span elements in the source document, the following is 
added to the styles of the output document:

 <w:style w:customStyle="1" w:styleId="Highlight" w:type="character">
 <w:name w:val="Highlight"/>
 <w:basedOn w:val="BodyTextChar"/>
 </w:style>


So in the output document, the "Highlight" style exists multiples times 
when I use span tags rather than div tags, as a result the originally 
defined style in the reference document ends up being overridden.

Is this a bug or intended behaviour?

Cheers

On Friday, August 17, 2018 at 5:44:12 PM UTC+8, BP Jonsson wrote:
>
> Well that is what `custom-style=NAME` does: it causes the docx writer to 
> define a new named style — a paragraph style for divs and an character 
> style for spans — and apply that style to the contents of the div or span. 
> Initially the definition of the style is no different from the default 
> paragraph or character style, unless an appropriate style of that name was 
> already defined in your reference-doc in which case that style is used. You 
> are supposed to open the docx file Pandoc created in your "word processor" 
> program (typically Word or LibreOffice) and use its facilities for creating 
> and modifying named styles to modify the newly created style to suit your 
> needs. The appearance of text tagged with that style will then change 
> accordingly. On subsequent Pandoc runs you can use the modified docx file 
> as your --reference-doc and get the modified style(s) applied automatically 
> to new docx files.
>
> Den fre 17 aug 2018 08:30kronicd <kro...-yfZBA/zTPvLR7s880joybQ@public.gmane.org <javascript:>> skrev:
>
>> Thanks for that, I've now updated the input to:
>>
>> Testing testing
>>
>>
>> asdasdasd <span custom-style="Techfont">this should be tech font idk</span> 
>> asdasdasd
>>
>>
>> <span custom-style="CodeBlock">should</span> be for code block.
>>
>>
>> <span custom-style="Highlight">like/this</span> means things
>>
>>
>> Testing testing
>>
>>
>> The commandline remains
>>
>> cat test.md| pandoc --reference-doc='Client.docx' --output testabcd.docx
>>
>> and now my output shows as
>>
>> [image: Screen Shot 2018-08-17 at 2.22.49 pm.png]
>>
>> The output is quite interesting, on further examination it appears that a 
>> new style has been defined in the office xml, unpacking the docx and 
>> reviewing styles shows the following:
>>
>>  <w:style w:customStyle="1" w:styleId="Highlight" w:type="paragraph">
>>  <w:name w:val="Highlight"/>
>>  <w:basedOn w:val="Normal"/>
>>  <w:next w:val="Normal"/>
>>  <w:link w:val="HighlightChar"/>
>>  <w:qFormat/>
>>  <w:rsid w:val="00F3388A"/>
>>  <w:pPr>
>>  <w:shd w:color="auto" w:fill="FFFF00" w:val="clear"/>
>>  </w:pPr>
>>  </w:style>
>>  <w:style w:customStyle="1" w:styleId="HighlightChar" w:type="character">
>>  <w:name w:val="Highlight Char"/>
>>  <w:basedOn w:val="DefaultParagraphFont"/>
>>  <w:link w:val="Highlight"/>
>>  <w:rsid w:val="00F3388A"/>
>>  <w:rPr>
>>  <w:rFonts w:ascii="Helvetica Neue Light" w:hAnsi="Helvetica Neue Light"
>> />
>>  <w:sz w:val="20"/>
>>  <w:shd w:color="auto" w:fill="FFFF00" w:val="clear"/>
>>  </w:rPr>
>>  </w:style>
>> ... snip ...
>>  
>>
>>
>> *<w:style w:customStyle="1" w:styleId="Highlight" 
>> w:type="character"> <w:name w:val="Highlight"/> <w:basedOn 
>> w:val="BodyTextChar"/> </w:style>*
>>
>> The portion in bold above shows new style information which was inserted 
>> in styles.xml, this was not present within the original reference document. 
>> Is this a bug or am I misusing a commandline param somewhere?
>>
>> On Friday, August 17, 2018 at 2:06:36 PM UTC+8, ousia wrote:
>>>
>>> On 08/17/2018 07:33 AM, kronicd wrote: 
>>> > Hi, 
>>> > [...] 
>>> > Is there a way to fix this so that the styles appear inline, rather 
>>> than 
>>> > adding an additional line break before and after? 
>>> Use spans (such as `[awa]{.class #id}` in Markdown syntax) instead of 
>>> divisions. 
>>>
>>> Divisions are block elements, so they give you a line before and after. 
>>> Spans are for inline elements. 
>>>
>>> I hope it helps, 
>>>
>>> Pablo 
>>> -- 
>>> http://www.ousia.tk 
>>>
>> -- 
>> 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...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <javascript:>.
>> To post to this group, send email to pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org 
>> <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/pandoc-discuss/d838a232-83f3-46f2-b528-62d206e53fcc%40googlegroups.com 
>> <https://groups.google.com/d/msgid/pandoc-discuss/d838a232-83f3-46f2-b528-62d206e53fcc%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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 post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/65300c88-5090-4326-9967-507e468f1a0c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #1.2: Type: text/html, Size: 31687 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Markdown fenced divs to docx with custom-styles results in unwanted line breaks
       [not found]                 ` <65300c88-5090-4326-9967-507e468f1a0c-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2018-08-18  2:18                   ` kronicd
  2018-08-18 11:30                   ` BP Jonsson
  1 sibling, 0 replies; 7+ messages in thread
From: kronicd @ 2018-08-18  2:18 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 7299 bytes --]

I've filed an issue here: https://github.com/jgm/pandoc/issues/4843

Example files and details to replicate the issue are included.

On Saturday, August 18, 2018 at 8:38:07 AM UTC+8, kronicd wrote:
>
> Yes,
>
> I understand what you're saying here. I will try to explain the issue that 
> I'm coming up against better here.
>
> When I use the DIV form eg:
> <div custom-style="Highlight">like/this</div> means things
>
> The style from the reference doc is used, however when I use the span form:
>
> <span custom-style="Highlight">like/this</span> means things
>
> Pandoc will then define a new style, with a duplicate name, techfont does 
> exist in the reference document. So in the reference document the following 
> style exists and is retained when DIVs are used:
>
>  <w:style w:customStyle="1" w:styleId="Highlight" w:type="paragraph">
>  <w:name w:val="Highlight"/>
>  <w:basedOn w:val="Normal"/>
>  <w:next w:val="Normal"/>
>  <w:link w:val="HighlightChar"/>
>  <w:qFormat/>
>  <w:rsid w:val="00F3388A"/>
>  <w:pPr>
>  <w:shd w:color="auto" w:fill="FFFF00" w:val="clear"/>
>  </w:pPr>
>  </w:style>
>  <w:style w:customStyle="1" w:styleId="HighlightChar" w:type="character">
>  <w:name w:val="Highlight Char"/>
>  <w:basedOn w:val="DefaultParagraphFont"/>
>  <w:link w:val="Highlight"/>
>  <w:rsid w:val="00F3388A"/>
>  <w:rPr>
>  <w:rFonts w:ascii="Helvetica Neue Light" w:hAnsi="Helvetica Neue Light"/>
>  <w:sz w:val="20"/>
>  <w:shd w:color="auto" w:fill="FFFF00" w:val="clear"/>
>  </w:rPr>
>  </w:style>
>
>
> However, when I use span elements in the source document, the following is 
> added to the styles of the output document:
>
>  <w:style w:customStyle="1" w:styleId="Highlight" w:type="character">
>  <w:name w:val="Highlight"/>
>  <w:basedOn w:val="BodyTextChar"/>
>  </w:style>
>
>
> So in the output document, the "Highlight" style exists multiples times 
> when I use span tags rather than div tags, as a result the originally 
> defined style in the reference document ends up being overridden.
>
> Is this a bug or intended behaviour?
>
> Cheers
>
> On Friday, August 17, 2018 at 5:44:12 PM UTC+8, BP Jonsson wrote:
>>
>> Well that is what `custom-style=NAME` does: it causes the docx writer to 
>> define a new named style — a paragraph style for divs and an character 
>> style for spans — and apply that style to the contents of the div or span. 
>> Initially the definition of the style is no different from the default 
>> paragraph or character style, unless an appropriate style of that name was 
>> already defined in your reference-doc in which case that style is used. You 
>> are supposed to open the docx file Pandoc created in your "word processor" 
>> program (typically Word or LibreOffice) and use its facilities for creating 
>> and modifying named styles to modify the newly created style to suit your 
>> needs. The appearance of text tagged with that style will then change 
>> accordingly. On subsequent Pandoc runs you can use the modified docx file 
>> as your --reference-doc and get the modified style(s) applied automatically 
>> to new docx files.
>>
>> Den fre 17 aug 2018 08:30kronicd <kro...-yfZBA/zTPvLR7s880joybQ@public.gmane.org> skrev:
>>
>>> Thanks for that, I've now updated the input to:
>>>
>>> Testing testing
>>>
>>>
>>> asdasdasd <span custom-style="Techfont">this should be tech font idk</span> 
>>> asdasdasd
>>>
>>>
>>> <span custom-style="CodeBlock">should</span> be for code block.
>>>
>>>
>>> <span custom-style="Highlight">like/this</span> means things
>>>
>>>
>>> Testing testing
>>>
>>>
>>> The commandline remains
>>>
>>> cat test.md| pandoc --reference-doc='Client.docx' --output testabcd.docx
>>>
>>> and now my output shows as
>>>
>>> [image: Screen Shot 2018-08-17 at 2.22.49 pm.png]
>>>
>>> The output is quite interesting, on further examination it appears that 
>>> a new style has been defined in the office xml, unpacking the docx and 
>>> reviewing styles shows the following:
>>>
>>>  <w:style w:customStyle="1" w:styleId="Highlight" w:type="paragraph">
>>>  <w:name w:val="Highlight"/>
>>>  <w:basedOn w:val="Normal"/>
>>>  <w:next w:val="Normal"/>
>>>  <w:link w:val="HighlightChar"/>
>>>  <w:qFormat/>
>>>  <w:rsid w:val="00F3388A"/>
>>>  <w:pPr>
>>>  <w:shd w:color="auto" w:fill="FFFF00" w:val="clear"/>
>>>  </w:pPr>
>>>  </w:style>
>>>  <w:style w:customStyle="1" w:styleId="HighlightChar" w:type="character"
>>> >
>>>  <w:name w:val="Highlight Char"/>
>>>  <w:basedOn w:val="DefaultParagraphFont"/>
>>>  <w:link w:val="Highlight"/>
>>>  <w:rsid w:val="00F3388A"/>
>>>  <w:rPr>
>>>  <w:rFonts w:ascii="Helvetica Neue Light" w:hAnsi="Helvetica Neue Light"
>>> />
>>>  <w:sz w:val="20"/>
>>>  <w:shd w:color="auto" w:fill="FFFF00" w:val="clear"/>
>>>  </w:rPr>
>>>  </w:style>
>>> ... snip ...
>>>  
>>>
>>>
>>> *<w:style w:customStyle="1" w:styleId="Highlight" 
>>> w:type="character"> <w:name w:val="Highlight"/> <w:basedOn 
>>> w:val="BodyTextChar"/> </w:style>*
>>>
>>> The portion in bold above shows new style information which was inserted 
>>> in styles.xml, this was not present within the original reference document. 
>>> Is this a bug or am I misusing a commandline param somewhere?
>>>
>>> On Friday, August 17, 2018 at 2:06:36 PM UTC+8, ousia wrote:
>>>>
>>>> On 08/17/2018 07:33 AM, kronicd wrote: 
>>>> > Hi, 
>>>> > [...] 
>>>> > Is there a way to fix this so that the styles appear inline, rather 
>>>> than 
>>>> > adding an additional line break before and after? 
>>>> Use spans (such as `[awa]{.class #id}` in Markdown syntax) instead of 
>>>> divisions. 
>>>>
>>>> Divisions are block elements, so they give you a line before and after. 
>>>> Spans are for inline elements. 
>>>>
>>>> I hope it helps, 
>>>>
>>>> Pablo 
>>>> -- 
>>>> http://www.ousia.tk 
>>>>
>>> -- 
>>> 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 post to this group, send email to pandoc-...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/pandoc-discuss/d838a232-83f3-46f2-b528-62d206e53fcc%40googlegroups.com 
>>> <https://groups.google.com/d/msgid/pandoc-discuss/d838a232-83f3-46f2-b528-62d206e53fcc%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>

-- 
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 post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/82852739-6613-4fe1-a502-2445e1ebaf28%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #1.2: Type: text/html, Size: 25705 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Markdown fenced divs to docx with custom-styles results in unwanted line breaks
       [not found]                 ` <65300c88-5090-4326-9967-507e468f1a0c-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  2018-08-18  2:18                   ` kronicd
@ 2018-08-18 11:30                   ` BP Jonsson
  1 sibling, 0 replies; 7+ messages in thread
From: BP Jonsson @ 2018-08-18 11:30 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

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

From what you are saying it sounds like you have only defined a paragraph
style. Paragraph styles and character styles are different entities and you
have to define one of each. In a way this doesn't make sense: one might
expect that one could apply the character related properties of a paragraph
style to a character run but you can't, they are totally distinct. However
it seems like at least LibreOffice sometimes has problems when a paragraph
style and a character style have the same name. I usually let the names of
my paragraph styles end in "Block" or "Para" when there is a risk of
conflict. BTW if you define your style names without any whitespace in them
you can omit the quotes around the `custom-style` attribute value in your
Markdown source.

Den lör 18 aug 2018 02:38kronicd <kronicd-yfZBA/zTPvLR7s880joybQ@public.gmane.org> skrev:

> Yes,
>
> I understand what you're saying here. I will try to explain the issue that
> I'm coming up against better here.
>
> When I use the DIV form eg:
> <div custom-style="Highlight">like/this</div> means things
>
> The style from the reference doc is used, however when I use the span form:
>
> <span custom-style="Highlight">like/this</span> means things
>
> Pandoc will then define a new style, with a duplicate name, techfont does
> exist in the reference document. So in the reference document the following
> style exists and is retained when DIVs are used:
>
>  <w:style w:customStyle="1" w:styleId="Highlight" w:type="paragraph">
>  <w:name w:val="Highlight"/>
>  <w:basedOn w:val="Normal"/>
>  <w:next w:val="Normal"/>
>  <w:link w:val="HighlightChar"/>
>  <w:qFormat/>
>  <w:rsid w:val="00F3388A"/>
>  <w:pPr>
>  <w:shd w:color="auto" w:fill="FFFF00" w:val="clear"/>
>  </w:pPr>
>  </w:style>
>  <w:style w:customStyle="1" w:styleId="HighlightChar" w:type="character">
>  <w:name w:val="Highlight Char"/>
>  <w:basedOn w:val="DefaultParagraphFont"/>
>  <w:link w:val="Highlight"/>
>  <w:rsid w:val="00F3388A"/>
>  <w:rPr>
>  <w:rFonts w:ascii="Helvetica Neue Light" w:hAnsi="Helvetica Neue Light"/>
>  <w:sz w:val="20"/>
>  <w:shd w:color="auto" w:fill="FFFF00" w:val="clear"/>
>  </w:rPr>
>  </w:style>
>
>
> However, when I use span elements in the source document, the following is
> added to the styles of the output document:
>
>  <w:style w:customStyle="1" w:styleId="Highlight" w:type="character">
>  <w:name w:val="Highlight"/>
>  <w:basedOn w:val="BodyTextChar"/>
>  </w:style>
>
>
> So in the output document, the "Highlight" style exists multiples times
> when I use span tags rather than div tags, as a result the originally
> defined style in the reference document ends up being overridden.
>
> Is this a bug or intended behaviour?
>
> Cheers
>
> On Friday, August 17, 2018 at 5:44:12 PM UTC+8, BP Jonsson wrote:
>>
>> Well that is what `custom-style=NAME` does: it causes the docx writer to
>> define a new named style — a paragraph style for divs and an character
>> style for spans — and apply that style to the contents of the div or span.
>> Initially the definition of the style is no different from the default
>> paragraph or character style, unless an appropriate style of that name was
>> already defined in your reference-doc in which case that style is used. You
>> are supposed to open the docx file Pandoc created in your "word processor"
>> program (typically Word or LibreOffice) and use its facilities for creating
>> and modifying named styles to modify the newly created style to suit your
>> needs. The appearance of text tagged with that style will then change
>> accordingly. On subsequent Pandoc runs you can use the modified docx file
>> as your --reference-doc and get the modified style(s) applied automatically
>> to new docx files.
>>
>> Den fre 17 aug 2018 08:30kronicd <kro...-yfZBA/zTPvLR7s880joybQ@public.gmane.org> skrev:
>>
>>> Thanks for that, I've now updated the input to:
>>>
>>> Testing testing
>>>
>>>
>>> asdasdasd <span custom-style="Techfont">this should be tech font idk</span>
>>> asdasdasd
>>>
>>>
>>> <span custom-style="CodeBlock">should</span> be for code block.
>>>
>>>
>>> <span custom-style="Highlight">like/this</span> means things
>>>
>>>
>>> Testing testing
>>>
>>>
>>> The commandline remains
>>>
>>> cat test.md| pandoc --reference-doc='Client.docx' --output testabcd.docx
>>>
>>> and now my output shows as
>>>
>>> [image: Screen Shot 2018-08-17 at 2.22.49 pm.png]
>>>
>>> The output is quite interesting, on further examination it appears that
>>> a new style has been defined in the office xml, unpacking the docx and
>>> reviewing styles shows the following:
>>>
>>>  <w:style w:customStyle="1" w:styleId="Highlight" w:type="paragraph">
>>>  <w:name w:val="Highlight"/>
>>>  <w:basedOn w:val="Normal"/>
>>>  <w:next w:val="Normal"/>
>>>  <w:link w:val="HighlightChar"/>
>>>  <w:qFormat/>
>>>  <w:rsid w:val="00F3388A"/>
>>>  <w:pPr>
>>>  <w:shd w:color="auto" w:fill="FFFF00" w:val="clear"/>
>>>  </w:pPr>
>>>  </w:style>
>>>  <w:style w:customStyle="1" w:styleId="HighlightChar" w:type="character"
>>> >
>>>  <w:name w:val="Highlight Char"/>
>>>  <w:basedOn w:val="DefaultParagraphFont"/>
>>>  <w:link w:val="Highlight"/>
>>>  <w:rsid w:val="00F3388A"/>
>>>  <w:rPr>
>>>  <w:rFonts w:ascii="Helvetica Neue Light" w:hAnsi="Helvetica Neue Light"
>>> />
>>>  <w:sz w:val="20"/>
>>>  <w:shd w:color="auto" w:fill="FFFF00" w:val="clear"/>
>>>  </w:rPr>
>>>  </w:style>
>>> ... snip ...
>>>
>>>
>>>
>>> *<w:style w:customStyle="1" w:styleId="Highlight"
>>> w:type="character"> <w:name w:val="Highlight"/> <w:basedOn
>>> w:val="BodyTextChar"/> </w:style>*
>>>
>>> The portion in bold above shows new style information which was inserted
>>> in styles.xml, this was not present within the original reference document.
>>> Is this a bug or am I misusing a commandline param somewhere?
>>>
>>> On Friday, August 17, 2018 at 2:06:36 PM UTC+8, ousia wrote:
>>>>
>>>> On 08/17/2018 07:33 AM, kronicd wrote:
>>>> > Hi,
>>>> > [...]
>>>> > Is there a way to fix this so that the styles appear inline, rather
>>>> than
>>>> > adding an additional line break before and after?
>>>> Use spans (such as `[awa]{.class #id}` in Markdown syntax) instead of
>>>> divisions.
>>>>
>>>> Divisions are block elements, so they give you a line before and after.
>>>> Spans are for inline elements.
>>>>
>>>> I hope it helps,
>>>>
>>>> Pablo
>>>> --
>>>> http://www.ousia.tk
>>>>
>>> --
>>> 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 post to this group, send email to pandoc-...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/pandoc-discuss/d838a232-83f3-46f2-b528-62d206e53fcc%40googlegroups.com
>>> <https://groups.google.com/d/msgid/pandoc-discuss/d838a232-83f3-46f2-b528-62d206e53fcc%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
> 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 post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pandoc-discuss/65300c88-5090-4326-9967-507e468f1a0c%40googlegroups.com
> <https://groups.google.com/d/msgid/pandoc-discuss/65300c88-5090-4326-9967-507e468f1a0c%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CAFC_yuTJPWbdRPn0Z1A-ZS2dWzCsJKp_-OgCZyPY-SBf2g_%2Buw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-08-18 11:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-17  5:33 Markdown fenced divs to docx with custom-styles results in unwanted line breaks kronicd
     [not found] ` <a8e624af-f709-46d2-86d3-7e181c0c1cf0-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2018-08-17  6:06   ` Pablo Rodríguez
     [not found]     ` <d87eb425-f249-6983-cf1f-a356fd2c293a-S0/GAf8tV78@public.gmane.org>
2018-08-17  6:30       ` kronicd
     [not found]         ` <d838a232-83f3-46f2-b528-62d206e53fcc-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2018-08-17  9:43           ` BP Jonsson
     [not found]             ` <CAFC_yuTHVGfPjozBKLbCEV=_9CwfjgP7y9fFWJUwMKFTuo=j9A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-08-18  0:38               ` kronicd
     [not found]                 ` <65300c88-5090-4326-9967-507e468f1a0c-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2018-08-18  2:18                   ` kronicd
2018-08-18 11:30                   ` BP Jonsson

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).