From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/28626 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Newsgroups: gmane.text.pandoc Subject: AW: Fenced Div to ConTeXt Environment (was: Markdown Fenced Div to LaTeX Environment) Date: Thu, 17 Jun 2021 08:12:06 +0000 Message-ID: <4396a9133ab74e4fbff486f09e22d254@unibe.ch> References: <8ba84992-d792-4333-aae0-560147ef79d4n@googlegroups.com> <87pn1uwglb.fsf@zeitkraut.de> <20210616143731.GA29446@sokrates> <5db56b4f1d8d4ca2bec612bcebb7a525@unibe.ch> <493d0aa9-47f5-ca8d-2ef5-8e63f965c529@mailbox.org> 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="19365"; mail-complaints-to="usenet@ciao.gmane.io" To: Original-X-From: pandoc-discuss+bncBCZ27W53TUFBBW4HVSDAMGQEP6XDC6Q-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Thu Jun 17 10:12:13 2021 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-wm1-f55.google.com ([209.85.128.55]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1ltn8H-0004lo-4l for gtp-pandoc-discuss@m.gmane-mx.org; Thu, 17 Jun 2021 10:12:13 +0200 Original-Received: by mail-wm1-f55.google.com with SMTP id m6-20020a7bce060000b02901d2a0c361bfsf868971wmc.4 for ; Thu, 17 Jun 2021 01:12:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1623917532; cv=pass; d=google.com; s=arc-20160816; b=HBPdH16neoyM/jzES2unzOmCUhImg/TxmqxmA6+Y/gYjdbfe7LdAvEjxqdtz8s5n1X /huAvIXltWNlcGn7NrfQrFSuuQ4Kl+tuM3murWGZnIk46UGYSf2miAaVfGJweT7gobuq sehtRH3scfzODaGPKwvA7u7FcM+J/I4wv3opmgOogNLVKprfi4h5T/aLFwdUxiw4MEKm P9O9t+PKs4wzXLhCFoAX6bsPbWKsTSz+SB3c/cY7d0ChLH9kRagqG25AoM/wKh/FvmKU PPs/44SfHwQYJEx/lGSltvm96AzwjTw1zJhz8rAaZbf2CWgmGD2He+eC1bueMYH0Fh/t k/ew== 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:mime-version :content-transfer-encoding:content-language:accept-language :in-reply-to:references:message-id:date:thread-index:thread-topic :subject:to:from:sender:dkim-signature; bh=eNLmgsT37xu056T07ppcTD5kslY4oVW1SKTrl2BY8gM=; b=AEwOVCEKFnel38xDN912yFN/9qtYH8zlen3F8BHY6pWp6mvNQwN2+VidsRhtd3A3x8 GpcxkL6H2jrFjTKixyWK9VES90qoLsJq2PbXMMlSHrp5/WQpBcnvZByoh9JU9HVQr2xi +T2KCR4z2GGX4J7fLeaA9N36Udb0hD6tpFu6PO5LGLB4iCKETnwJcedCC2bHqj2xogUV jSo95hFBhN5oG1Afimg5vlPgjSWsUfDjZ0+r9lzw+iZEC+SAJJCaalYIg9RuNPORh5KK WeyyUn/vbfTcubq2UkzFDjqC+ihWPXjsUb/mHTrEoOhcR77eF6/iXMZWIlLoqBZ7dFb5 NhWg== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=pass (google.com: domain of denis.maier-NSENcxR/0n0@public.gmane.org designates 130.92.0.83 as permitted sender) smtp.mailfrom=denis.maier-NSENcxR/0n0@public.gmane.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=unibe.ch DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:from:to:subject:thread-topic:thread-index:date:message-id :references:in-reply-to:accept-language:content-language :content-transfer-encoding:mime-version:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:list-post:list-help:list-archive:list-subscribe :list-unsubscribe; bh=eNLmgsT37xu056T07ppcTD5kslY4oVW1SKTrl2BY8gM=; b=HndPadMEEKOykeVVvsst/XBHyUnxYX9EjfPKFHIbQeHJognSzBXNuPh0UzQOWXOmXa sJfGDLXPUk7vUwG9tferQhQk1WrfHrPTcDlNrdASLjrDrZ2KN4OL+D5jQmfv1E6f7y2G n2q5CSE5Tz/haBv3VZpeBPoiGRULfxzFa5W978Q/h7jcfjUgExzJ5Of9+ODw1Q9yqDpu 6L1xblEO/SARtngLaSoZXOu71X4SrGhfNU4oQ33zhVn97331o+ZK1w9LwVWSL28xuTdu qyXf/R7AFPf1tQPE9HSspcx6fSiwwvdLF1CQAzc3NJWcKqs0DM X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:from:to:subject:thread-topic:thread-index :date:message-id:references:in-reply-to:accept-language :content-language:content-transfer-encoding:mime-version :x-original-sender:x-original-authentication-results:reply-to :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post :list-help:list-archive:list-subscribe:list-unsubscribe; bh=eNLmgsT37xu056T07ppcTD5kslY4oVW1SKTrl2BY8gM=; b=Lj8+N8/qqjW46iDF7q4KqhwIjP1OPFYoCk2LsCgWUA+2JM553nA4bBIAuQ/Gg7Zyiv y4j8IEs0ZorB3InpkHEoD4B/8yuttKXqtbmqdSvTiQujIoiXhwflmPy78IgXv62Ax/Ol XjoTz+XjuLnqH+HNZ92nG01hTtVKaRxoTO9puZkkr2nJMAaYKZRA07p2qYka5GeM5a0b G7Ns6IeybzF7X5KAXTs/mS5N1BYoRHjLvCUlwMKTFFpW6bGIbqbnocIiTR6hmtcNVpmp xtAQX Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOAM532r3+bi2eHOCC5iTh2veDYtSEQvRklBZF9HW+3npDhh5LSDq/6N 2NGhExG4FDk3dXua+a5dXMw= X-Google-Smtp-Source: ABdhPJy6zFiVyUugY6c0JiscUZXRC1mohyeVDjBsLKv8EF1pF+SEmfe62Nw8duJm8Fzn+1xxoqybiQ== X-Received: by 2002:adf:b35a:: with SMTP id k26mr550084wrd.26.1623917532875; Thu, 17 Jun 2021 01:12:12 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a5d:45c9:: with SMTP id b9ls421790wrs.1.gmail; Thu, 17 Jun 2021 01:12:10 -0700 (PDT) X-Received: by 2002:a5d:47a2:: with SMTP id 2mr4113837wrb.353.1623917530845; Thu, 17 Jun 2021 01:12:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623917530; cv=none; d=google.com; s=arc-20160816; b=iE7pi2wSbBzLHDjbHvjE2/Q1d+73P9d+X8QDLnhPfN3erIZb6e7/HxcOEs4cX6eLmm mRYBgbnn5TFme+LcwlEAKGjRY2L5jZgJUDezgn/fJI/Di9IbLIJ2KPwLxsUM5bEQU2qI c6InKYRGNrfq7JBRcvJKfQ96fs+WLReQctbImQ9LYpIAF9GAFtlBulbR3pUuWBC59P0R 1Y75olbmoqJumKKUux6jU4DNg9Fcna8qGLoFSsH7ZDIc1Zdd4L+LKpniehOPNfZbZPwq SpvwFNspHbXWIuOSxiH1SHxA4QV0alNhW2+HJfxpXGhmMR5LQJAI04N6bRBaCvFGLn5V BUuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:content-transfer-encoding:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:to:from; bh=XCnM/5/Y/UN1EFsSBsmeKRYKJ2ZCaCjSP/HYRpnEgmM=; b=0mmXszUdXuEAJ4By8lOjM1XaGlWij2kJ9SM1D+Nl0PIVfNW7crSZeGFVDdyFCcOcOS OgWcRcYgBnogvrtNs14u4TqP5ohaNGEYbIW8VMTyn8Cz+uVyJFGY5VtA/XxQLrdj38DB mrnG6eJoKfTbqLhC5+df4DSFz1CEBdpA6q5sHbi3NZS6rgV6bqIIDrNC0NST3u8R6KDb WhqXB1nH1uovNKzIVzw4+ThmdqldyyFCGQVrIJNxSA0Yylb7nVc2IfDAlP2sqO03NiI3 zIrV72wCXKKYJvIy5/yWGBoXtU/SyCEtwUvB36pV/CMq/wTyLYxoTGqDfLwTcLZmlRTZ zdlA== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of denis.maier-NSENcxR/0n0@public.gmane.org designates 130.92.0.83 as permitted sender) smtp.mailfrom=denis.maier-NSENcxR/0n0@public.gmane.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=unibe.ch Original-Received: from mailhub-lb2.unibe.ch (mailhub-lb2.unibe.ch. [130.92.0.83]) by gmr-mx.google.com with ESMTPS id c4si385851wml.4.2021.06.17.01.12.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Jun 2021 01:12:10 -0700 (PDT) Received-SPF: pass (google.com: domain of denis.maier-NSENcxR/0n0@public.gmane.org designates 130.92.0.83 as permitted sender) client-ip=130.92.0.83; X-Virus-Scanned: By University of Bern - MGW Original-Received: from mail.campus.unibe.ch (aai-edge-04.campus.unibe.ch [130.92.13.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mailhub-lb2.unibe.ch (Postfix) with ESMTPS id 91AF9500078 for ; Thu, 17 Jun 2021 10:12:06 +0200 (CEST) Thread-Topic: Fenced Div to ConTeXt Environment (was: Markdown Fenced Div to LaTeX Environment) Thread-Index: AQHXYr0sGMc1dR8TLUq6O7E+1ZxI1asWyMKAgABF4oCAAI3pAIAAB8kAgAAQ/QCAACHcMA== In-Reply-To: Accept-Language: de-CH, en-US Content-Language: de-DE x-originating-ip: [172.18.72.2] X-Original-Sender: denis.maier-NSENcxR/0n0@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of denis.maier-NSENcxR/0n0@public.gmane.org designates 130.92.0.83 as permitted sender) smtp.mailfrom=denis.maier-NSENcxR/0n0@public.gmane.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=unibe.ch 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:28626 Archived-At: Yep, this is also what I was getting.=20 But this minimal shows how to make it work: ```lua -- works function Div(el) return {pandoc.RawBlock('context', "\\start"), el, pandoc.RawBlock('con= text', "\\stop")} end ``` vs. ```lua -- does not work! function Div(el) return {pandoc.RawBlock('context', "\\start"), el.content, pandoc.RawBl= ock('context', "\\stop")} end ``` So, this here works: ```lua function context(s) return pandoc.RawBlock('context', s) end function Div(el) if el.classes[1] =3D=3D 'intro' then return { context('\\startintro'), el, context('\\stopintro') } end end ``` Maybe this should be a bit more generic though? ``` function context(s) return pandoc.RawBlock('context', s) end function Div(el) if el.classes[1] =3D=3D 'intro' or 'question' or 'solution' then return { context('\\start'..el.classes[1]), el, context('\\stop'..el.clas= ses[1]) } end end ``` As my lua skills are far below mediocre I bet there ways to make this nicer= , e.g. by putting the relevant classes into a table and referring to that. = And you may also want to pass arguments from your divs to the context \star= t...\stop construct. Think of this: \startquestion[difficulty=3Deasy] How to build pandoc filters using lua? \stopquestion? Denis > -----Urspr=C3=BCngliche Nachricht----- > Von: 'juh' via pandoc-discuss > Gesendet: Donnerstag, 17. Juni 2021 09:56 > An: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > Betreff: Re: Fenced Div to ConTeXt Environment (was: Markdown Fenced Div > to LaTeX Environment) >=20 >=20 > Am 17.06.21 um 08:54 schrieb BPJ: > > --filter/-F is for JSON filters. Lua filters need --lua-filter/-L >=20 > Thanks a lot! Now the error message is much more informative. >=20 > This is my filter: >=20 > function context(s) > return pandoc.RawBlock('context', s) > end >=20 > function Div(el) > if el.classes[1] =3D=3D 'intro' then > return { context('\\startparagraph{intro}'), el.content, > context('\\stopparagraph') } > end > end >=20 >=20 > This is the error message >=20 > Error running filter filter.lua: > Could not read list: Could not get Block value: untagged value >=20 > Any hints? > juh >=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-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit > https://groups.google.com/d/msgid/pandoc-discuss/dc8ef20b-4a8b-c385- > 704c-28c85a5b6820%40mailbox.org. --=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/4396a9133ab74e4fbff486f09e22d254%40unibe.ch.