public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Image references in a column break after one character
@ 2022-10-23 10:25 Jan Stühler
       [not found] ` <22b620a8-4869-4cd8-b040-a4c55d0ae521n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Stühler @ 2022-10-23 10:25 UTC (permalink / raw)
  To: pandoc-discuss


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

Hello group.

I have been using
```
pandoc --reference-links --extract-media=dir -o file.md file.docx
```
on a set of documents, each of those documents has many tables. Especially 
those tables which have "only" images in the right column,  pandoc will 
break the image reference after one character. The image references can 
therefore not be found when converting the document back to docx.

```

+------------------------+---+------------------------------------------+

| If the Home Screen is  | ! |                                          |

| locked, the            | [ |                                          |

| Examination button is  | ] |                                          |

| dimmed. Please first   | [ |                                          |

| click on Unlock and    | 4 |                                          |

| then click on          | 8 |                                          |

| Examination,           | ] |                                          |

+========================+===+==========================================+
```
I do not have that problem when passing `--wrap=none` to markdown, but then 
all the lines in vim are unmanageably long.

`wrap=preserver|auto|none` with or without `--columns=x`  does not resolve 
the one-character breaking issue.

Also, converting to `-t gfm` first and then converting `-f gfm -t markdown` 
still creates one-character line breaks.

Is there any way to define a minimum column width?

-- 
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/22b620a8-4869-4cd8-b040-a4c55d0ae521n%40googlegroups.com.

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

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

* Re: Image references in a column break after one character
       [not found] ` <22b620a8-4869-4cd8-b040-a4c55d0ae521n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2022-10-24  4:12   ` John MacFarlane
       [not found]     ` <9B3E6EF5-B9D2-47AF-BF28-DC2F06E54D55-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: John MacFarlane @ 2022-10-24  4:12 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

Pandoc tries to preserve the relative column widths in the original table.  If you have  table with a very narrow second column, pandoc will reproduce that in a grid table (since the colmun widths in this format matter).

One possible workaround would be to use a Lua filter to adjsut the column widths of Table elements after they are parsed.

Another would be to alter the column widths of the source table.



> On Oct 23, 2022, at 3:25 AM, Jan Stühler <jan.stuehler-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> 
> Hello group.
> 
> I have been using
> ```
> pandoc --reference-links --extract-media=dir -o file.md file.docx
> ```
> on a set of documents, each of those documents has many tables. Especially those tables which have "only" images in the right column,  pandoc will break the image reference after one character. The image references can therefore not be found when converting the document back to docx.
> 
> ```
> +------------------------+---+------------------------------------------+
> 
> | If the Home Screen is  | ! |                                          |
> 
> | locked, the            | [ |                                          |
> 
> | Examination button is  | ] |                                          |
> 
> | dimmed. Please first   | [ |                                          |
> 
> | click on Unlock and    | 4 |                                          |
> 
> | then click on          | 8 |                                          |
> 
> | Examination,           | ] |                                          |
> 
> +========================+===+==========================================+
> 
> ```
> I do not have that problem when passing `--wrap=none` to markdown, but then all the lines in vim are unmanageably long.
> 
> `wrap=preserver|auto|none` with or without `--columns=x`  does not resolve the one-character breaking issue.
> 
> Also, converting to `-t gfm` first and then converting `-f gfm -t markdown` still creates one-character line breaks.
> 
> Is there any way to define a minimum column width?
> 
> -- 
> 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/22b620a8-4869-4cd8-b040-a4c55d0ae521n%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/9B3E6EF5-B9D2-47AF-BF28-DC2F06E54D55%40gmail.com.


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

* Re: Image references in a column break after one character
       [not found]     ` <9B3E6EF5-B9D2-47AF-BF28-DC2F06E54D55-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2022-10-29 21:40       ` Jan Stühler
       [not found]         ` <ae1809d9-1873-4a18-abcd-8e76a7f38bf9n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Stühler @ 2022-10-29 21:40 UTC (permalink / raw)
  To: pandoc-discuss


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

Thank you very much, fiddlosopher. I'll try with a lua filter which sets 
all column width to an equal size:
```lua
function myfunction(el)
    -- divide 1 by number of columns
    -- subtract some spacing
    equalwidth = (1 / #el.colspecs) - 0.01
    -- print(equalwidth)
    -- walk through colspecs
    for idx, _ in ipairs(el.colspecs) do
        -- set width per column
        table.insert(el.colspecs[idx], equalwidth)
    end
    -- return Table element
    return el
end

return {{ Table = myfunction }}
```

fiddlosopher schrieb am Montag, 24. Oktober 2022 um 06:12:47 UTC+2:

> Pandoc tries to preserve the relative column widths in the original table. 
> If you have table with a very narrow second column, pandoc will reproduce 
> that in a grid table (since the colmun widths in this format matter).
>
> One possible workaround would be to use a Lua filter to adjsut the column 
> widths of Table elements after they are parsed.
>
> Another would be to alter the column widths of the source table.
>
>
>
> > On Oct 23, 2022, at 3:25 AM, Jan Stühler <jan.st...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> > 
> > Hello group.
> > 
> > I have been using
> > ```
> > pandoc --reference-links --extract-media=dir -o file.md file.docx
> > ```
> > on a set of documents, each of those documents has many tables. 
> Especially those tables which have "only" images in the right column, 
> pandoc will break the image reference after one character. The image 
> references can therefore not be found when converting the document back to 
> docx.
> > 
> > ```
> > +------------------------+---+------------------------------------------+
> > 
> > | If the Home Screen is | ! | |
> > 
> > | locked, the | [ | |
> > 
> > | Examination button is | ] | |
> > 
> > | dimmed. Please first | [ | |
> > 
> > | click on Unlock and | 4 | |
> > 
> > | then click on | 8 | |
> > 
> > | Examination, | ] | |
> > 
> > +========================+===+==========================================+
> > 
> > ```
> > I do not have that problem when passing `--wrap=none` to markdown, but 
> then all the lines in vim are unmanageably long.
> > 
> > `wrap=preserver|auto|none` with or without `--columns=x` does not 
> resolve the one-character breaking issue.
> > 
> > Also, converting to `-t gfm` first and then converting `-f gfm -t 
> markdown` still creates one-character line breaks.
> > 
> > Is there any way to define a minimum column width?
> > 
> > -- 
> > 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/22b620a8-4869-4cd8-b040-a4c55d0ae521n%40googlegroups.com
> .
>
>

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/ae1809d9-1873-4a18-abcd-8e76a7f38bf9n%40googlegroups.com.

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

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

* Re: Image references in a column break after one character
       [not found]         ` <ae1809d9-1873-4a18-abcd-8e76a7f38bf9n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2022-10-29 22:22           ` Jan Stühler
  0 siblings, 0 replies; 4+ messages in thread
From: Jan Stühler @ 2022-10-29 22:22 UTC (permalink / raw)
  To: pandoc-discuss


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

Small correction. First attempt was with a table which did not have a width 
at all.
Here is the version which will add or replace the width.

```lua
function myfunction(el)
    equalwidth = (1 / #el.colspecs) - 0.01
    for idx, csp in ipairs(el.colspecs) do
        csp[2] = equalwidth
    end
    return el
end

return {{ Table = myfunction }}
```

Jan Stühler schrieb am Samstag, 29. Oktober 2022 um 23:40:16 UTC+2:

> Thank you very much, fiddlosopher. I'll try with a lua filter which sets 
> all column width to an equal size:
> ```lua
> function myfunction(el)
>     -- divide 1 by number of columns
>     -- subtract some spacing
>     equalwidth = (1 / #el.colspecs) - 0.01
>     -- print(equalwidth)
>     -- walk through colspecs
>     for idx, _ in ipairs(el.colspecs) do
>         -- set width per column
>         table.insert(el.colspecs[idx], equalwidth)
>     end
>     -- return Table element
>     return el
> end
>
> return {{ Table = myfunction }}
> ```
>
> fiddlosopher schrieb am Montag, 24. Oktober 2022 um 06:12:47 UTC+2:
>
>> Pandoc tries to preserve the relative column widths in the original 
>> table. If you have table with a very narrow second column, pandoc will 
>> reproduce that in a grid table (since the colmun widths in this format 
>> matter). 
>>
>> One possible workaround would be to use a Lua filter to adjsut the column 
>> widths of Table elements after they are parsed. 
>>
>> Another would be to alter the column widths of the source table. 
>>
>>
>>
>> > On Oct 23, 2022, at 3:25 AM, Jan Stühler <jan.st...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: 
>> > 
>> > Hello group. 
>> > 
>> > I have been using 
>> > ``` 
>> > pandoc --reference-links --extract-media=dir -o file.md file.docx 
>> > ``` 
>> > on a set of documents, each of those documents has many tables. 
>> Especially those tables which have "only" images in the right column, 
>> pandoc will break the image reference after one character. The image 
>> references can therefore not be found when converting the document back to 
>> docx. 
>> > 
>> > ``` 
>> > 
>> +------------------------+---+------------------------------------------+ 
>> > 
>> > | If the Home Screen is | ! | | 
>> > 
>> > | locked, the | [ | | 
>> > 
>> > | Examination button is | ] | | 
>> > 
>> > | dimmed. Please first | [ | | 
>> > 
>> > | click on Unlock and | 4 | | 
>> > 
>> > | then click on | 8 | | 
>> > 
>> > | Examination, | ] | | 
>> > 
>> > 
>> +========================+===+==========================================+ 
>> > 
>> > ``` 
>> > I do not have that problem when passing `--wrap=none` to markdown, but 
>> then all the lines in vim are unmanageably long. 
>> > 
>> > `wrap=preserver|auto|none` with or without `--columns=x` does not 
>> resolve the one-character breaking issue. 
>> > 
>> > Also, converting to `-t gfm` first and then converting `-f gfm -t 
>> markdown` still creates one-character line breaks. 
>> > 
>> > Is there any way to define a minimum column width? 
>> > 
>> > -- 
>> > 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/22b620a8-4869-4cd8-b040-a4c55d0ae521n%40googlegroups.com. 
>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/1a3dd1bd-360d-4cf8-b85c-3aef12e12886n%40googlegroups.com.

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

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

end of thread, other threads:[~2022-10-29 22:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-23 10:25 Image references in a column break after one character Jan Stühler
     [not found] ` <22b620a8-4869-4cd8-b040-a4c55d0ae521n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2022-10-24  4:12   ` John MacFarlane
     [not found]     ` <9B3E6EF5-B9D2-47AF-BF28-DC2F06E54D55-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2022-10-29 21:40       ` Jan Stühler
     [not found]         ` <ae1809d9-1873-4a18-abcd-8e76a7f38bf9n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2022-10-29 22:22           ` Jan Stühler

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