From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/30353 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Albert Krewinkel Newsgroups: gmane.text.pandoc Subject: Re: Deprecate standalone for readers? Date: Mon, 14 Mar 2022 15:34:46 +0100 Message-ID: <87v8wgfv2t.fsf@zeitkraut.de> References: <87czzbq940.fsf@zeitkraut.de> <87a6uerji6.fsf@zeitkraut.de> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27405"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBCZJF7XJTILRB4NLXWIQMGQEVEWDABA-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mon Mar 14 15:49:26 2022 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-lj1-f183.google.com ([209.85.208.183]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nTm0j-0006xb-Sg for gtp-pandoc-discuss@m.gmane-mx.org; Mon, 14 Mar 2022 15:49:25 +0100 Original-Received: by mail-lj1-f183.google.com with SMTP id h18-20020a2e3a12000000b00247e2a0e909sf6581445lja.7 for ; Mon, 14 Mar 2022 07:49:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1647269365; cv=pass; d=google.com; s=arc-20160816; b=undYdsUZ4vtFjSeyPBY2E1R/VUVLzV7zUbcDFOg407Uz0qbk65btwxvNMCB3o2QBl7 D+sHXEcsy63VfRDlvcjsPxaC7TDoesQ4IW9gZnTkPe3uWyQklFo5Or+7i/uQkvdph/i7 14XuBml8IEjU/yxWH/Q9WVajuwqvjFXeqYaSsDoaoQL5kcAdfhAletFVagy+YDVwysh2 VLHLSxNeoagCx9JjAHqntgqaczliZ7sU8q0WIJCCxMiN2SuEj7vNAG/LErq46HPLK49C X2Lm4fb+sIf6Sk07y6vdZsuecqczBpa+hQFSOA4FU9nS65Qn08C7rSo3wXqDDcFUWBZz IqOA== 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:message-id :in-reply-to:date:subject:to:from:references:sender:dkim-signature; bh=v032ubc6g4Wc02oSkfjz7FxdLREijVnmP1pa89SESAg=; b=MrqkIJYsO57PNCCfJcdMIIrWMx3sMkheZ83irUqcD6mjoTK1MDVbzta66UXpCuEMjX AFOFwYQctB68Xs1P0WwoyXM852KtLMCOjrT27ypfnrna/qfkG77AcBiYmPmvYQsN2wWL y6ec2SZI3SfUSEll7D+T8RLu+YO6M2gYloFJI44P2GfBKD3xkck7KmYd4cvbmL6DENEp KykBpSe9xaKWmFyB7EhH7X1r1m1fAJXwJ0jInxD9dZS6CoWO332WJXMtCgMvAY/hftFz aFRKoMLwUcfhcmiIlP7LkU3CUFBWzKCbK7Qq7al/c4UZCz2JK443Rr/V3sY2ckuHFH78 PoWA== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=pass (google.com: domain of albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org designates 2001:67c:2050::465:102 as permitted sender) smtp.mailfrom=albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; h=sender:references:from:to:subject:date:in-reply-to:message-id :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=v032ubc6g4Wc02oSkfjz7FxdLREijVnmP1pa89SESAg=; b=VpfDHWFPx3/+LnwxgS660eXxoMdVUcs0wXQ9cnpLOHu1BEnqbYU2H3MRmHLu2S1kxF EW4A3v7obU7BwT8NKTHCkV/g4Eh6vpqviFIaJ+3L9lURW/uAPcFMdb6c4qVw+fdJLzBm 0JJ4d6zhKHZmOIiuoCcYGjVyW6/xo+B3ZRHnc8fsL7lwiBFIwAaLpT+YC5hEaNrp42ll LTSltKiJuIuU3Ao2M9pYoZB9YuuXKBPAC7AsGfjS2MXUKM+Al0SZpP1TVsSHNMhfITu7 pqBNl7rTRpOhTP/LUhbkZBaO7FS5TKLG/Fnj+SkxCVkdyDDzDqPmBFZeUVl7IzKxrX9+ g7OA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=sender:x-gm-message-state:references:from:to:subject:date :in-reply-to:message-id: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=v032ubc6g4Wc02oSkfjz7FxdLREijVnmP1pa89SESAg=; b=LviGCbezIyNuTdAbA9ddlCIP6aZJ7cVo/US0MJy1HagMraGDtA9kXhWtUrGS4gKdUc HS+XLNL3mIpJKbX0pfFIAkzOBnBiknA5v9I9iRXiYHoAy2gIPpXgPoue0NwqWrwhHCi9 8R7cktjduPlUBYcbfHjknPUsmGxpqq0wKOfqd5kGwVW0KcbuddXvU/OuE14joV++1tJ5 iD3vLB8xxv76oWtm9OMOTV5mb6a3Sq8RobS9OVuCN5R03uYUEiutKkAz4+Rq3gCNSSwJ o/xhd9ADvN0fFLS+MLg6Q6eFNsKmti+zfBsF8MPdFZ7akVyGc3C5l/23Uby9rpVMznyP PVzg== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOAM533GqPimFXdTsHOmqb7/CKVRSpDLosd7mZ0eyqFVICYsQN+qyx1y etnccoHWCzwUyrhGMm9dsJU= X-Google-Smtp-Source: ABdhPJzvJAchX/YgKQkYXzT8jkqHqPztFQNsd6Ql7S+vn+0e4IcKvUy+n/lVPKHZOikLOw3hDcSbEw== X-Received: by 2002:a05:6512:168f:b0:438:2591:7f5d with SMTP id bu15-20020a056512168f00b0043825917f5dmr13518999lfb.690.1647269365289; Mon, 14 Mar 2022 07:49:25 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a2e:b710:0:b0:249:1800:6d81 with SMTP id j16-20020a2eb710000000b0024918006d81ls1494174ljo.0.gmail; Mon, 14 Mar 2022 07:49:20 -0700 (PDT) X-Received: by 2002:a2e:87d7:0:b0:246:1466:c43b with SMTP id v23-20020a2e87d7000000b002461466c43bmr14545870ljj.279.1647269360291; Mon, 14 Mar 2022 07:49:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647269360; cv=none; d=google.com; s=arc-20160816; b=GnJdrH1AsXvd5e7FVAPnwMgHxG1OuBMag7GvxSdHbtxjiQ6mZtrsqCpw3oSgwLk+A4 wI28VVsAIDxfVavCG0LA/cMr0d4wi8+m8Fdu/7+TFPG8ONo794kplc/x+2eamMjHsasX 6avWmHXJB33V3FTyA/dACYLXsKV6WbBcmUMffPavOrntP+AyHXAvlCw6qBKNPig3tjS9 VqKSeBnyLfdTTVlpN0y1/fNesFUV5qbAJfX7Z9x4uTFNqmbaVu4KadyXtUBCQlKAxDxm uArJN0P5pd7On8nAPJvSelmO4iWXRoETxSe9Zgn5LEd6MmCQE4FWia0MbQfRttg8YDxO zFbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:message-id:in-reply-to:date:subject:to:from:references; bh=As+3zPV7SzXGc2NL1L6RK2QOrm6KH33l5ZtXryDGcoo=; b=Es7iG+AvyfBZcRovU0yt6rMS0i7IKR+EUcl0m4YRTl+51uZrbeK44i7E7f0jn/y0LT 6PC02BtJqDFL81017yTWotO+xeDOazLapP5UMkU4e0eIRroVhAQYmC9yFlXt064FvGAb yf0+/p3ofrXmqoztJjqhrBlLr5i2nHlDi1QJRo8oRQ6c0Ji9GwURSzvBfdtyp6fFocmo OILyQugbQdUZlarazbKflcJlZX3xYCan8tFcxBGa5dcCVPXdgZrbxQkKmxS8Qe+ESw9V xDFrCgKqkBfMsgHYUWDa0XZXtMxFeJ8SodB3QlvUV9BPr5zWERAMAt8zDNIPFh5X1pCX z7CA== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org designates 2001:67c:2050::465:102 as permitted sender) smtp.mailfrom=albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org Original-Received: from mout-p-102.mailbox.org (mout-p-102.mailbox.org. [2001:67c:2050::465:102]) by gmr-mx.google.com with ESMTPS id f14-20020a05651232ce00b004485667be5fsi876771lfg.1.2022.03.14.07.49.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Mar 2022 07:49:20 -0700 (PDT) Received-SPF: pass (google.com: domain of albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org designates 2001:67c:2050::465:102 as permitted sender) client-ip=2001:67c:2050::465:102; Original-Received: from smtp1.mailbox.org (smtp1.mailbox.org [80.241.60.240]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-102.mailbox.org (Postfix) with ESMTPS id 4KHKDv1Mfhz9sWv for ; Mon, 14 Mar 2022 15:49:19 +0100 (CET) In-reply-to: <87a6uerji6.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org> X-Original-Sender: albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org designates 2001:67c:2050::465:102 as permitted sender) smtp.mailfrom=albert+pandoc-9EawChwDxG8hFhg+JK9F0w@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:30353 Archived-At: Just to bring closure to this thread: The new custom reader feature makes the effect of `-s` on readers a non-issue. While still awkward, it is easy to work around via a custom reader. See below for an example. Albert Krewinkel writes: > John MacFarlane writes: > >> However, there's a reason why those two readers are influenced >> by -s. reST has a convention that a heading at the beginning >> of the document becomes a title. But obviously we don't want >> that to happen when we're just generating fragments to >> include in a larger document. So we need to know whether >> we're generating a fragment. >> >> I guess what you're proposing is that people would have >> to explicitly specify `-f rst-metadata` when they wanted >> the fragment behavior? > > Yes, that's what I have in mind. > >> Could the specific issue with reST metadata be solved by changing the >> reader to accept multiple entries? > > Maybe it's easiest if I describe my concrete use-case: the goal is to > determine if pandoc could replace docutils when processing files like > this one: > https://github.com/scipy-conference/scipy_proceedings/blob/2020/papers/pydra/paper.rst Here's the custom reader code I wrote to handle the above use-case: -- Convert definition list to metadata. local function deflist_to_meta (items) local meta = pandoc.Meta{ authors = pandoc.List{} } local author for i, item in ipairs(items) do local key = pandoc.utils.stringify(item[1]) local value = pandoc.utils.blocks_to_inlines(item[2][1] or {}) if key == 'author' then author = {name = value, institution = pandoc.List()} meta.authors:insert(author) elseif key == 'email' and author then author.email = value elseif key == 'orcid' and author then author.orcid = pandoc.utils.stringify(value) elseif key == 'institution' and author then author.institution:insert(value) else author = nil meta[key] = value end end return meta end function Reader (input, opts) opts.standalone = false local doc = pandoc.read(tostring(input), 'rst', opts) -- treat initial definition list as metadata if doc.blocks[1].t == 'DefinitionList' then doc.meta = deflist_to_meta(doc.blocks[1].content) doc.blocks:remove(1) end return doc end -- Albert Krewinkel GPG: 8eed e3e2 e8c5 6f18 81fe e836 388d c0b2 1f63 1124