From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/31457 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: jcr Newsgroups: gmane.text.pandoc Subject: How do I write a standalone document with pandoc.write? Date: Sun, 25 Sep 2022 03:25:54 -0700 (PDT) Message-ID: <0a27b0df-a58b-4a4f-bb89-1a22e4ca6a07n@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_3332_434429740.1664101554709" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13601"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBDQLFNXWVILBBNGZYCMQMGQE5YLOSHI-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Sun Sep 25 12:26:00 2022 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-oi1-f184.google.com ([209.85.167.184]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1ocOpj-0003O2-Kv for gtp-pandoc-discuss@m.gmane-mx.org; Sun, 25 Sep 2022 12:25:59 +0200 Original-Received: by mail-oi1-f184.google.com with SMTP id u203-20020acaabd4000000b0034f684ca118sf1136192oie.7 for ; Sun, 25 Sep 2022 03:25:59 -0700 (PDT) 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-sender :mime-version:subject:message-id:to:from:date:sender:from:to:cc :subject:date; bh=4CjaLN64VPKdEhO3TWpFjR6tgDa/CuIAdFKZfLQg+O4=; b=r/U+mW1a5H+ir32t6Zi0Wkq6hjd6xULDzsQ75Z2DoxdDQcceJnsHroy9r8ENX1aayG trG+JqmQBtnUoAMgM09aRit6ADV/mYIEexEyqMueNl7n5x1iy47+e1yQvg8ZeCdm+UC6 8dGPOXSGmSPsDr4v77xLDQ3FvNhJa7Sym6iFnXWEpLF7JwUKCRNLuh0WGQFX030mEJh2 9U3rGQMv/Ug1gpU0eWZxOxM0/gpe9gcVNQzloMjgCS4iB0/vlBOaBjQbrqZKRQvwFPe+ LKpwsVNSz0bc4tvEz8vXbBXZRwSVVZyMm9wCuQoPtxAIa33nTB757FtHEyw4MaIXuOQn K24g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:x-original-sender :mime-version:subject:message-id:to:from:date:from:to:cc:subject :date; bh=4CjaLN64VPKdEhO3TWpFjR6tgDa/CuIAdFKZfLQg+O4=; b=iN62q+gUi+ppR300vG3lBOlQ0iF0QlJi/ZmDlNEPLXrQZ7mwGWDiLzWg51PnsrIXii HOyem9Y/qeHaIRuxld5xIrBjac1YR8+4hE/U09mBVaPWkpcwHSrliitOPV74kDqEB9/z qmR94hNqbbNlsROePOXir6YfRHrkW04j2usoHlLAlqQ10FH3mr/3xk0rcG79lAF2m6Ri FD1qkpOEwz1N8XWBVX6CVP79Nj80uD9O0qM/CR2UHg6YC2Ij6X7IPxskhNR9Zrq0PMnF qWn964vZkEAZsd1gjwAQQXwq9qzrV0UQH8MrsxRybP61epRsdWp10QIYZ//p9Qhm4RKG kQ7A== 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-sender:mime-version:subject:message-id:to:from:date :x-gm-message-state:sender:from:to:cc:subject:date; bh=4CjaLN64VPKdEhO3TWpFjR6tgDa/CuIAdFKZfLQg+O4=; b=vx5Lf288EO6CQBkmye+mQOOfndoR0v0+GnU0ZQN3per+C8V0tfs8LHZWOAy20iixHu jrPDzciqzKGv3/vMfLnMuEfnGfHPLB5BlyRrXhy3pp/gVoGsGuSg2RA4z/Pg7jzi9GLz /k6mFbQ7zlfuZT/h4qs4WEexXFNh667sQqn4lZiXeDwOTfYxTA/cvllbAOIzbb2Mf48p xPvgux3Sduu9UKNT9KjKQSXRc2cHfv94jq8cZn3Z7GrOwy9Jmpy254a9ZNxZ4liTLJJ6 6/Pm3Ay+c+rpoPNkeZhPw0q/DHrIyRbXkyGGOIz16nPGKoXtv97GyiCuaC4g1uf2YKoF ASuQ== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: ACrzQf1ujEfY5B9clFow1Ko9EQIh7rgviG+C4zTMJ1bYHCop6nd6yzzz w8QV6xODUABdeB2N6oJa5I8= X-Google-Smtp-Source: AMsMyM6KcpnyqpRJtuY/5Kzd8PEe8qfT+8kPhkb61Oe7poutpnwZdAADEhPk6zfg3QJ1pt9QOg850Q== X-Received: by 2002:a9d:347:0:b0:655:d0f9:ccea with SMTP id 65-20020a9d0347000000b00655d0f9cceamr7994319otv.16.1664101558378; Sun, 25 Sep 2022 03:25:58 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:aca:abcd:0:b0:350:7193:96b3 with SMTP id u196-20020acaabcd000000b00350719396b3ls7609555oie.3.-pod-prod-gmail; Sun, 25 Sep 2022 03:25:55 -0700 (PDT) X-Received: by 2002:aca:38c1:0:b0:345:8c44:f2bd with SMTP id f184-20020aca38c1000000b003458c44f2bdmr13018412oia.80.1664101555514; Sun, 25 Sep 2022 03:25:55 -0700 (PDT) X-Original-Sender: ffi.appdev-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:31457 Archived-At: ------=_Part_3332_434429740.1664101554709 Content-Type: multipart/alternative; boundary="----=_Part_3333_329928082.1664101554709" ------=_Part_3333_329928082.1664101554709 Content-Type: text/plain; charset="UTF-8" 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. -- 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/0a27b0df-a58b-4a4f-bb89-1a22e4ca6a07n%40googlegroups.com. ------=_Part_3333_329928082.1664101554709 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
How do I tell `pandoc.write` to produce a standalone Markdown document= (with YAML metadata)? There's no `standalone` option for `pandoc.WriterOpt= ions`. I thought setting a template  might  work,  but it do= esn't: the saved file does not contain a YAML block, even though the docume= nt has metadata. My attempt is below:

```
function write_markdown_file(doc, filename)
  local options = =3D pandoc.WriterOptions{
    template =3D pandoc.template.def= ault('markdown')
  }
  local data =3D pandoc.write(doc, 'ma= rkdown', options)
  local file <close>, error =3D io.open(fil= ename, 'w')
  if file =3D=3D fail then
    io.stderr:w= rite(string.format('Failed to write Markdown file: %s\n', error))
    os.exit(1)
  end
  file:writ= e(data)
end
```

I'm using pandoc 2.19.2.

--
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/0a27b0df-a58b-4a4f-bb89-1a22e4ca6a07n%40googlegroups.= com.
------=_Part_3333_329928082.1664101554709-- ------=_Part_3332_434429740.1664101554709--