From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/32182 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ken Perry Newsgroups: gmane.text.pandoc Subject: Parsing a list Date: Wed, 15 Feb 2023 20:50:11 -0800 (PST) Message-ID: <39a03df1-6228-449f-8f20-1b5b92248cecn@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_3646_239427306.1676523011398" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8186"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBCM7D66H7ULRBBHMW2PQMGQEUHQBNDQ-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Thu Feb 16 05:50:17 2023 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-qk1-f185.google.com ([209.85.222.185]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pSWDo-0001rF-Fy for gtp-pandoc-discuss@m.gmane-mx.org; Thu, 16 Feb 2023 05:50:16 +0100 Original-Received: by mail-qk1-f185.google.com with SMTP id x14-20020a05620a14ae00b0072f7f0f356bsf526492qkj.1 for ; Wed, 15 Feb 2023 20:50:16 -0800 (PST) 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:message-id:to:from:date:sender:from:to:cc :subject:date:message-id:reply-to; bh=G7iijts6NqLy563R46erJ8QY0Qo4x2MtMCRjDHdCmKM=; b=FrVaQWh3oK5POkQlLBfsrcZbAn9vQlYsgZZx/CH0smi8qXErShe3acocZ2aYzjh4h2 EVJmA+TmXJ9AQMvN0Q+ND1QMPUqOyUtu8bFZ+tRR7/AXzUYxuOJ8I3BfXoTwuZXNrM6k kzqFAKq3hzmduzDPOQ4CIYNnMw0Gy8mkeewApBGDuqnMdayxgZlLKvUYJqX7SHvOwbCw X3NAXwvK0Z2y/7qy9LFv68orQ7rlOGEcjna1QHH5n3mLg9VSZlyAlEpNxTabH+67Su08 YsN52/EYLNgglPmxSaJNdVG+R4lsM1kdAdAHtnclF559FGcTjln74fMX0URloMRLDKOP 87Yw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=blinksoft-com.20210112.gappssmtp.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:message-id:to:from:date:from:to:cc:subject :date:message-id:reply-to; bh=G7iijts6NqLy563R46erJ8QY0Qo4x2MtMCRjDHdCmKM=; b=csA5Mjzfx6H4h5ABPr7ccbpfYhmFnZFY/HWyoM/NEIaczeOR3cz3troO3JwAt/pLms NrP/ywDPM/vymK6RqHNxS4YZiHJw91ZvJkCrK7kAAmR67fml3v6+xu0HdEB9wp/Pm9/o OZwYjf0kOn9+u24XpQXQVFDP747AM06NpCO33FNoT5t/5cApi4OnVUnNuomUJNuxyWu9 KHY5amRyGDeV/+bSj2A47G5n9M+ehQPSgrAxRj2tEIhXBCu9D7H+N3YNLrWAkpN3G3MW +drpcLwFT5wQHOjKH7FYoTjNguawwWiHy6t0WeVQ0kwnw1cVAbgKYqohbYqpyqmhsYqB r7Dg== 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:message-id:to:from:date :x-gm-message-state:sender:from:to:cc:subject:date:message-id :reply-to; bh=G7iijts6NqLy563R46erJ8QY0Qo4x2MtMCRjDHdCmKM=; b=XjSmo3fR+V9Ggd2HS/tZsaHzCRQMhG3/kg/JOaPQ80bA3dabX9JWu72uU+kHNI30xb Su9N5Q2GR1iuCUGbXSfWgH/vZcVXeX9ELTjKGvHwd52cUlzpsyKjv9/4sHZpHB9gCzFm 8fiI7XSzkfm0KgrlnJ7GsYa2qQSwwe5vOi34JHP4Cs8+rBZIk6lWoS6x7Oh1uAV9xJkQ ck0LZJMXbb4I3MDdB5j0hLQ1dCza6sDsk/q9e/ReYFKuIQUU04Lu5u+JfWK58PA2ZSBA EetMldrqaeP2h7+TPkGAh9NLNvv1ikLClQnm5qOLP6kizC/Wp7vILQ/FMF1aijft75lQ 6gLA== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AO0yUKWOT5Iqht00xa7zhLsHbxt+kov6jc6ZxWMDnyqoyT3mlpNWACKI 9I4veOTcJ7ih95HhvQnd9O0= X-Google-Smtp-Source: AK7set8qV4JJoai8itC8s26C5+F87pnKoHF7qV1Av45NJYZHq3WprHWuKjOLy4hXS0EuAPk4Mk6HZQ== X-Received: by 2002:a0c:a612:0:b0:539:cee8:19a0 with SMTP id s18-20020a0ca612000000b00539cee819a0mr441378qva.48.1676523015128; Wed, 15 Feb 2023 20:50:15 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:ac8:5645:0:b0:3b0:98a4:96b8 with SMTP id 5-20020ac85645000000b003b098a496b8ls1032684qtt.8.-pod-prod-gmail; Wed, 15 Feb 2023 20:50:12 -0800 (PST) X-Received: by 2002:a05:622a:1209:b0:3b8:273f:b723 with SMTP id y9-20020a05622a120900b003b8273fb723mr469720qtx.384.1676523012024; Wed, 15 Feb 2023 20:50:12 -0800 (PST) X-Original-Sender: kperry-rhKcP+tiLR7by3iVrkZq2A@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:32182 Archived-At: ------=_Part_3646_239427306.1676523011398 Content-Type: multipart/alternative; boundary="----=_Part_3647_287976203.1676523011398" ------=_Part_3647_287976203.1676523011398 Content-Type: text/plain; charset="UTF-8" We use Pandoc as a backend for a Braille word processor. to support file types that we don't currently support. We have most of the filter working for our file type but the lists are not working right I can't seem to get the nested lists to come out right. I am trying to get the attributes of a list in a LUA filter to give me the same information I can see when I output to JSON. Currently I am using an ugly list like this to test with: Broken list 1. Item 1 2. Item 2 3. Item 3 1. item 7 2. Item 8 a. Item a b. Item b i. Item i ii. Item ii 1. Item I 2. Item ii 3. Item 9 4. Item 10 When I run it in the native json I get : ,Header 3 ("broken-list",[],[]) [Str "Broken",Space,Str "list"] ,OrderedList (1,Decimal,Period) [[Para [Str "Item",Space,Str "1"]] ,[Para [Str "Item",Space,Str "2"]] ,[Para [Str "Item",Space,Str "3"]]] ,OrderedList (7,Decimal,Period) [[Para [Str "item",Space,Str "7"]] ,[Para [Str "Item",Space,Str "8"] ,OrderedList (1,LowerAlpha,DefaultDelim) [[Para [Str "Item",Space,Str "a"]] ,[Para [Str "Item",Space,Str "b"] ,OrderedList (1,LowerRoman,DefaultDelim) [[Para [Str "Item",Space,Str "i"]] ,[Para [Str "Item",Space,Str "ii"] ,OrderedList (1,Decimal,DefaultDelim) [[Para [Str "Item",Space,Str "I"]] ,[Para [Str "Item",Space,Str "ii"]]]]]]]] ,[Para [Str "Item",Space,Str "9"]] ,[Para [Str "Item",Space,Str "10"]]]] I am trying to parse this with LUA with the function: function OrderedList(items) local newItems = {} local listItems = '' local itemCtr = 1 beginTag = '' endTag = '' for _, item in pairs(items) do if nil ~= item and string.len(item) > 0 then item = removeTags(item) -- listItems = listItems .. ''.. itemCtr .. '. ' .. item .. '' print ('fuck' .. itemCtr .. '. ' .. item) table.insert(newItems,''.. itemCtr .. '. ' .. item .. '') itemCtr = itemCtr + 1 end end newItems.bullet = true return BulletList(newItems) end 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. Can someone tell me the line of code I need to ge the attributes. I have tried things like: items.attributes items.listAttributes I even checked the item before I output the json and saw that tthe attributes are on the main list. I can't seem to get the LUA function to see the things like starting value and I don't know what I have to do so that I can parse the levels correctly. All help is welcome. Heck if someone has something that can take the above docx list and output it as a text list that is all I need. I can wrap that in our tags. I have been looking for any examples of LUA filters that make multi level broken lists into anything and I can not find an example. Thanks for any help. -- 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/39a03df1-6228-449f-8f20-1b5b92248cecn%40googlegroups.com. ------=_Part_3647_287976203.1676523011398 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
We use Pandoc as a backend for a Braille word processor. to supp= ort file types that we don't currently support.=C2=A0 =C2=A0We have most of= the filter working 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 list in a LUA filter to give me the = same information I can see when I output to JSON.=C2=A0 Currently I am usin= g an ugly list like this to test with:

Broken li= st

=C2=A0

1. Item 1

2. =C2=A0Item 2

3. =C2=A0Item 3

1. =C2=A0item 7

2. =C2=A0Item 8

a. Item a

b. Item b

=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

=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

1. Item I

2. Item ii

3. Item 9

4. Item 10



When I run it in the native json I get :


,Header 3 ("broken-list",[],[]) [Str "Broken",Space,Str "list"]<= br />,OrderedList (1,Decimal,Period)
=C2=A0[[Para [Str "Item",Space,St= r "1"]]
=C2=A0,[Para [Str "Item",Space,Str "2"]]
=C2=A0,[Para [St= r "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",Spa= ce,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 ,Ordere= dList (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",S= pace,Str "ii"]]]]]]]]
=C2=A0,[Para [Str "Item",Space,Str "9"]]
= =C2=A0,[Para [Str "Item",Space,Str "10"]]]]


I am tryin= g to parse this with LUA with the function:


function Ord= eredList(items)
=C2=A0 local newItems =3D {}
=C2=A0 local listIte= ms =3D ''
=C2=A0 local itemCtr =3D 1
=C2=A0 beginTag =C2=A0=3D '&= lt;CONTAINER bb:type=3D"LIST" bb:listType=3D"NORMAL" bb:listLevel=3D"0">= '
=C2=A0 =C2=A0endTag =C2=A0 =C2=A0=3D '</CONTAINER>'
=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 .. '<BLOCK bb= :type=3D"LIST_ITEM" bb:itemLevel=3D"0">'.. itemCtr .. '. ' .. item .. '&= lt;/BLOCK>'
=C2=A0 =C2=A0 =C2=A0 print ('fuck' .. itemCtr .. '. ' .= . item)
=C2=A0 =C2=A0 =C2=A0 table.insert(newItems,'<BLOCK bb:type= =3D"LIST_ITEM" bb:itemLevel=3D"0">'.. itemCtr .. '. ' .. item .. '</B= LOCK>')
=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

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 tell me the line o= f code I need to ge the attributes.=C2=A0 I have tried things like:

<= br />

items.attributes

items.listAttributes


= I even checked the item before I output the json and saw that tthe attribut= es are on the main list.=C2=A0 I can't seem to get the LUA function to see = the things like starting value and I don't know what I have to do so that I= can parse the levels correctly.=C2=A0 All help is welcome.=C2=A0 Heck if s= omeone has something that can take the above docx list and output it as a t= ext 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 mul= ti=C2=A0 level broken lists into anything and I can not find an example.=C2= =A0=C2=A0


Thanks for any help.



=

=C2=A0


--
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/39a03df1-6228-449f-8f20-1b5b92248cecn%40googlegroups.= com.
------=_Part_3647_287976203.1676523011398-- ------=_Part_3646_239427306.1676523011398--