From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/29983 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: BPJ Newsgroups: gmane.text.pandoc Subject: Re: Output-Format Plain removes Markdown-Hyperlinks []() Date: Sat, 15 Jan 2022 15:44:51 +0100 Message-ID: <90b5b9c0-3597-372e-5436-99a6f0c41d2f@gmail.com> References: Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------A782F3A8853B8AD56339729B" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35875"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 To: pandoc-discuss Original-X-From: pandoc-discuss+bncBCWMVYEK54FRBZN3ROHQMGQET6YCFMQ-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Sat Jan 15 15:44:57 2022 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-wm1-f59.google.com ([209.85.128.59]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1n8kIZ-00096Q-9b for gtp-pandoc-discuss@m.gmane-mx.org; Sat, 15 Jan 2022 15:44:55 +0100 Original-Received: by mail-wm1-f59.google.com with SMTP id w5-20020a1cf605000000b0034b8cb1f55esf988301wmc.0 for ; Sat, 15 Jan 2022 06:44:55 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1642257895; cv=pass; d=google.com; s=arc-20160816; b=1G6sf+FNQua2O30/h0Xy/XuTakD2fClOq006YD8oA41viF5f5Hc+725wETBLd+Eiom 00u6cscukJoRAMdzFoxgkD4tmCuHXsQ7Rb1u0wqnh0LD9pZuhBni9WMbszRgM/7mYn71 lw2mCBIpPYdQbPm4VlwAWtw3haYKS1xZGEVP/I/yBHbAHDDh6mnzG1fNZTJFsGR3Jarh ZkNWWN8qbyf5lA4trUSgCc68N8vdyzCSRzLriWdpbYilIwFmDVSp9Yl6IQsuoKQZc7JW Iyo6ppe4Dv+p5zNyowNPkfO1c8yVfC9SJ7MlGVnqHAUV9g4AxPzDmlfB+FQNAWcHaae5 Hw4Q== 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-language :in-reply-to:mime-version:user-agent:date:message-id:references:to :from:subject:sender:dkim-signature:dkim-signature; bh=Qq4lzHICb/7cp9HZFTaAmZDS0Yv5gAvL1G4yQw9ACy4=; b=kZYUiDTLsBNt68kRBthFwEDwRxePN9NfJ9nIN1bW0BygmwcVWXDVUwpiY8oOvCWJpl e5Mhha60Qiizazc5CzCU1wO7vTvdPZ0gqbBFYoqkE5Z1FAj7lCsOm4SR2jk1mEV0vAbk 3vjXxTVrDFVI87FABiHRUseU1yLql9fLKu3Z0wJdQlQO7egUaLjkQktmA/fuO31FWXzw yiehT0Fx5j77ubqO9YmljexWNqDlnlZJKcSIfv5Jgfsv6dot9+GDe+ausAvxjSDPLkk1 tg0hNl5FQqmdtGGs9rhSXvQkqnxJ4/8L2XzNeUQb3hhLbT22EDUoPgpiMCB7uenZWnb9 4Ydw== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=A57AZAHX; spf=pass (google.com: domain of melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2a00:1450:4864:20::12d as permitted sender) smtp.mailfrom=melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; h=sender:subject:from:to:references:message-id:date:user-agent :mime-version:in-reply-to:content-language: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=Qq4lzHICb/7cp9HZFTaAmZDS0Yv5gAvL1G4yQw9ACy4=; b=ExA0KiRdcDgS6IKGgS9QdFRQXkyTgRcWEepOVanc9U90R/jEzpRYWMExWOg4Z8qzqT dTHSMSls3er3bVKyB2QOifxzq4OmpfyjNIGhLLpL5BiIapVUzECygLzkjneLddyWtSHx k//uuOtxvs4L1CEnRsXe+4Y7E9mv4B/Hh2tYpdBDE0XJorm8iEgbkx+Q5iSu8jiS2Qyu u8ahKDb1H9GR+RMHa/xLp43c0brCsY4av1/K1mA4sM+/uhZwtkuYq223FLUfbeM+a5RB jxb9Pi+aefgg6oVj7/AowcnJgWM+hlWlkhNRolIBZzs2ikVd91U95dyHH0b2FcNNN9UZ KU0A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:from:to:references:message-id:date:user-agent:mime-version :in-reply-to:content-language: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=Qq4lzHICb/7cp9HZFTaAmZDS0Yv5gAvL1G4yQw9ACy4=; b=XjHyJqhPLcEFvI5SHJ0XwW7eYy3cGFBSWpMif9viQQT2mH/diGOdk6+ACGtbi/z3cy pF34KXvxLuFV4gFa3pZadMcqtI03RLSoKkJlKQybQOYw4el/1CfcWWnaxQlPErO4qgbK xc3ktw2vz3Gb25SGSrMzxajQXIYCoXjDSwy1bGZ/tuDfRNugwlQtE1sjjNxhGHbYZjXB njaVY5Bt19NC+Z9JaKStIvGgzHkM/mmfMdKYvSWH7DClVBKlR+9iBjFitjeVFR2qQ9ma r9pavimurBPkgU/0WEA5WxIgc4++hrzTH2hgl2Ngr1+XyDRva3AQbn6tDw8AJTkqgwQH ofgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=sender:x-gm-message-state:subject:from:to:references:message-id :date:user-agent:mime-version:in-reply-to:content-language :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=Qq4lzHICb/7cp9HZFTaAmZDS0Yv5gAvL1G4yQw9ACy4=; b=KNHcghOYmKSRDZ4pZ74/gRTvThNAIRDoMhkSZlS8n7Vb+hjuV8VI4wkxUnMVbdWI87 EqK0UYHxr97g+6dl9NybhQupM0ht5yL2wV/7ZP94/Hb38UfAjQqoRerxZfwe/aqX2BgJ t2xR8ltlv2R20o+Y3NhA9WtQFU8kZzLdsOi4+UQrexCzYef9afp+PwcTSRl4ipd2t0+B viaPgZxQXJBAheiU6B4FzVfLvBwE9MlyhiG0lhXrqf7ULxXKZIS6oiePDwXSdLxrJ+ut gE0k8BnU62hUZVP5+4bl960DWVk6cwP0X3/CSfYjnbVbiu6BBLhGiMdF7QVwujLoEoO+ Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOAM533dt1iMvtlxq7B+g7AOW7HcS8YvhzPswIWQpFM90gPlctR958DF fA5Fxf61RmY9hTiOdS/lPxw= X-Google-Smtp-Source: ABdhPJysQLHTYs3RL+hWP91FOz8BLjKvrwyIiYgWNL4FRpFJmWone00zbJtiA4eb15dWwUx2GzOg7g== X-Received: by 2002:a5d:50ca:: with SMTP id f10mr12750058wrt.696.1642257894868; Sat, 15 Jan 2022 06:44:54 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:adf:fe8e:: with SMTP id l14ls58764wrr.3.gmail; Sat, 15 Jan 2022 06:44:52 -0800 (PST) X-Received: by 2002:adf:e351:: with SMTP id n17mr12224219wrj.243.1642257892569; Sat, 15 Jan 2022 06:44:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642257892; cv=none; d=google.com; s=arc-20160816; b=p2HqeaXUp7+cUiouwY6iHwg5WEeX+Q5JD+1gbW+/kgClRv79SxbrA7j1uhkpOaW6pL LQMkxw+nKAAZwYuLF3h/eCbimk+45uiR4ToXNQ1+VFtAaUR5Bt8w4qw13oHNjOgikmsk 4LdBYRSs06xuek9NB/pfl+jaUJ5kqsPb34ATyyeffjV5mYDqRH+AtPvjssqX0ZfGM2lw I2Qtltit8bbLfuWqeOpHmJJjqlv2IiWL9IU6OI0zHeznflWmW3w3wiSZjlEdoB6YU5Iy 3S68gPO/N3vK0nJmWLsDI95dJ53wL65PdCPad0gmNthvq1NvQT3Y48TNh8DlOnzn1be5 m32A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-language:in-reply-to:mime-version:user-agent:date :message-id:references:to:from:subject:dkim-signature; bh=KTImECmT+MLim7ctTiLqgXePfQgno/kUcksg+nl8W4s=; b=gpnhuMoP38KrgLda+VZG/FMmDH6Qys+N+HCH3j201yvwq8sWlBkat2i5MTacN3zlfL 8ETomzkVdYUlwAFS4W2Gfwyu9oyw4LbiC4JcpInpoiD/AmzKbYUkNpIAIwnuhTwdgmJ3 9j+KUNylRbC9uPeOdSPY3JJ9swskG2xp49I41T32S4jTO4KCI4LTKIuYzWg978xQnHrP 3oVTlBI1HIX00D3oVZxFXBQbIqbsQSxXkXQpJnJx15G/PxZPMuPgtoxpXkXBGHRUR4dW SsVpcE5d//RhUAxEke2up79PZIsAM+zkS/bHE/CxoJUFKIJIERC5fmeJMxxafDBue8Vx yEmg== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=A57AZAHX; spf=pass (google.com: domain of melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2a00:1450:4864:20::12d as permitted sender) smtp.mailfrom=melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Original-Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com. [2a00:1450:4864:20::12d]) by gmr-mx.google.com with ESMTPS id f62si550160wmf.0.2022.01.15.06.44.52 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 15 Jan 2022 06:44:52 -0800 (PST) Received-SPF: pass (google.com: domain of melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2a00:1450:4864:20::12d as permitted sender) client-ip=2a00:1450:4864:20::12d; Original-Received: by mail-lf1-x12d.google.com with SMTP id b14so21786732lff.3 for ; Sat, 15 Jan 2022 06:44:52 -0800 (PST) X-Received: by 2002:a2e:8698:: with SMTP id l24mr1793916lji.406.1642257892171; Sat, 15 Jan 2022 06:44:52 -0800 (PST) Original-Received: from [192.168.1.122] (user122.77-105-231.netatonce.net. [77.105.231.122]) by smtp.gmail.com with ESMTPSA id y12sm883336lfs.260.2022.01.15.06.44.51 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 15 Jan 2022 06:44:51 -0800 (PST) In-Reply-To: Content-Language: en-US X-Original-Sender: melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=A57AZAHX; spf=pass (google.com: domain of melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2a00:1450:4864:20::12d as permitted sender) smtp.mailfrom=melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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:29983 Archived-At: This is a multi-part message in MIME format. --------------A782F3A8853B8AD56339729B Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: quoted-printable Ack I forgot the attachments! Typical... :-) On 2022-01-15 15:41, BPJ wrote: > Here with pandoc 2.16.2 `[TEXT](URL)` is automatically turned into `TEXT= =20 > ` in plain output, being smart enough to do the right thing if the= =20 > URL appears in the link text or if it was `` already. >=20 > Anyway attached is a Lua filter which I use to get the same effect in=20 > other output formats.=C2=A0 Unless you are running a very old version of= =20 > pandoc it should do what you want unless pandoc does it already. >=20 > On 2022-01-14 12:20, Peter Mueller wrote: >> Hello together. >> >> I'm working on a project where we use one input markdown file to create >> HTML but also TXT files. >> The problem I have is with markdown hyperlinks in the form of [](). >> >> While for the output format html they are kept: >> *$ echo "prefix [this is a link](www.google.de) suffix" | pandoc -f >> markdown -t html* >> *

prefix this is a link suffix

* >> >> the url is completely removed for plain output: >> *$ echo "prefix [this is a link](www.google.de) suffix" | pandoc -f >> markdown -t plain* >> *prefix this is a link suffix* >> >> Is there a way/plugin to keep the url within the plain output? >> (e.g.=C2=A0 by keeping the markdown=C2=A0 [this is a link](www.google.de= ) as it is, >> but handling all other markdown as usual?) >> >> Thank you >> Peter >> >=20 --=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 view this discussion on the web visit https://groups.google.com/d/msgid/= pandoc-discuss/90b5b9c0-3597-372e-5436-99a6f0c41d2f%40gmail.com. --------------A782F3A8853B8AD56339729B Content-Type: text/html; charset=UTF-8; name="result.html" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="result.html" PHA+R28gdG8gb3VyIHNpdGUgJmx0O2h0dHA6Ly9leGFtcGxlLm9yZyZndDsuPC9wPgo8cD5Z b3UgY2FuIGZpbmQgdXMgYXQgaHR0cDovL2V4YW1wbGUub3JnLjwvcD4KPHA+R28gdG8gb3Vy IHNpdGUgYXQgJmx0O2h0dHA6Ly9leGFtcGxlLm9yZyZndDsuPC9wPgo8cD5Ecm9wIHVzIGEg bWFpbCAmbHQ7aW5mb0BleGFtcGxlLm9yZyZndDsuPC9wPgo8cD5TZW5kIGEgbWFpbCB0byAm bHQ7aW5mb0BleGFtcGxlLm9yZyZndDsuPC9wPgo8cD5TZW5kIGEgbWFpbCB0byAmbHQ7aW5m b0BleGFtcGxlLm9yZyZndDsuPC9wPgo= --------------A782F3A8853B8AD56339729B Content-Type: text/x-lua; charset=UTF-8; name="plain-links.lua" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="plain-links.lua" -- Pandoc filter which turns `[TEXT](URL)` into `TEXT \` -- Save some typing and sidewise space! :-) local p = assert(pandoc, "Cannot find pandoc library") local u = assert(p.utils, "Cannot find pandoc.utils library") -- Classes which Pandoc inserts into links with URL/email as link text local plain_classes = { 'uri', 'email' } -- Get a nice-looking URL/email string local function bare_url (url) -- Remove wrapping angles just in case url = tostring(url):gsub("^%<", "") url = url:gsub("%>$", "") -- Remove the mailto protocol if any url = url:gsub("^mailto%:", "") return url end -- Get a pattern which matches a string literally -- by escaping all punctuation chars in the string local function quote_pat (str) return tostring(str):gsub('%p', '%%%0') end -- The main action function Link (link) -- Get the link text as a list of inlines local ct = link.content local url = link.target -- Return just the link text if the link is local if url:match('^%#') then return ct end -- Get the link text as a string (without formatting) local txt = u.stringify(link) -- See if we got one of Pandoc's automatic classes for _, cls in ipairs(plain_classes) do if link.classes:includes(cls) then -- If yes return just `` or `` return p.Str("<" .. tostring(bare_url(txt)) .. ">") end end -- Else if the link text contains the URL/email -- return just the link text if txt:match(quote_pat(bare_url(url))) then return ct end -- Else append `` or `` to the link text ct:extend({ p.Space(), p.Str("<" .. tostring(bare_url(url)) .. ">") }) return ct end --------------A782F3A8853B8AD56339729B Content-Type: text/markdown; charset=UTF-8; name="result.md" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="result.md" Go to our site \. You can find us at http://example.org. Go to our site at \. Drop us a mail \. Send a mail to \. Send a mail to \. --------------A782F3A8853B8AD56339729B Content-Type: text/plain; charset=UTF-8; name="result.txt" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="result.txt" R28gdG8gb3VyIHNpdGUgPGh0dHA6Ly9leGFtcGxlLm9yZz4uCgpZb3UgY2FuIGZpbmQgdXMg YXQgaHR0cDovL2V4YW1wbGUub3JnLgoKR28gdG8gb3VyIHNpdGUgYXQgPGh0dHA6Ly9leGFt cGxlLm9yZz4uCgpEcm9wIHVzIGEgbWFpbCA8aW5mb0BleGFtcGxlLm9yZz4uCgpTZW5kIGEg bWFpbCB0byA8aW5mb0BleGFtcGxlLm9yZz4uCgpTZW5kIGEgbWFpbCB0byA8aW5mb0BleGFt cGxlLm9yZz4uCg== --------------A782F3A8853B8AD56339729B Content-Type: text/markdown; charset=UTF-8; name="test.md" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="test.md" Go to [our site](http://example.org). [You can find us at http://example.org](http://example.org). Go to our site at . Drop us a [mail](mailto:info-hcDgGtZH8xNAfugRpC6u6w@public.gmane.org). Send a mail to . [Send a mail to ](mailto:info-hcDgGtZH8xNAfugRpC6u6w@public.gmane.org). --------------A782F3A8853B8AD56339729B Content-Type: text/plain; charset=UTF-8; name="unfiltered-plain.txt" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="unfiltered-plain.txt" R28gdG8gb3VyIHNpdGUgPGh0dHA6Ly9leGFtcGxlLm9yZz4uCgpZb3UgY2FuIGZpbmQgdXMg YXQgaHR0cDovL2V4YW1wbGUub3JnLgoKR28gdG8gb3VyIHNpdGUgYXQgPGh0dHA6Ly9leGFt cGxlLm9yZz4uCgpEcm9wIHVzIGEgbWFpbCA8aW5mb0BleGFtcGxlLm9yZz4uCgpTZW5kIGEg bWFpbCB0byA8aW5mb0BleGFtcGxlLm9yZz4uCgpTZW5kIGEgbWFpbCB0byA8aW5mb0BleGFt cGxlLm9yZz4uCg== --------------A782F3A8853B8AD56339729B--