From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/32183 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Bastien DUMONT Newsgroups: gmane.text.pandoc Subject: Re: Parsing a list Date: Thu, 16 Feb 2023 06:38:06 +0000 Message-ID: References: <39a03df1-6228-449f-8f20-1b5b92248cecn@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13891"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBDCINCES2QJRBV46W6PQMGQEUKTSN4Q-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Thu Feb 16 07:38:19 2023 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-lf1-f55.google.com ([209.85.167.55]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pSXuN-0003Nz-Na for gtp-pandoc-discuss@m.gmane-mx.org; Thu, 16 Feb 2023 07:38:19 +0100 Original-Received: by mail-lf1-f55.google.com with SMTP id f17-20020ac25091000000b004b565e69540sf569585lfm.12 for ; Wed, 15 Feb 2023 22:38:19 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1676529499; cv=pass; d=google.com; s=arc-20160816; b=JXAiDERzWeUEG1IqB5kua5A9+7OuGk7ro8DV21XSnGXIrIX4rnStwNOs3ie4sga4cC pPiYJA7FfZKJkdWY0CDsqs7HLunbsNRyvYBkQUlLnkVgxsOlqOf9NLQj7MvIb/j0IaAQ JEt3aVa3G+4nM+swp0ONff/NpzQJx6qCFPBO2BljMyRPbkSG/Vj3oIhqzrh+a+QrzrjD EGIBbQIXxZPEqLah3TGk8cmFIwUNaDZgEWnOVUPnMGgaLTO/h77IKrhjomJCfO0hcRjV CpD3QxYjcQu6zQ/RJiCGE26haqttqTAcMWrZwB280KuXCITSqncdewKUXQpatGmynHXF 5kqg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:to:from:date:sender:dkim-signature; bh=oGLMWRKNWpzmGgwUuhIk372IeQ84S5k6Kpwg9ZvzYLs=; b=CEZab+7a1Pqh9BovIphPRSc1ue2ha4OMxn3jT6svlIFLE6n35I5imQq1QifgGms6IE Zf9+k815sZAi5WZ9AmKtJC/YuwhCO2ZdtYUn3RzAF/bahAsv37LJPn99gbl189W3/uB5 vSEOYGOYHtdjdBLCUceOd7NQ3gjHLDeOcxfxNF9/c5CxGNCwGm5ZtkFw0yRCRUlxltn9 h9Awjy0oPugJVzloLc9kDcW5rtqiPRap/LTFcqn2aAZ5w/z+Z0q5eglo7bgfF26adJjC RAt2HE5NLhqlntIjqiKhlVzOhiEHE6KUwn41+8raFeKrwnUIu/1QYG7qqqYT6j4Dg4hp g51w== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@posteo.net header.s=2017 header.b=hw4WIPiK; spf=pass (google.com: domain of bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org designates 185.67.36.66 as permitted sender) smtp.mailfrom=bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=posteo.net 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-authentication-results:x-original-sender:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:to:from:date:sender:from:to:cc :subject:date:message-id:reply-to; bh=oGLMWRKNWpzmGgwUuhIk372IeQ84S5k6Kpwg9ZvzYLs=; b=eofuoIss3/gUiTH4UWGZSv798KCP3DPZl3d3kg+aQwVG8vDIIVZF5Sb/NrKapQoQM1 17pY77hUVuztoMk149IHmguDeSwhvRlLo6xRZL7Ce3iEy32tbM0zxpFrPF4qfSpSDJoz PYD37fPboFbMMeiQkU/nFzVaGGIgeH5aKuYcuSOADK2gC9QE1jDNjr/IeUJbfc9jiwHT RHKvxVNZV2+QSD5PjotfaGGZ2EZrFYQXnDBe6d5C2l55btKfIzp+j8GXjeuDW2/K+aFg Rdb2XRt6pm25+GwVXcu3Cd2qP9767T4Anc4bwX3jq0WHr 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-authentication-results:x-original-sender:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:to:from:date:x-gm-message-state :sender:from:to:cc:subject:date:message-id:reply-to; bh=oGLMWRKNWpzmGgwUuhIk372IeQ84S5k6Kpwg9ZvzYLs=; b=jk+azk3qUgpcRCpDWU0yBhuNxXP02X2try/+bOkihjIafzSoQzcDvvGn3pybSvCWiL Dzi/Yu759IR8g4TzNHiXXPmfzpICQGBBgqZKOCh4He2tLpBFfIf+VqEMNLGpKjmWh8M2 bkVaON46C7RcyrDIxM8rqpjMjcvNFQggWq9RVPY8oeBSI/3VMczN5ppR74FFfUzRoHhW R5GrlFCwcA5cX/9cReSdK1oR+qm2VpXvzcUUiKXZgqO5qAH5p4K5lf8TMaujZNfW26Iu Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AO0yUKUJArLo25Ub6cHwcWxu4OAawu9kSrKi4EqtxSJakDyOtjis8MjO j24ay/kfrP3chIbLeIKL798= X-Google-Smtp-Source: AK7set9p46Hu1+WN/sPeGAFVVtKZzcoLKzE1vU3Hzx5eYipSoWk5HWt8s2fzZtgQKwobOB74oi4FrQ== X-Received: by 2002:ac2:530e:0:b0:4d5:ca32:68a2 with SMTP id c14-20020ac2530e000000b004d5ca3268a2mr1298146lfh.7.1676529498905; Wed, 15 Feb 2023 22:38:18 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:6512:3b91:b0:4db:51a5:d2e8 with SMTP id g17-20020a0565123b9100b004db51a5d2e8ls123867lfv.2.-pod-prod-gmail; Wed, 15 Feb 2023 22:38:14 -0800 (PST) X-Received: by 2002:a19:5203:0:b0:4b5:2cf4:cc1d with SMTP id m3-20020a195203000000b004b52cf4cc1dmr1158201lfb.68.1676529494016; Wed, 15 Feb 2023 22:38:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676529494; cv=none; d=google.com; s=arc-20160816; b=X/RdfxFwjNLuXx8tNtZINXbtOsqg6aguAdxS4w5X3CFBWwUvn5+XxvJIFae7u28ZuD abIVfOBXBuOFv+/G+umSMvstWGWwYuka9Oid8V3uh9kXYgprVg6Z/umEFUS7osu6D0i4 sR87umhnLzHkhdBsxW1fOfjqeGG0UO97/JbujT+dkHpWBdxm05bX0WoNw2gBDkb3q3ZX 2c5w2yc2fJ94ecKm4EnAQUdK5bu2JjSCsxVcTCjCC1473xTUVpSkrZugpkJT1Cxe+Bsb gXEQMRSvH795D03PTXGon27H8f8M+WymsEZNr/qbOwueQNjBNeActBfcBHgf5LZq5IxX azIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:to:from:date :dkim-signature; bh=slCLd5Tatml4OUZJZ0hcLdBcHTBpaSY9NwE4td0mN3E=; b=sDTWMyTITojstTM12Lz870mEvkNUol6cdAdx51yC3AWCMzJ2jPz0OOwABchA26B8+Y mRfZgkj25cUNtsec6qrI2Gf893JIpChZKakvcZYVfZT1c/3t4PzFDC5cmErlsI7UZ9q6 KeK7dhqpBCFLCBFuSK/U3AXW/TSkBnfTpkZLeM/2JgQcowW7svSq137JYjlE25YFFZBB AGEWUrMr1QMwrFf5zD/YWhSOTjJCffBDdVOYe79rRS753ooJLPVt2kW5pS0B/kMzG74R wxxi7fDUZ8XPegTqpZdTHS0xeH5qLIZvcgpg4BOb27P0fPAM4rilDHSBo9HphICCwtZT 9UKw== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@posteo.net header.s=2017 header.b=hw4WIPiK; spf=pass (google.com: domain of bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org designates 185.67.36.66 as permitted sender) smtp.mailfrom=bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=posteo.net Original-Received: from mout02.posteo.de (mout02.posteo.de. [185.67.36.66]) by gmr-mx.google.com with ESMTPS id g1-20020ac24d81000000b004db4fd30fb7si29807lfe.10.2023.02.15.22.38.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Feb 2023 22:38:13 -0800 (PST) Received-SPF: pass (google.com: domain of bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org designates 185.67.36.66 as permitted sender) client-ip=185.67.36.66; Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 2C25D24050E for ; Thu, 16 Feb 2023 07:38:13 +0100 (CET) Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4PHQHm4YfPz9rxD for ; Thu, 16 Feb 2023 07:38:12 +0100 (CET) Content-Disposition: inline In-Reply-To: <39a03df1-6228-449f-8f20-1b5b92248cecn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> X-Original-Sender: bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@posteo.net header.s=2017 header.b=hw4WIPiK; spf=pass (google.com: domain of bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org designates 185.67.36.66 as permitted sender) smtp.mailfrom=bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=posteo.net 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:32183 Archived-At: Doesn't items.listAttributes.start, items.listAttributes.style and items.li= stAttributes.delimiter yield what you are looking for? By the way, you can replace `if nil ~=3D item` with `if item`: in Lua, a ni= l value evaluates to false and any non-nil and non-false value evaluates to= true. Le Wednesday 15 February 2023 =C3=A0 08:50:11PM, Ken Perry a =C3=A9crit : >=20 > We use Pandoc as a backend for a Braille word processor. to support file = types > that we don't currently support.=C2=A0 =C2=A0We have most of the filter w= orking for our > file type but the lists are not working right=C2=A0 =C2=A0I can't seem to= get the nested > lists to come out right.=C2=A0 I am trying to get the attributes of a lis= t in a LUA > filter to give me the same information I can see when I output to JSON.= =C2=A0 > Currently I am using an ugly list like this to test with: >=20 > Broken list >=20 > =C2=A0 >=20 > 1. Item 1 >=20 > 2. =C2=A0Item 2 >=20 > 3. =C2=A0Item 3 >=20 > 1. =C2=A0item 7 >=20 > 2. =C2=A0Item 8 >=20 > a. Item a >=20 > b. Item b >=20 > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 i.=C2=A0=C2=A0 Item i >=20 > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ii.=C2=A0=C2=A0 Item ii >=20 > 1. Item I >=20 > 2. Item ii >=20 > 3. Item 9 >=20 > 4. Item 10 >=20 >=20 >=20 > When I run it in the native json I get : >=20 >=20 > ,Header 3 ("broken-list",[],[]) [Str "Broken",Space,Str "list"] > ,OrderedList (1,Decimal,Period) > =C2=A0[[Para [Str "Item",Space,Str "1"]] > =C2=A0,[Para [Str "Item",Space,Str "2"]] > =C2=A0,[Para [Str "Item",Space,Str "3"]]] > ,OrderedList (7,Decimal,Period) > =C2=A0[[Para [Str "item",Space,Str "7"]] > =C2=A0,[Para [Str "Item",Space,Str "8"] > =C2=A0 ,OrderedList (1,LowerAlpha,DefaultDelim) > =C2=A0 =C2=A0[[Para [Str "Item",Space,Str "a"]] > =C2=A0 =C2=A0,[Para [Str "Item",Space,Str "b"] > =C2=A0 =C2=A0 ,OrderedList (1,LowerRoman,DefaultDelim) > =C2=A0 =C2=A0 =C2=A0[[Para [Str "Item",Space,Str "i"]] > =C2=A0 =C2=A0 =C2=A0,[Para [Str "Item",Space,Str "ii"] > =C2=A0 =C2=A0 =C2=A0 ,OrderedList (1,Decimal,DefaultDelim) > =C2=A0 =C2=A0 =C2=A0 =C2=A0[[Para [Str "Item",Space,Str "I"]] > =C2=A0 =C2=A0 =C2=A0 =C2=A0,[Para [Str "Item",Space,Str "ii"]]]]]]]] > =C2=A0,[Para [Str "Item",Space,Str "9"]] > =C2=A0,[Para [Str "Item",Space,Str "10"]]]] >=20 >=20 > I am trying to parse this with LUA with the function: >=20 >=20 > function OrderedList(items) > =C2=A0 local newItems =3D {} > =C2=A0 local listItems =3D '' > =C2=A0 local itemCtr =3D 1 > =C2=A0 beginTag =C2=A0=3D ' > ' > =C2=A0 =C2=A0endTag =C2=A0 =C2=A0=3D '' > =C2=A0 for _, item in pairs(items) do > =C2=A0 =C2=A0 if nil ~=3D item and string.len(item) > 0 then > =C2=A0 =C2=A0 =C2=A0 item =3D removeTags(item) > =C2=A0 =C2=A0 =C2=A0 -- listItems =3D listItems .. ' > '.. itemCtr .. '. ' .. item .. '' > =C2=A0 =C2=A0 =C2=A0 print ('fuck' .. itemCtr .. '. ' .. item) > =C2=A0 =C2=A0 =C2=A0 table.insert(newItems,''.. > itemCtr .. '. ' .. item .. '') > =C2=A0 =C2=A0 =C2=A0 itemCtr =3D itemCtr + 1 > =C2=A0 =C2=A0 end > =C2=A0 end > =C2=A0 newItems.bullet =3D true > =C2=A0 return BulletList(newItems) > end >=20 >=20 > I know I can adjust the above LUA if I cna just figure out how to get the= start > value, and the style out of the native into the LUA.=C2=A0 Can someone te= ll me the > line of code I need to ge the attributes.=C2=A0 I have tried things like: >=20 >=20 > items.attributes >=20 > items.listAttributes >=20 >=20 > I even checked the item before I output the json and saw that tthe attrib= utes > are on the main list.=C2=A0 I can't seem to get the LUA function to see t= he things > like starting value and I don't know what I have to do so that I can pars= e the > levels correctly.=C2=A0 All help is welcome.=C2=A0 Heck if someone has so= mething that can > take the above docx list and output it as a text list that is all I need.= =C2=A0 I > can wrap that in our tags.=C2=A0 =C2=A0 I=C2=A0 have been looking for any= examples of LUA > filters that make multi=C2=A0 level broken lists into anything and I can = not find an > example.=C2=A0=C2=A0 >=20 >=20 > Thanks for any help. >=20 >=20 >=20 > =C2=A0 >=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 [1]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit [2]https://groups.google.com/d/m= sgid/ > pandoc-discuss/39a03df1-6228-449f-8f20-1b5b92248cecn%40googlegroups.com. >=20 > References: >=20 > [1] mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > [2] https://groups.google.com/d/msgid/pandoc-discuss/39a03df1-6228-449f-8= f20-1b5b92248cecn%40googlegroups.com?utm_medium=3Demail&utm_source=3Dfooter --=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/Y%2B3PTvBjmu8Y9koD%40localhost.