From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/25796 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: BPJ Newsgroups: gmane.text.pandoc Subject: Re: Verbatim text in headers Date: Sat, 8 Aug 2020 17:33:15 +0200 Message-ID: References: <20200805170053.048fb8de00100ff64b866bd6@gmail.com> <20200806231710.dd08c7f61a90ea23c708d507@gmail.com> <14a2d64c-3044-5d89-0412-fc06c7f40a7c@gmail.com> <20200808151809.d2878d07de78b0b3f6606673@gmail.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000004c88de05ac5f71aa" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6722"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBCWMVYEK54FRBR4LXP4QKGQEVCVPGDY-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Sat Aug 08 17:33:32 2020 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-wr1-f59.google.com ([209.85.221.59]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1k4Qqg-0001bm-7L for gtp-pandoc-discuss@m.gmane-mx.org; Sat, 08 Aug 2020 17:33:30 +0200 Original-Received: by mail-wr1-f59.google.com with SMTP id s23sf2090624wrb.12 for ; Sat, 08 Aug 2020 08:33:30 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1596900810; cv=pass; d=google.com; s=arc-20160816; b=BGBIlscq2YVxMBhb5+5OFIgl5vHlJST2QONbUVRW1esQoWVCYhYeWWjN1JZKxrid+R QRaJ1ZpUi9oG9nTSRncEhmBSz24P2Y/SvkR9QOKFWiZhqUSCSWTvsOqNzhYpS3T8XI6H UmIRMCIByETV3bmFCKJeH95Kr5Ip9ZgvpQcaVD+m8MCOyHzsM0rjUIclqMM+ISfUmMDF fdZ4Ahk2wbf0YYkaOJt4JUFgqIS0DmvRMLxBxIyQQR5Q5XhHo2fOpiuWuFWQMkGtISft M4mA+sWpcRiy4Ajdqrl/dr3GLEBjLdX/LREJRr2+0qkNV34FU7XGc0xfmMgMO6lfG+nb bu4A== 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:to:subject:message-id:date:from :reply-to:in-reply-to:references:mime-version:sender:dkim-signature; bh=VxPKJPLKfp1pMJjBTkbPbX3ucIEs7vJz9k2bf2pHgtE=; b=0idClbH+9hrYv3wRuRo1WOgnXVjcHaz7BJtLYIh4SMVNLFKqlZRMCPPOpu+SudVuzm R8Gu8HjzIURIrq0e9fYjKnw7Sb6xMx1kjqT8U/Qbzr3vF7pQl3zg+yVHIYJuJc7I6Di7 x048qSvVLRcp4SVEUnDt+ibOqtdchqXVS47lh1TUYT03zuhGBGO5QqPR35WPRZiFajv0 9T2gFinGu/v721aMwmZtEzQF+Yr4gMs71GRxX1O6CNwL7zbIOAmBB5X7HvjOBsjvEtwr lukBwUP6xS0S62bau5B1To06abmNvhjjCWsy/EtZ6TPJ7EwGZlKt4yzguvgyTEfNpGzD IwQA== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=pass (google.com: domain of melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 209.85.208.180 as permitted sender) smtp.mailfrom=melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:mime-version:references:in-reply-to:reply-to:from:date :message-id:subject:to:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-subscribe:list-unsubscribe; bh=VxPKJPLKfp1pMJjBTkbPbX3ucIEs7vJz9k2bf2pHgtE=; b=hAWtkvpqpQMHFEIt3crxmBOidOoX36JF9nhtPUpX+NCAnFhJnCx9iN0YpswL/BHr0e FaKZ+tS4vCX6PwTFFEcJMJQp6VzvTxxQBfEU6yKx8kYXmofBhRP3QlUnxn10Oaa63Sje /g95hKNnjKF+R81ObIIkDLi6zB4XQ5+PWTLijLM/yNpoRzmNTqGkYcIw5gbq+ZiZP4N+ 4uEFalUXCD05CJ5W591DCbWuZMEMnZRmxXJcwVACWJz05O7M4vl4MmHOir3oIfs3flJr 7grsHHwq5TOFpzoXzFrmFgFEn0EPvLVsEwsrYFvrsTm37oefhAoa6l8PUNu5Ox0EYjN0 a6eQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:mime-version:references:in-reply-to :reply-to:from:date:message-id:subject:to:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=VxPKJPLKfp1pMJjBTkbPbX3ucIEs7vJz9k2bf2pHgtE=; b=pkQ/40ljmaej86VGuf4u85fznfy+mToqSaYuc+fGkuZW7g6QLHTLyQYa1h6xyuaR3G Hokj4HveHf5ddOb/Lt1n9iWit3gMsIDOIhl72Pedig1eWLGnM9OPGDWPrmjOO7QI7R5D EkpRD367QAt7lZq4n469Qn4RCTxKnl/9LCHTYPfsQ/5yxoUgigSc9aq2PVPfdP4KLiJT PoCBRlw5l7g3llwyZgxI8OJKOFYsMOyyV4/LK2rCn1DnAiu7d7AwU2L3HqhnAzRbMlPM mpARXYqY1J4hekAiMlUoEEM8jwpKuJsWANxJkOgIAmkXvmKs+Bfee4MsIXQp1ABJBl13 XJog== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOAM532M0QNeqxTX7Ow71JtKLP/cboeejhcL72tWTxX+UMo52+9TkzVe qTRngd3c4I/bCtW3pV/dVhU= X-Google-Smtp-Source: ABdhPJzDdUZfCORRoED9s/fSIeBu8t7cGZgcB11lEBxJA6DbTU35A81IeiEb+D2VJt8HQEPBEHX63w== X-Received: by 2002:a1c:b6d4:: with SMTP id g203mr18158672wmf.92.1596900809859; Sat, 08 Aug 2020 08:33:29 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a7b:c304:: with SMTP id k4ls5569495wmj.1.gmail; Sat, 08 Aug 2020 08:33:27 -0700 (PDT) X-Received: by 2002:a1c:62d6:: with SMTP id w205mr18717540wmb.154.1596900807311; Sat, 08 Aug 2020 08:33:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596900807; cv=none; d=google.com; s=arc-20160816; b=zMaRBwLnTDpltHjdTpN9+LZKQXX8UqAI7xBo4ASgwbZVUe/SVLQDVN4qgg/10RjnNQ 4JzhNE8jMZCstWazVCrQqMFnALnxxIB+YRo9i0dbfrnkdJdeUhvnuWxrO6mUCvWdawv7 40oAz+DEKUjfDIqCI4BzYGY0hI+Vdfr9oPHeR8ZfBCwmS070DzzR7Kw7ySSVjOd9Qm42 R4RWqrVQcx0a2GqU7Scz4On8Ev/hKfwq0QtCChjQRhovbzYaK4njcXjbUPOqA91lb+ae khZdl4v54cEQ2P42rmmzDMoq0ZFLoe4r0wubqM47p09677G4glY/LJKvrH3ajtj4uUOB sQMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=to:subject:message-id:date:from:reply-to:in-reply-to:references :mime-version; bh=k7xbCrj+MYD0q5BTOkZUDSx67/LHQVRmlxjIWXRiNAQ=; b=vKECMmxVRVnf2d8W/SBZX0ad4V/wa8W1a3cmPdCvscNgijKYmPiVu9xNXqf3T2HIll uJBHT+QRemHtQR1a1sTjfPJv862Qm2gy5hyqnHg59y4JEKvhHhJJNNP2LzecjGRaNdH1 XjnKQkzKOe6xWjwnxvFYR6WtiUK6PHuiEmgO3PttqRYreMZgKBQ+xHhMY2u81FdQLil6 xzLGtqgVAt0BhQiERjYLPbbWpvdxsu9kEO6xDEhA/xF48Q+M0uRIbKqdxZBC/0Fgicnu DJCyOZZfKCu584nSMZp2yiv7TqY90B/e//BEZ/WT/TZk5kkT/KTgyra9TMLyAUN185b6 zsGA== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 209.85.208.180 as permitted sender) smtp.mailfrom=melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Original-Received: from mail-lj1-f180.google.com (mail-lj1-f180.google.com. [209.85.208.180]) by gmr-mx.google.com with ESMTPS id q186si491134wme.1.2020.08.08.08.33.27 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 08 Aug 2020 08:33:27 -0700 (PDT) Received-SPF: pass (google.com: domain of melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 209.85.208.180 as permitted sender) client-ip=209.85.208.180; Original-Received: by mail-lj1-f180.google.com with SMTP id v9so5231790ljk.6 for ; Sat, 08 Aug 2020 08:33:27 -0700 (PDT) X-Received: by 2002:a2e:a17b:: with SMTP id u27mr8793778ljl.2.1596900806263; Sat, 08 Aug 2020 08:33:26 -0700 (PDT) In-Reply-To: <20200808151809.d2878d07de78b0b3f6606673-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> X-Original-Sender: melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 209.85.208.180 as permitted sender) smtp.mailfrom=melroch-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:25796 Archived-At: --0000000000004c88de05ac5f71aa Content-Type: text/plain; charset="UTF-8" > > Then in your reference DOCX define the "Heading 1 > > Verbatim" "Heading 2 Verbatim" etc. styles, pre- > > > sumably as inheriting from "Verbatim Char" as you > > wish and you are good to go. > > That would be redundant manual work, for a WYSWYM > system should automatically infer the font size and > style for a verbatim block depending on context. Can > Lua filter do it? Can it read the font size from the > heading style and automatically calculate the font > size of the code block based on that? There is no way to *define* a DOCX style in Markdown or Lua, but if you use a custom-style attribute for which there is no style defined in the reference document Pandoc creates a stub style inheriting from the default style without modifications. It is quite easy to create a stub Markdown file with only headings at as many levels you need with some code in them, then create a file using the filter and your existing reference doc. Open that file and modify each stub style to inherit from "Verbatim Char" and to have the font size you want, and from then on use that file as reference doc. It's *some* repetitive manual work but not very much. Sorry about the misindented curly brackets. Lua doesn't actually care about indentation, only about a balanced count of opening and closing brackets or balanced `end` keywords for each `function`/`then`/`do` keyword, so I didn't notice at first. A Lua filter is a table mapping element type names (plus some generics like Inline) to functions. My generator function takes the level of the heading, creates a custom-style name from it, then returns a filter with a closure which will take a Code element and "convert" it into a "normal" span with a custom-style attribute with the generated style name. By calling `pandoc.walk_block` within the Header handling function with the Header element and the generated filter as argument the filter is applied to Code elements within the Header element only. Note that the element passed to `pandoc.walk_block` or `pandoc.walk_inline` is not changed in-place; you have to use the return value of the function, which is a different object. -- 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/CADAJKhC8GAockGYu6sWNZ1_MhpxuVNy-3AUjeJzBPCtUZxDM_w%40mail.gmail.com. --0000000000004c88de05ac5f71aa Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
> > Then in your reference DOCX d= efine the "Heading=C2=A0 1
> > Verbatim&q= uot;=C2=A0 "Heading=C2=A0 2 Verbatim" etc. styles, pre-
>=C2=A0
> > sumably as inheri= ting from "Verbatim Char" as=C2=A0 you
>= ; > wish and you are good to go.
>=C2=A0
=
> That=C2=A0 would=C2=A0 be=C2=A0 redundant manual wor= k, for a WYSWYM
> system should automatically inf= er the font size=C2=A0 and
> style for a verbatim= block depending on context. Can
> Lua filter do = it? Can it read the font size from the
> heading= =C2=A0 style=C2=A0 and automatically calculate the font
> size of the code block based on that?

<= /div>
There is no way to *define* a DOCX style in Markdown= or Lua, but if you use a custom-style attribute for which there is no styl= e defined in the reference document Pandoc creates a stub style inheriting = from the default style without modifications. It is quite easy to create a = stub Markdown file with only headings at as many levels you need with some = code in them, then create a file using the filter and your existing referen= ce doc. Open that file and modify each stub style to inherit from "Ver= batim Char" and to have the font size you want, and from then on use t= hat file as reference doc. It's *some* repetitive manual work but not v= ery much.

Sorry about th= e misindented curly brackets.=C2=A0 Lua doesn't actually care about ind= entation, only about a balanced count of opening and closing brackets or ba= lanced `end` keywords for each `function`/`then`/`do` keyword, so I didn= 9;t notice at first.

A L= ua filter is a table mapping element type names (plus some generics like In= line) to functions.=C2=A0 My generator function takes the level of the head= ing, creates a custom-style name from it, then returns a filter with a clos= ure which will take a Code element and "convert" it into a "= normal" span with a custom-style attribute with the generated style na= me.=C2=A0 By calling `pandoc.walk_block` within the Header handling functio= n with the Header element and the generated filter as argument the filter i= s applied to Code elements within the Header element only.=C2=A0 Note that = the element passed to `pandoc.walk_block` or `pandoc.walk_inline` is not ch= anged in-place; you have to use the return value of the function, which is = a different object.

--
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/CADAJKhC8GAockGYu6sWNZ1_MhpxuVNy-3AUjeJzB= PCtUZxDM_w%40mail.gmail.com.
--0000000000004c88de05ac5f71aa--