From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/31459 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Albert Krewinkel Newsgroups: gmane.text.pandoc Subject: Re: How do I write a standalone document with pandoc.write? Date: Sun, 25 Sep 2022 17:22:47 +0200 Message-ID: <878rm7scie.fsf@zeitkraut.de> References: <0a27b0df-a58b-4a4f-bb89-1a22e4ca6a07n@googlegroups.com> 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="10654"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBCZJF7XJTILRBLPFYGMQMGQEOAT5DEI-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Sun Sep 25 17:24:33 2022 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-wr1-f58.google.com ([209.85.221.58]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1ocTUf-0002eJ-NS for gtp-pandoc-discuss@m.gmane-mx.org; Sun, 25 Sep 2022 17:24:33 +0200 Original-Received: by mail-wr1-f58.google.com with SMTP id i26-20020adfa51a000000b0022c8fe3f26csf541890wrb.15 for ; Sun, 25 Sep 2022 08:24:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1664119473; cv=pass; d=google.com; s=arc-20160816; b=rr+X7wFbLXQajSUwZHYLpEMYN0Zws1VP92fmwAeq40iJV2mfJJgNjNrchuQ/30Njcd iHs1Ah+5oWVaSr2Mk4O+ODCkQvYCjmQ9W9WM3GeUFADTJs74L4eBRzVjinU2NxpfAvwu LYOROYvEdYv+KRgJZ+tY96nZE7RJX12f8rEUAjSxXKw4f09QdQdhchy1afPTmSnoEfGI mjLYtSD7C0DoWkMz0ungXaDSv4N6wuWQM5J8xzcOHYYKpBj6e+RxnS8hCkCztVWl5dSL /ez2+j2hk/BsHa3b2CC9S9VsA/iRtEDezJb6fSu7vw4zPhixMhrlHzqm7zboDkVlEdWL goEg== 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=lI/FPk5kKFVuQOrdwEHwbA7vlhEoownXHSKF+2Vkhbs=; b=vbJlEZ6F29Q0nT/cca+TgRuQ36Wv9YrcRxtMoGXg2c6y/jiaOymB1SZR6Lo1rf9fb7 OvSt1l3L2au9hn5DwkXmSuCCaTAhV/C+HizF8xHLrQaim6Im15FV/X6IZpT7umoaO80U mqcS+uFs2L3tQpdlLJXh1zGB1RXZyqKsszzN69aat7swDcyAW0BCmkBS/ISqr7PnLgNh MhLcBQ512SR4VrjWfak9HHdXDn+9+NeXfvW3W6x98HvRviPHR/HdTK+MuRMEikhw8D9Q gTC15BfApDOqMgPuFEXNSCy8VjU0vVf/JljchGw/NsBfVropBZ9F1ma9nnRVXUpctpGI d8jQ== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=pass (google.com: domain of albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org designates 80.241.56.151 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=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to :x-original-authentication-results:x-original-sender:mime-version :message-id:in-reply-to:date:subject:to:from:references:sender:from :to:cc:subject:date; bh=lI/FPk5kKFVuQOrdwEHwbA7vlhEoownXHSKF+2Vkhbs=; b=iSUVpPnEYU8TB6/yJlNU9WmU931l7/8aD/34upyPzDHqJhm1vuGXiQf1v49IkMMypb hMYEERikWXv0eun8dD9+ak6TkyDBoveTEGWRqUep/zLASe4w5dpNCbRfgLxbCzByC7lo 0WtCgDxZ0EERITVz9ug5nc6NbFGSEns71ZffuW9i2e7SI1jxwkWpXa4QEFZ0mywRarcy CAYoIYEgh2XHDPTcBXfmbWwmNQHGPszlJ1LikY8PeGUjymZIYUzGPPmWQVscXfD25nkm UaQp9bs8b8MxSLqyHL4Cqw91qx2pxQXhxY2nvyQ6ghGz42v97Ccrr/mfRhPCcoYjidYa WlVg== 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:mime-version :message-id:in-reply-to:date:subject:to:from:references :x-gm-message-state:sender:from:to:cc:subject:date; bh=lI/FPk5kKFVuQOrdwEHwbA7vlhEoownXHSKF+2Vkhbs=; b=0PSoewqPyTfmQfZYUjbiR9urL4NKxS+zq8aGZyLrX7Po0KBt8PpGySWh9NfdGCVfuC 8msZs0A1tIUJlKEMyymhltzzXCDhB/RKZY3xCx+HroXmgwy5ogjYCw2STX6UhG392z1f NVlO7KDleRj5GdH4cZmv6erf+UHqIIlhMWgjxzqa4SWvhCAJLuLM4Jnpj1bAU5rigTHq dFVsIQqad82yvveENPA89TWOWfLLjMCUTIDvUQ/2O6ReLD1At/2bXW/F/eOfvZDMjAtH l0zkjMMe4CX6ZJbGL/bx1tuKAfzG5Vb995QVtO7Bc3RePh9HKmH9y/+648vYztZk4A0X Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: ACrzQf0jE3Vf1wcFAGQ/CnDYdP9lydC7fzdtSk+Uo3jS0tuv+8tWaqN3 FxqG2CwsDmIXUolylPsUQdc= X-Google-Smtp-Source: AMsMyM7SIPD/2mdm7/egsvuTBcxBsP31X9Adg69DTOulCEcpTeyHxHlUiKxOluHqlmpOHPJ0LFr6NA== X-Received: by 2002:adf:a4ce:0:b0:22a:f5e8:6dcc with SMTP id h14-20020adfa4ce000000b0022af5e86dccmr10431283wrb.445.1664119473177; Sun, 25 Sep 2022 08:24:33 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a7b:c395:0:b0:3b4:9792:b16c with SMTP id s21-20020a7bc395000000b003b49792b16cls7243702wmj.2.-pod-prod-gmail; Sun, 25 Sep 2022 08:24:28 -0700 (PDT) X-Received: by 2002:a05:600c:5014:b0:3b5:889:58a5 with SMTP id n20-20020a05600c501400b003b5088958a5mr10370841wmr.140.1664119468614; Sun, 25 Sep 2022 08:24:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664119468; cv=none; d=google.com; s=arc-20160816; b=z5fuTsyJliZsqKHAemJfjyYO1Tv9aCjDh2o/Vieopu6FyLPhO7i/OObKHNAgNw36ST fzqgz4leET7xi5uom10Gy0WmX4qmMquay3rhoM3kZ+KLhuT4dYogcuolQ5fH/pC3jw/9 DS9ve97cZLt1vl64Bq8uLkw2PbI66zaiMlcsYhr6zSZnuPvvLjhCZDmMP85dAypGKtoE ti6Yr+tTOHm5DyWqJ9Xd8HncPWc6WhdVyKtcboTs4fYeN1VuBOuaNVEtgv8whO8yuGGD 4M4QchrvFRcfFBlroZiGpAVGPHpDTTuazOp4xyiJw/xsVTuoFMnU2sFkPmqCAzysYPYc UyOQ== 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=bXuxaoUiRPCNPC7SmP1FdxMdVWESFZreqjizCeKj4lA=; b=FDVFAuyFn5ZQnKVhgkhqDCiZEBH7VPQqIVs6WHDURN3Gs8XbZrWxE2o5CwSkpy0wPT Gqwe7VEBuD99RUGe3eFT+ozLtY25es7aAZL+Z/tIMuk2SyrGS38qNCJCpLLoevg3IfBI xsQo1G9UliZRWEutO6mm0WS3KO2a+vrfpQ+3nDXeR9MFSX1mlPu9xRZTk67ftAVoiPP2 6bgdSU8ZLngbnKJ27vuGJGsxokkHbZ6tsrRaGLmuDDCIuPQYOqTRMw8rkE2yEtgz+qjM sPyRhFfoCx7If2yG5ncNCRQdC6oOYFe7hDiaWmNuNK30vftpVvQs1eRVgxvDTI0lKNbb OwRw== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org designates 80.241.56.151 as permitted sender) smtp.mailfrom=albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org Original-Received: from mout-p-101.mailbox.org (mout-p-101.mailbox.org. [80.241.56.151]) by gmr-mx.google.com with ESMTPS id n42-20020a05600c502a00b003a54f1563c9si260311wmr.0.2022.09.25.08.24.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Sep 2022 08:24:28 -0700 (PDT) Received-SPF: pass (google.com: domain of albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org designates 80.241.56.151 as permitted sender) client-ip=80.241.56.151; Original-Received: from smtp202.mailbox.org (smtp202.mailbox.org [IPv6:2001:67c:2050:b231:465::202]) (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-101.mailbox.org (Postfix) with ESMTPS id 4Mb8nQ3KKXz9sPx for ; Sun, 25 Sep 2022 17:24:26 +0200 (CEST) In-reply-to: <0a27b0df-a58b-4a4f-bb89-1a22e4ca6a07n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> X-Rspamd-Queue-Id: 4Mb8nQ3KKXz9sPx 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 80.241.56.151 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:31459 Archived-At: jcr writes: > How do I tell `pandoc.write` to produce a standalone Markdown > document (with YAML metadata)? There's no `standalone` option for > `pandoc.WriterOptions`. I thought setting a template might work, > but it doesn't: the saved file does not contain a YAML block, even > though the document has metadata. My attempt is below: > > ``` > function write_markdown_file(doc, filename) > local options = pandoc.WriterOptions{ > template = pandoc.template.default('markdown') > } > local data = pandoc.write(doc, 'markdown', options) > local file , error = io.open(filename, 'w') > if file == fail then > io.stderr:write(string.format('Failed to write Markdown file: %s\ > n', error)) > os.exit(1) > end > file:write(data) > end > ``` > > I'm using pandoc 2.19.2. The template needs to be compile for it to become usable: local options = pandoc.WriterOptions{ template = pandoc.template.compile( pandoc.template.default('markdown') ) } Pandoc's current behavior is a bit strange though. You can raise a bug for that if you'd like. -- Albert Krewinkel GPG: 8eed e3e2 e8c5 6f18 81fe e836 388d c0b2 1f63 1124