From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/18513 Path: news.gmane.org!.POSTED!not-for-mail From: Albert Krewinkel Newsgroups: gmane.text.pandoc Subject: Re: Markdown syntax can't handle BibLaTeX formatting Date: Thu, 02 Nov 2017 22:22:49 +0100 Message-ID: <87k1z84bpy.fsf@zeitkraut.de> References: <90e14ff2-6cec-4dfe-9236-0998cf317b6c@googlegroups.com> <87tvyd4trv.fsf@zeitkraut.de> <87po904ffv.fsf@zeitkraut.de> <20171102202200.GB25469@protagoras> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1509657842 28475 195.159.176.226 (2 Nov 2017 21:24:02 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 2 Nov 2017 21:24:02 +0000 (UTC) To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBCZJF7XJTILRB4UZ53HQKGQEMCVXLCI-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Thu Nov 02 22:23:56 2017 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane.org Original-Received: from mail-lf0-f56.google.com ([209.85.215.56]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eAMxv-0006pc-Go for gtp-pandoc-discuss@m.gmane.org; Thu, 02 Nov 2017 22:23:55 +0100 Original-Received: by mail-lf0-f56.google.com with SMTP id u5sf245409lfg.9 for ; Thu, 02 Nov 2017 14:24:03 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1509657843; cv=pass; d=google.com; s=arc-20160816; b=QUwGuIeMWa1Q3igrZ8fY9eolJwogTmTEoaxVZ+odRg8bVKbuT22w9U8dRDjb8sJY+s Et7yZghWKJAOpqtgVzFoI7oneeJsQ+npriOoxd1iUfD0vWug4AuACz/6j+XjF2RhZfoX lY56ZFr7DhB5bYqfK4zPsZzNuUkw2m6ShV64jjwaWMrdSg1b6dI9ScJ/lYpqtF1AYZ1V ltfix4+MO/CENImZnKK0NIusl24peDc2rYs9rqYVXyQaSPCbbBl0qM7MbruuqcDeTGaJ 1hZGNQOoG7dhZnuk0I1+IdUndjFBGIww1o1rRaxf1O6RHHaK7bfcJGQQbcY+og2sfXgU RvNg== 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:content-transfer-encoding :mime-version:message-id:in-reply-to:date:references:subject:to:from :arc-authentication-results:arc-message-signature:sender :dkim-signature:arc-authentication-results; bh=g1gVy6qBFD0wBlBNdksxqlJHYrTuFp5/mbfvd1+yPX8=; b=m8oDFnMD0F+3e8Va0QeNqndtv0xUrHJhy6mGzNHQdlDToQq3oj6XaI9KD63fbdMKgV 5tl4WP5hSsEZec9wONNzTv5uattVc8H/wKpI9NV6nE9Ms5A4LbI33ubf0dpKXUIstWX+ hD4QWXQehNFs4VhtkCU6zJd4UjSIsyfMD/NBtfUZchxJpOfHtOKwV4TI0hcdttmTOm/V EvcVGV15lBgTpPmqChoHJUSrF/84MUb9H0HzJIlm2i2bJa79ullWtqtMMpVQy6KD1+yA vceoDrL7tuF3esaT6KfwXaRSwe0yT9OpCzeapRdevSsd4pGjS7Rz/YkOoK3Lk9aVvL75 VqZw= 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.60.215 as permitted sender) smtp.mailfrom=albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zeitkraut.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:from:to:subject:references:date:in-reply-to:message-id :mime-version:content-transfer-encoding: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=g1gVy6qBFD0wBlBNdksxqlJHYrTuFp5/mbfvd1+yPX8=; b=rQ+1Lt0tjOiLo3b5pBz8WxJc0eIv7EigQoamBLvGvQ0COrEHWR1klzcaPv/cKasvUd QDewNd/qW3Yr5rO7H6LjWPsgz0xVuWrXX52uRQD65F1HpHosNp5iySQ3FQBAfwcr/IBD +mHOsRiGdPVKxUC6MsCWWJpHT7n9FX56GH79UXApU+rJuJHCitHsX33GpknWO4zSC+hV 7jDlY3Yss4OmjDB0yDwTSI42/+qX511ky31LjcdjaVj/zl8C8kcHv8lGRfC6qayCd2yl vPPbr4IQTCMi+zj7I1IXotp2dYdXxq6e8gtYcYx9sUXqt5EYmJtIAaLLIDO5Mf5mIi6/ uh+A== 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:references:date :in-reply-to:message-id:mime-version:content-transfer-encoding :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=g1gVy6qBFD0wBlBNdksxqlJHYrTuFp5/mbfvd1+yPX8=; b=n9ubYN0G7dGbRvuECcbOukY3t/9KFl0ZkW3wrOrmDjI9cwH+dy4KABH1fV9nhZrlBS h4n12oSD2kt9bchxEbodiD4M27APzg2bDsnovOSbp//fuZho+yBA/rqtb98YrphgUKRX Gm7E3R5AqmpAZmNn0vCssACMUKFf1hBohoCgQOkg8WRtrI2RKQ0HnNxqvQfHvkGH2evq YENaDkWBKDDBFBg/tRN8hjvqVT36qlcqL3gsHqtduF5tnNhWvZQmbJevVT1xYC15O2jy zAL4bkCqyfJvbNC8Ba4sDmmR/BtidKiSvY1eSf1n/cRAtMLI1fjGUIUp8uvzyXaxwMxM Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AMCzsaWkE7NiD978uYadt+Slhfnr6KZRpLiul8ijeB9+8BubSvt29uEB zaR8SfqMN2F/LfskzjRrrws= X-Google-Smtp-Source: ABhQp+TrMHOmJK18GIYSgWro/yLsj+kqJMAtwBLNBWUbfKnCIfxvTOpMWCZuJLZAxonoxlITGf4rLw== X-Received: by 10.46.68.11 with SMTP id r11mr14113lja.9.1509657843199; Thu, 02 Nov 2017 14:24:03 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 10.46.46.15 with SMTP id u15ls718385lju.12.gmail; Thu, 02 Nov 2017 14:24:01 -0700 (PDT) X-Received: by 10.46.85.12 with SMTP id j12mr174358ljb.2.1509657841281; Thu, 02 Nov 2017 14:24:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509657841; cv=none; d=google.com; s=arc-20160816; b=ZGwsqUQ6m9BtUS6XCPLzi4XgefxUVXcwPnb8MQ4kiPhPdVyadwvRMBwTgY34eZuhlL WPUQxw3uch6QIWDlgEXP2/1f+TEVI2keVVO1eTxd/fMpPHpqbP8XmdVx8L5JxwaSsJe5 FyUVoH9pT+Pj/9Wd3mRpinlAMWjZ0YfYOA25VVw1516AB+97R8m8dmBf+ReRn3s8nCQQ ubkp43zv0pK4+UobM46/T2pvoO9FyeTBhwzhh6tnAsTVo2dOD7wyQ6KZp3N0e1jrVj9/ PeayD/pYuJakHNCiTb//VHQvFPc0j5wK21fTdR7vEV3oOXvReixpGs4NRizvGR5tmJLM 0BkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:in-reply-to:date :references:subject:to:from:arc-authentication-results; bh=1VKq0294VvSVugl+j3y2pU1MPlmvTZ11+uX6FHVA/+w=; b=qWkOv/rMATJue6Aws9FB+Ls628c8DAV1/3e+javStscJ8vyKqULAoKHG2Ox4tB8PVY AZXAeZ7F+inHEeIAAdx0gyaqNXY9fo81YPOtgmFN7GC5TKL2Shp4C/xhzYJFON0Xxc0B D5oNeXgCQOKVWHcueUD55JciiiIn2Oyq7JKng7UFVx8vrfPSz3QLndfkbgZET92mc+LZ vtAnVSzPt45jFHy6EdE2sVVmLYkr/lORQgJc6v9BG2SLHikq/0aRUDSx9MU+8mKCcd3T e1aa4OCi8r2rsdEq5RGpc5NJM/LVhWVZ3P+dNDqKpkKHhCUEtG0ZdmNJ+PH0kuSYJ0mN Y/TQ== 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.60.215 as permitted sender) smtp.mailfrom=albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zeitkraut.de Original-Received: from mx2.mailbox.org (mx2.mailbox.org. [80.241.60.215]) by gmr-mx.google.com with ESMTPS id g190si262731lfg.4.2017.11.02.14.24.00 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Nov 2017 14:24:00 -0700 (PDT) Received-SPF: pass (google.com: domain of albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org designates 80.241.60.215 as permitted sender) client-ip=80.241.60.215; Original-Received: from smtp1.mailbox.org (smtp1.mailbox.org [80.241.60.240]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx2.mailbox.org (Postfix) with ESMTPS id 4F3F04C7B9 for ; Thu, 2 Nov 2017 22:24:00 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de Original-Received: from smtp1.mailbox.org ([80.241.60.240]) by spamfilter02.heinlein-hosting.de (spamfilter02.heinlein-hosting.de [80.241.56.116]) (amavisd-new, port 10030) with ESMTP id S9NiqUjscD59 for ; Thu, 2 Nov 2017 22:23:58 +0100 (CET) In-Reply-To: <20171102202200.GB25469@protagoras> (John MACFARLANE's message of "Thu, 2 Nov 2017 13:22:00 -0700") 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.60.215 as permitted sender) smtp.mailfrom=albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zeitkraut.de 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.org gmane.text.pandoc:18513 Archived-At: John MACFARLANE writes: > Another approach could be to use pandoc-citeproc -y to > convert the bibtex to pandoc markdown YAML and include > this on the command line instead of specifying the bibtex > file. A filter could then be added that acts before > pandoc-citeproc and changes the citation ids in the metadata. This is such a beautiful solution that I couldn't resist to code up a proof-of-concept. The path to the bibtex file must be stored in the *bibliography* yaml field: ``` bibliography: path/to/bibliography.bib ... fix-bibkeys.lua: function references_from_bibfile (filename) local yaml =3D io.popen('pandoc-citeproc -y ' .. filename):read("*a") return pandoc.read(yaml).meta.references end function Meta(meta) local bibfile =3D meta.bibliography[1].text local references =3D references_from_bibfile(bibfile) -- modify keys, replace ???? with 0000 for k, v in pairs(references) do references[k].id =3D v.id[1].text:gsub("%?%?%?%?", "0000") end meta.references =3D references return meta end Run with pandoc --lua-filter=3Dfix-bibkeys.lua --filter=3Dpandoc-citeproc =E2=80= =A6 > +++ Albert Krewinkel [Nov 02 17 21:02 ]: >>distantflag writes: >> >>> Thanks for your replies. I could of course change the bibkeys. But >>> since I am generating them through export from Zotero I would like to >>> do so now and again when adding citations to a text, not having to >>> edit each and every faulty bibkey each time this export process is >>> done. >> >>Another option could be to write a small script which replaces all >>question marks with underscored or zeros in your bibtex keys. The script >>could then be run each time the bib file is regenerated by Zotero. The >>[bibtexparser] python library seems like a good fit for this, but a perl >>or awk command might work as well. >> >>[bibtexparser]: https://bibtexparser.readthedocs.io >> >>> Albert Krewinkel: This script seems handy. Where do I place it? >> >>The script is best placed in a separate file, e.g. `citation-spans.lua`. >>Pandoc must then be invoked with the additional parameter >>`--lua-script=3Dcitation-spans.lua`. >> >> --=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 post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>To view this discussion on the web visit https://groups.google.com/d/msgi= d/pandoc-discuss/87po904ffv.fsf%40zeitkraut.de. >>For more options, visit https://groups.google.com/d/optout. --=20 Albert Krewinkel GPG: 8eed e3e2 e8c5 6f18 81fe e836 388d c0b2 1f63 1124 --=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 post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/= pandoc-discuss/87k1z84bpy.fsf%40zeitkraut.de. For more options, visit https://groups.google.com/d/optout.