From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Daniel Mendler Newsgroups: gmane.emacs.devel Subject: Re: [elpa] externals/marginalia 94fc7f0: README: Add ELPA badge Date: Mon, 31 May 2021 15:18:37 +0200 Message-ID: References: <20210530185719.10480.76043@vcs0.savannah.gnu.org> <20210530185720.C7394209BF@vcs0.savannah.gnu.org> <2b8bd070-845e-6b73-3f1c-209c044b1c5d@daniel-mendler.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------8A7B7FAE8A3F5512221505C0" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31901"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon May 31 15:19:40 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lnhpU-00081k-1Y for ged-emacs-devel@m.gmane-mx.org; Mon, 31 May 2021 15:19:40 +0200 Original-Received: from localhost ([::1]:49874 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lnhpS-0006lk-Gp for ged-emacs-devel@m.gmane-mx.org; Mon, 31 May 2021 09:19:38 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50734) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lnhob-0005it-OM for emacs-devel@gnu.org; Mon, 31 May 2021 09:18:46 -0400 Original-Received: from server.qxqx.de ([2a01:4f8:121:346::180]:37443 helo=mail.qxqx.de) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lnhoZ-0007qy-Iv for emacs-devel@gnu.org; Mon, 31 May 2021 09:18:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=qxqx.de; s=mail1392553390; h=Content-Type:In-Reply-To:MIME-Version:Date:Message-ID: References:Cc:To:From:Subject:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=SU2v9Uw+xNPzG/Q40GjH5P5d25EeQGz5yQuArTTf8iw=; b=toM9Is6rK2XjQLEqHfOjBKOvme z7hCY1bGBd4ak1sUB6uRcsWQejgviuvIg1CekazBTUJmNQNpjDGkNYL+35ScHgT6wZQrWy0J8/2Xf U/pY5q9rzRkEOn2Mat6Rili87I9pGD4qdprsbswVnYfcA/HxPbVP4dAs/HpTD/BQ4tdY=; In-Reply-To: <2b8bd070-845e-6b73-3f1c-209c044b1c5d@daniel-mendler.de> Content-Language: en-US Received-SPF: pass client-ip=2a01:4f8:121:346::180; envelope-from=mail@daniel-mendler.de; helo=mail.qxqx.de X-Spam_score_int: -40 X-Spam_score: -4.1 X-Spam_bar: ---- X-Spam_report: (-4.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_SBL_A=0.1 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:270173 Archived-At: This is a multi-part message in MIME format. --------------8A7B7FAE8A3F5512221505C0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit On 5/31/21 6:56 AM, Daniel Mendler wrote: >> Would someone be interested in helping us make elpa.gnu.org serve those >> "GNU ELPA badges" instead of asking shields.io to do it for us? > > The shields.io code is available at https://github.com/badges/shields. > It is of course possible to use that svg builder code during the ELPA > build process. MELPA accesses shields.io during the build process, see > https://github.com/melpa/melpa/blob/master/package-build/package-build-badges.el. Stefan, I attached a "badge.sh" script which can be used to generate badges without depending on an external service. It uses imagemagick convert to compute the string width. This script can be used as follows: ./badge.sh "GNU ELPA" "consult 0.8" bb3955 > consult.svg ./badge.sh "nonGNU ELPA" "markdown-mode 2.4" bb3955 > markdown-mode.svg Depending on how the ELPA build process works it may make more sense to convert this to an elisp script? Daniel --------------8A7B7FAE8A3F5512221505C0 Content-Type: application/x-sh; name="badge.sh" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="badge.sh" #!/bin/sh string_width() { convert -debug annotate xc: -font DejaVu-Sans -pointsize 110 -annotate 0 "$1" null 2>&1 | \ grep Metrics: | \ grep -oP '(?<=width: )[0-9]*' } left=$1 right=$2 color=#$3 left_width=$(string_width "$left") right_width=$(string_width "$right") pad=$(string_width "x") width=$(((left_width + right_width + 4 * pad) / 10)) offset=10 # There is something wrong with the alignment, small correction cat < $left: $right $left $right SVG --------------8A7B7FAE8A3F5512221505C0--