From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/31668 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Jan_St=C3=BChler?= Newsgroups: gmane.text.pandoc Subject: Re: Image references in a column break after one character Date: Sat, 29 Oct 2022 15:22:37 -0700 (PDT) Message-ID: <1a3dd1bd-360d-4cf8-b85c-3aef12e12886n@googlegroups.com> References: <22b620a8-4869-4cd8-b040-a4c55d0ae521n@googlegroups.com> <9B3E6EF5-B9D2-47AF-BF28-DC2F06E54D55@gmail.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_5500_1433003058.1667082157584" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33495"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBDXJPMHQZ4FRBLWP62NAMGQEWBQYQDA-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Sun Oct 30 00:22:42 2022 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-ot1-f64.google.com ([209.85.210.64]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oouDy-0008Uz-5C for gtp-pandoc-discuss@m.gmane-mx.org; Sun, 30 Oct 2022 00:22:42 +0200 Original-Received: by mail-ot1-f64.google.com with SMTP id c29-20020a056830349d00b0066c09ab34desf4256486otu.21 for ; Sat, 29 Oct 2022 15:22:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:x-original-sender :mime-version:subject:references:in-reply-to:message-id:to:from:date :sender:from:to:cc:subject:date:message-id:reply-to; bh=quTLcRh1f5pFh6MF3CMFxBRlnZh/XwK3NSTLdZqsLpA=; b=nBjfk+76dT3Sqxcvhc1uC3QC8yOqhqqXypz+a02a7YRIAstCAGNPoR4C+DhzEh3ECM CECKpiKCvFCAz5NtQlRlSJfsiQT+zzjw3/Q5Xx6vXcAs3midsfJf49EmdFL4sVgzXXR+ DRULRpjO6Vvrhu7WkEA6xXz1xXNPeQADIhYlvKitmvf0wqZbqRHy0N+lcqfs7eIoHjpw AVxedn7NgTdhS/etFPIEpiSgcxHhHUibyZ7pUy7CUGj8BLcubIO6LKESLqBA2ZZKJa92 Ucw8ArZ0dEMgwIICHLW5cWzGK92DK93lCH8dDWMzwW+Ypa0cieiafSZ6XwKvfvlSHoeX NeSQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:x-original-sender :mime-version:subject:references:in-reply-to:message-id:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=quTLcRh1f5pFh6MF3CMFxBRlnZh/XwK3NSTLdZqsLpA=; b=ZPXA9EfLGMBZtNHl2uCtqXSM5Yt3hcFFGQ5L5pBkF0w2Zq7VZ/I7wFZ/I8Q/MK5B6h X+WI01e5UmqJvNmADH3va/YF+QKADaAYuc+NCvuOhTd20IApDM/uYdWQybDSmXzzfbcM eIyzsUEzqVKHcUEdWgnEJ8oyjBTB5QqIyhJ+8Am4xwjxqGNTCkQE84SU6Y2uqp8Y1HNL QuMjr96sWqvAeEbuMJF4pgdxENORExS9QILevgPUR23tZ5BdKp5fFzYL8sWQUifs0WYE DQpj1hx6CR3tXNdO383YEV/TfhUXYgOv8LvPyvlPMagqthszVx2FrwxyUMgEa9+rPhIY ppow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence:reply-to :x-original-sender:mime-version:subject:references:in-reply-to :message-id:to:from:date:x-gm-message-state:sender:from:to:cc :subject:date:message-id:reply-to; bh=quTLcRh1f5pFh6MF3CMFxBRlnZh/XwK3NSTLdZqsLpA=; b=lV6fVMk7KrsxvIspdOpv0L9dNQrnmYWqHC6SyxCWLUkFAWYV5al6exdA72PcIN4fVq A2GNyfCZi7rIV7pgsTpjDXo43DldXPmUqbbrB7KdDzsRxYrAKGaT28MP+g27aX0lnPix ZLlf1UIPO+bJOcQH3NDRWzbNrwbmeXzWYSg0peOtaH/6P05oFkWSdVm1H9GK0KQF0a9x TQP0GvJuKVj5yETdVrc+RJikbmEq4UW/m4MafJ/QPpbkXr6KKk2TIdso9ER2rehF9JKn jr6ZfdEr1ExFKAJtOLBB63imrw5DxGAaGgk83mWvyAD+hBGsAozXsC0KF7cCJAn4DCy8 LlbQ== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: ACrzQf0V7DcNJ6ko0+7JnGq6EfcjCprQO5i2iqOyrHmWeYsJsrN3Bq6U f1qm2kVW631G833au4AHBKs= X-Google-Smtp-Source: AMsMyM5uJ12fuJ6LWzT3Z7E3XFGFTNmv3d5KWkJxogf57F42nqalNISWJC5IzDiZTqlokZFoqpElxw== X-Received: by 2002:a05:6870:d10e:b0:13c:50b8:6fdd with SMTP id e14-20020a056870d10e00b0013c50b86fddmr9294076oac.200.1667082161009; Sat, 29 Oct 2022 15:22:41 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:6808:138f:b0:34f:7989:33d with SMTP id c15-20020a056808138f00b0034f7989033dls1750735oiw.6.-pod-prod-gmail; Sat, 29 Oct 2022 15:22:38 -0700 (PDT) X-Received: by 2002:a05:6808:2096:b0:354:b901:97e6 with SMTP id s22-20020a056808209600b00354b90197e6mr11928603oiw.80.1667082158294; Sat, 29 Oct 2022 15:22:38 -0700 (PDT) In-Reply-To: X-Original-Sender: jan.stuehler-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Precedence: list Mailing-list: list pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org; contact pandoc-discuss+owners-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org List-ID: X-Google-Group-Id: 1007024079513 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Xref: news.gmane.io gmane.text.pandoc:31668 Archived-At: ------=_Part_5500_1433003058.1667082157584 Content-Type: multipart/alternative; boundary="----=_Part_5501_1897048594.1667082157584" ------=_Part_5501_1897048594.1667082157584 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Small correction. First attempt was with a table which did not have a width= =20 at all. Here is the version which will add or replace the width. ```lua function myfunction(el) equalwidth =3D (1 / #el.colspecs) - 0.01 for idx, csp in ipairs(el.colspecs) do csp[2] =3D equalwidth end return el end return {{ Table =3D myfunction }} ``` Jan St=C3=BChler 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= =20 > all column width to an equal size: > ```lua > function myfunction(el) > -- divide 1 by number of columns > -- subtract some spacing > equalwidth =3D (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 =3D 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=20 >> table. If you have table with a very narrow second column, pandoc will= =20 >> reproduce that in a grid table (since the colmun widths in this format= =20 >> matter).=20 >> >> One possible workaround would be to use a Lua filter to adjsut the colum= n=20 >> widths of Table elements after they are parsed.=20 >> >> Another would be to alter the column widths of the source table.=20 >> >> >> >> > On Oct 23, 2022, at 3:25 AM, Jan St=C3=BChler wr= ote:=20 >> >=20 >> > Hello group.=20 >> >=20 >> > I have been using=20 >> > ```=20 >> > pandoc --reference-links --extract-media=3Ddir -o file.md file.docx=20 >> > ```=20 >> > on a set of documents, each of those documents has many tables.=20 >> Especially those tables which have "only" images in the right column,=20 >> pandoc will break the image reference after one character. The image=20 >> references can therefore not be found when converting the document back = to=20 >> docx.=20 >> >=20 >> > ```=20 >> >=20 >> +------------------------+---+------------------------------------------= +=20 >> >=20 >> > | If the Home Screen is | ! | |=20 >> >=20 >> > | locked, the | [ | |=20 >> >=20 >> > | Examination button is | ] | |=20 >> >=20 >> > | dimmed. Please first | [ | |=20 >> >=20 >> > | click on Unlock and | 4 | |=20 >> >=20 >> > | then click on | 8 | |=20 >> >=20 >> > | Examination, | ] | |=20 >> >=20 >> >=20 >> +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D+=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+=20 >> >=20 >> > ```=20 >> > I do not have that problem when passing `--wrap=3Dnone` to markdown, b= ut=20 >> then all the lines in vim are unmanageably long.=20 >> >=20 >> > `wrap=3Dpreserver|auto|none` with or without `--columns=3Dx` does not= =20 >> resolve the one-character breaking issue.=20 >> >=20 >> > Also, converting to `-t gfm` first and then converting `-f gfm -t=20 >> markdown` still creates one-character line breaks.=20 >> >=20 >> > Is there any way to define a minimum column width?=20 >> >=20 >> > --=20 >> > You received this message because you are subscribed to the Google=20 >> Groups "pandoc-discuss" group.=20 >> > To unsubscribe from this group and stop receiving emails from it, send= =20 >> an email to pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org=20 >> > To view this discussion on the web visit=20 >> https://groups.google.com/d/msgid/pandoc-discuss/22b620a8-4869-4cd8-b040= -a4c55d0ae521n%40googlegroups.com.=20 >> >> >> --=20 You received this message because you are subscribed to the Google Groups "= pandoc-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an e= mail to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/= pandoc-discuss/1a3dd1bd-360d-4cf8-b85c-3aef12e12886n%40googlegroups.com. ------=_Part_5501_1897048594.1667082157584 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
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 w= idth.

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

return {{ Table =3D myfunction }= }
```

Jan St=C3=BChler schrieb am Samstag, 29. Oktober= 2022 um 23:40:16 UTC+2:
Thank you very much, fiddlosopher. I'll try with a lu= a filter which sets all column width to an equal size:
```lua
function myfunction(el)
= =C2=A0 =C2=A0 -- divide 1 by number of columns
=C2=A0 =C2=A0 -- subtract= some spacing
=C2=A0 =C2=A0 equalwidth =3D (1 / #el.colspecs) - 0.01
= =C2=A0 =C2=A0 -- print(equalwidth)
=C2=A0 =C2=A0 -- walk through colspec= s
=C2=A0 =C2=A0 for idx, _ in ipairs(el.colspecs) do
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 -- set width per column
=C2=A0 =C2=A0 =C2=A0 =C2=A0 table.= insert(el.colspecs[idx], equalwidth)
=C2=A0 =C2=A0 end
=C2=A0 =C2=A0 = -- return Table element
=C2=A0 =C2=A0 return el
end

return {{ = Table =3D myfunction }}
```

fiddlosopher schrieb am Mo= ntag, 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, p= andoc 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 colu= mn 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=C3=BChler <jan.st...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>=20
> Hello group.
>=20
> I have been using
> ```
> pandoc --reference-links --extract-media=3Ddir -o file.md file.doc= x
> ```
> on a set of documents, each of those documents has many tables. Es= pecially those tables which have "only" images in the right colum= n, pandoc will break the image reference after one character. The image re= ferences can therefore not be found when converting the document back to do= cx.
>=20
> ```
> +------------------------+---+------------------------------------= ------+
>=20
> | If the Home Screen is | ! | = |
>=20
> | locked, the | [ | = |
>=20
> | Examination button is | ] | = |
>=20
> | dimmed. Please first | [ | = |
>=20
> | click on Unlock and | 4 | = |
>=20
> | then click on | 8 | = |
>=20
> | Examination, | ] | = |
>=20
> +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D+=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+
>=20
> ```
> I do not have that problem when passing `--wrap=3Dnone` to markdow= n, but then all the lines in vim are unmanageably long.
>=20
> `wrap=3Dpreserver|auto|none` with or without `--columns=3Dx` does= not resolve the one-character breaking issue.
>=20
> Also, converting to `-t gfm` first and then converting `-f gfm -t = markdown` still creates one-character line breaks.
>=20
> Is there any way to define a minimum column width?
>=20
> --=20
> You received this message because you are subscribed to the Google= Groups "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, = send an email to pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
> To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/22b620a8-4= 869-4cd8-b040-a4c55d0ae521n%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups &= quot;pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an e= mail to pand= oc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d= /msgid/pandoc-discuss/1a3dd1bd-360d-4cf8-b85c-3aef12e12886n%40googlegroups.= com.
------=_Part_5501_1897048594.1667082157584-- ------=_Part_5500_1433003058.1667082157584--