From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/32197 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Newsgroups: gmane.text.pandoc Subject: RE: Parsing a list Date: Sat, 18 Feb 2023 02:41:51 -0500 Message-ID: <004201d9436c$7845f580$68d1e080$@blinksoft.com> 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="16327"; mail-complaints-to="usenet@ciao.gmane.io" To: Original-X-From: pandoc-discuss+bncBCM7D66H7ULRBRECYKPQMGQEGZA7V2A-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Sat Feb 18 08:42:00 2023 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-ot1-f62.google.com ([209.85.210.62]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pTHr6-00041V-8l for gtp-pandoc-discuss@m.gmane-mx.org; Sat, 18 Feb 2023 08:42:00 +0100 Original-Received: by mail-ot1-f62.google.com with SMTP id y1-20020a0568301d8100b0068dc4cd084asf35360oti.18 for ; Fri, 17 Feb 2023 23:42:00 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1676706119; cv=pass; d=google.com; s=arc-20160816; b=RH9Y0nS59OfgFWpTAWlkguCMisutTjPR4w1jDR9Z/AOIhVpcgdq3yg/TwtfhWfxPSe av9edRay7Ir0xsW94E3D6YV5pGbmJOhRi6LZWm+znjCjyVfofrFX4xknAUqYZlLNLll+ Z/9TvcBJ2MvG770HoBxQlwRzL8Y0DL0eDqcDvjlcdOUspvVmaqp9x8l7kEm5C1My1Mdp EBBUJYv/uXDiefEIufoOrCCXwFG41oIVaKCsNhfa91K9I0Coz+OZRR2cHe17vRUiGO+Z sPi9bq00a2bxxPko2nlQRX/lk1jTaSE/+T+C5f+T/OuI8760oPypwUjrGhDiykROr4ng AVqg== 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:content-language :thread-index:content-transfer-encoding:mime-version:message-id:date :subject:in-reply-to:references:to:from:sender:dkim-signature; bh=1qJxLh4KN9qjPtS90yM8G4qAP6Poj79eU3id934pUj4=; b=ZioNosxXyLyJi1GZwFO5FkPhrYSWF9wsm6BDmJQd4v/p1OApVb/W9uHffDzde4XoCW SV3aYtolju+aNXOi/7dBpQdNQdVPZF2VxZRahAcOnrfftHaLb5I8cieimNZ4eeGvhw9K nNLpvdYeGYVVp3MpeV48a+XYwfn0NeVgGkRBxhyXvjgVFFBctVkW+rYR0rKsrdwFLfLH SVCGwGAz9+3ur13jW5F1Gym+dGq00gwYJuAb8ce33StyhYRRaO+N+Bx8sSQ9+VJ8cc/X wIWfx7E844Sz4SAkv1qyBefthDBbAHkpv6c3SUQX7A9M29IjUNRAulDMtIY1yztpsd8w kQ9A== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@blinksoft-com.20210112.gappssmtp.com header.s=20210112 header.b=XsuqZY66; spf=neutral (google.com: 2607:f8b0:4864:20::833 is neither permitted nor denied by best guess record for domain of kperry-rhKcP+tiLR7by3iVrkZq2A@public.gmane.org) smtp.mailfrom=kperry-rhKcP+tiLR7by3iVrkZq2A@public.gmane.org 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 :content-language:thread-index:content-transfer-encoding :mime-version:message-id:date:subject:in-reply-to:references:to:from :sender:from:to:cc:subject:date:message-id:reply-to; bh=1qJxLh4KN9qjPtS90yM8G4qAP6Poj79eU3id934pUj4=; b=HCr5AraXNULBCDsUglErbnGyli3Zvp9gRR/6hsFsMc1brDMSEyOr3KtX7FGv1nJXIR 5ghQ5aQh4b4YWAQhkeJt/cIuM2fB1tihfMsqwZGQ5hC59Yc1vUrbuyB09XGqvf3qNcbR aleSNYRwJC3vqBNBMVgF3Yx0fafMWPEzQSbEnZ/R9tWwUDANhw/wyTYoZSdrdSt7E8na FTND9h6M4jWk5gIRSCY9gSt9sgVr/CSrJG00ca94JmYnuAJ405VDLnQ5e4+MFwYHJw0G W/ty/ebB4py6A3UwnNJR6OBlHCwwPs6W+k4 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 :content-language:thread-index:content-transfer-encoding :mime-version:message-id:date:subject:in-reply-to:references:to:from :x-gm-message-state:sender:from:to:cc:subject:date:message-id :reply-to; bh=1qJxLh4KN9qjPtS90yM8G4qAP6Poj79eU3id934pUj4=; b=cP2nN6er2lmAERs1mhqJ06ab0R/OYzeLvvleHJ2X2nU+QUw46ObPRATeD/POEyPmSw WMAl+iTbhEqfLtViYyuHxrEJ9R3U6UNAKqCMx1VX1i0j0rAw23BF3tboaLXWbxOUMC9I avETdOCjJ1dDQP3Y5p5bdZzXNRNZil092C5y3ewcigpmLo07XIf1WOdyRop1vRV49HYG 5alwHO/puZn1OsklZRnBCcFGzu8MZkz2o9g88zO7/bFRmtRF2CPHnF4ilB Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AO0yUKUJ9/sPZalUAO6Iuy+st5M6MmqWlrRWsKesT+hNdPGOfdIiMRjx RhqyAX0Cvm0bhK6Q09MZfZA= X-Google-Smtp-Source: AK7set/gNpnrAxMqvXssOq2kX6QvTzMLlLriV5/CKWEWPAIFZt+Oc9vrKqmq+Bml3v/xZaSqt03xvQ== X-Received: by 2002:a05:6871:592:b0:169:d554:a6b9 with SMTP id u18-20020a056871059200b00169d554a6b9mr634985oan.151.1676706118961; Fri, 17 Feb 2023 23:41:58 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:6870:e316:b0:150:5959:52ad with SMTP id z22-20020a056870e31600b00150595952adls1382073oad.3.-pod-prod-gmail; Fri, 17 Feb 2023 23:41:56 -0800 (PST) X-Received: by 2002:a05:6870:2394:b0:163:9649:4301 with SMTP id e20-20020a056870239400b0016396494301mr1840661oap.0.1676706116309; Fri, 17 Feb 2023 23:41:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676706116; cv=none; d=google.com; s=arc-20160816; b=aURj8+waB4X3VcRSQTcagFJQUzJ0wnZ8ehvHKUbRfI0v1Pay62UsTpcl25im3sIqnE cZXd5PjNRU8xWxosXW1R+KxgKysXC/scAoO21bCVfbh4WJyTKnI7QP6rxhyso7pizf9K SU5pi47rWwqVQ2AlQs7q1k5TVFLAVEu9ZNihPtYOBsbOWTBY2zwmo8ESNLsBg+L8Xt+v ZbmVWcuio4yk43euekfxXR67iJHtdkCyuLn8hvkgtt+559INEn1cZCb1U/ubUdosFXB+ idcOwsaoIbvGB1Opp9zwZEOjJOhlfiW2nmp6vF3N7akU9jvt3TfTnsktaz2+/j0aW6qt HLtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-language:thread-index:content-transfer-encoding :mime-version:message-id:date:subject:in-reply-to:references:to:from :dkim-signature; bh=+wZ8qRMEX2W9Du5ezQqGm+JdFvFu/7eV/W9IpakVHWQ=; b=PKFtJWnCB/U2v2OB7uvNayr8FTrVC4zcSGH2US9Ozdu6WPyKCk4XHb9QdanoQ0RX68 Pim16sccqwTU1BO/ZFw0I6pet37vf7AiHHl4jTNqslGz2S0n04p5fhXNXJUysPUFLJ+9 /aImAxwjJ/z8Un9HS7gEQUKJ3bJs6AEYYVXq3ANhqehqzorAC3pVsun8QcGh3eMtP2xk tac57q4pPXmv0CgM9vrN3utovSCYu1QrQ6DJblK+CejY0vDCB1GZF0HcNLEAvrcbPD93 9/7iaQH3Afk4Gd12/BcIDqk0Sew78q5hqNGyF6Z+ElnE66+DhTsPauvLoqKkXLINtEdv 6pKw== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@blinksoft-com.20210112.gappssmtp.com header.s=20210112 header.b=XsuqZY66; spf=neutral (google.com: 2607:f8b0:4864:20::833 is neither permitted nor denied by best guess record for domain of kperry-rhKcP+tiLR7by3iVrkZq2A@public.gmane.org) smtp.mailfrom=kperry-rhKcP+tiLR7by3iVrkZq2A@public.gmane.org Original-Received: from mail-qt1-x833.google.com (mail-qt1-x833.google.com. [2607:f8b0:4864:20::833]) by gmr-mx.google.com with ESMTPS id os16-20020a0568707d1000b0016e2f7aeab1si433528oab.4.2023.02.17.23.41.56 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 17 Feb 2023 23:41:56 -0800 (PST) Received-SPF: neutral (google.com: 2607:f8b0:4864:20::833 is neither permitted nor denied by best guess record for domain of kperry-rhKcP+tiLR7by3iVrkZq2A@public.gmane.org) client-ip=2607:f8b0:4864:20::833; Original-Received: by mail-qt1-x833.google.com with SMTP id hg7so66263qtb.13 for ; Fri, 17 Feb 2023 23:41:56 -0800 (PST) X-Received: by 2002:ac8:7f4a:0:b0:3b8:6d3a:5ec7 with SMTP id g10-20020ac87f4a000000b003b86d3a5ec7mr6231633qtk.22.1676706115040; Fri, 17 Feb 2023 23:41:55 -0800 (PST) Original-Received: from Darkstar (cpe-98-157-222-174.ma.res.rr.com. [98.157.222.174]) by smtp.gmail.com with ESMTPSA id bt11-20020ac8690b000000b003b9bd163403sm4880562qtb.4.2023.02.17.23.41.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Feb 2023 23:41:54 -0800 (PST) In-Reply-To: X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQHjdhsQrIUt3A++IbjicxFwlGknpQKv/vqWrqpqfeA= Content-Language: en-us X-Original-Sender: kperry-rhKcP+tiLR7by3iVrkZq2A@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@blinksoft-com.20210112.gappssmtp.com header.s=20210112 header.b=XsuqZY66; spf=neutral (google.com: 2607:f8b0:4864:20::833 is neither permitted nor denied by best guess record for domain of kperry-rhKcP+tiLR7by3iVrkZq2A@public.gmane.org) smtp.mailfrom=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:32197 Archived-At: I tried posting this so if you get two that is because I did not see it in = my sent mail after sending it. Here is what I have tried before the for lo= op to see if there is a style or start: If items.listAttributes ~=3D nil and items.listAttributes.start ~=3D nill t= hen Log ("bbx start " .. items.listAttributes.start) End If items.listAttributes ~=3D nil and items.listAttributes.style ~=3D nill t= hen Log ("bbx style " .. items.listAttributes.style ) End Neither of those logged to my log function. Note the log function is well = tested and just opens a file to append to since I can't catch standard out = in this being run by a filter in in a Java program. I log before and after= the if with a string message and they show up. So then I saw that there w= as a short hand possible in the pandoc API so I tried doing: If items.start then Log ("bbx start " .. items.start) End If items.style then Log ("bbx style " .. items.style ) End This should have printed logs for at least the last list for start and all = the rest for style and nothing was logged. If I try with out the if stateme= nts it just throws an error and currently I am not sure how to catch that e= rror since again I am running it in a Java program that executes it. I am = going to look into getting that error message but I am assuming it will say= that the style or start is nil but that doesn't exactly make since because= in the JSON they are always set to something. AmI doing something wrong i= n the above if statements. I code in way to many programming languages and= LUA is not one of my strong points. I could send you the whole bbx and my= test file if you think it will help you help me. Ken -----Original Message----- From: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org On = Behalf Of Bastien DUMONT Sent: Thursday, February 16, 2023 1:38 AM To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Subject: Re: Parsing a list 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=20 > file types that we don't currently support. We have most of the=20 > filter working for our file type but the lists are not working right =20 > I can't seem to get the nested lists to come out right. I am trying=20 > to get the attributes of a list in a LUA filter to give me the same infor= mation I can see when I output to JSON. > Currently I am using an ugly list like this to test with: >=20 > Broken list >=20 > =20 >=20 > 1. Item 1 >=20 > 2. Item 2 >=20 > 3. Item 3 >=20 > 1. item 7 >=20 > 2. Item 8 >=20 > a. Item a >=20 > b. Item b >=20 > i. Item i >=20 > ii. 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"]=20 > ,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"]]]] >=20 >=20 > I am trying to parse this with LUA with the function: >=20 >=20 > function OrderedList(items) > local newItems =3D {} > local listItems =3D '' > local itemCtr =3D 1 > beginTag =3D ' bb:listLevel=3D"0"> ' > endTag =3D '' > for _, item in pairs(items) do > if nil ~=3D item and string.len(item) > 0 then > item =3D removeTags(item) > -- listItems =3D listItems .. ' bb:itemLevel=3D"0"> '.. itemCtr .. '. ' .. item .. '' > print ('fuck' .. itemCtr .. '. ' .. item) > table.insert(newItems,''.. > itemCtr .. '. ' .. item .. '') > itemCtr =3D itemCtr + 1 > end > end > newItems.bullet =3D true > return BulletList(newItems) > end >=20 >=20 > I know I can adjust the above LUA if I cna just figure out how to get=20 > the start value, and the style out of the native into the LUA. Can=20 > someone tell me the line of code I need to ge the attributes. I have tri= ed 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=20 > attributes are on the main list. I can't seem to get the LUA function=20 > to see the things like starting value and I don't know what I have to=20 > do so that I can parse the levels correctly. All help is welcome. =20 > Heck if someone has something that can take the above docx list and=20 > output it as a text list that is all I need. I can wrap that in our=20 > tags. I have been looking for any examples of LUA filters that=20 > make multi level broken lists into anything and I can not find an exampl= e. >=20 >=20 > Thanks for any help. >=20 >=20 >=20 > =20 >=20 >=20 > -- > You received this message because you are subscribed to the Google=20 > Groups "pandoc-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send=20 > an email to [1]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit=20 > [2]https://groups.google.com/d/msgid/ > pandoc-discuss/39a03df1-6228-449f-8f20-1b5b92248cecn%40googlegroups.com. >=20 > References: >=20 > [1] mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > [2]=20 > https://groups.google.com/d/msgid/pandoc-discuss/39a03df1-6228-449f-8f > 20-1b5b92248cecn%40googlegroups.com?utm_medium=3Demail&utm_source=3Dfoote= r -- 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. --=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/004201d9436c%247845f580%2468d1e080%24%40blinksoft.com.