From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id oLumJTCK3mLUAAAAbAwnHQ (envelope-from ) for ; Mon, 25 Jul 2022 14:18:56 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id OOCGJDCK3mLGngAAG6o9tA (envelope-from ) for ; Mon, 25 Jul 2022 14:18:56 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 441E91314A for ; Mon, 25 Jul 2022 14:18:56 +0200 (CEST) Received: from localhost ([::1]:47722 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oFx31-0007dY-AG for larch@yhetil.org; Mon, 25 Jul 2022 08:18:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47478) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oFx2C-0006yJ-5b for guix-patches@gnu.org; Mon, 25 Jul 2022 08:18:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:59662) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oFx2B-0005EH-SI for guix-patches@gnu.org; Mon, 25 Jul 2022 08:18:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oFx2B-0002t7-Nq for guix-patches@gnu.org; Mon, 25 Jul 2022 08:18:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#56759] [PATCH 05/20] gnu: Add ruby-latex-decode. Resent-From: Philip McGrath Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 25 Jul 2022 12:18:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56759 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 56759@debbugs.gnu.org Cc: Philip McGrath Received: via spool by 56759-submit@debbugs.gnu.org id=B56759.165875146710991 (code B ref 56759); Mon, 25 Jul 2022 12:18:03 +0000 Received: (at 56759) by debbugs.gnu.org; 25 Jul 2022 12:17:47 +0000 Received: from localhost ([127.0.0.1]:49395 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oFx1u-0002rD-No for submit@debbugs.gnu.org; Mon, 25 Jul 2022 08:17:47 -0400 Received: from mail-qv1-f51.google.com ([209.85.219.51]:45662) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oFx1q-0002qk-QB for 56759@debbugs.gnu.org; Mon, 25 Jul 2022 08:17:43 -0400 Received: by mail-qv1-f51.google.com with SMTP id h18so8216626qvr.12 for <56759@debbugs.gnu.org>; Mon, 25 Jul 2022 05:17:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=philipmcgrath.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jABfdQfGUZ9bX8q/MIzr5oGGaVPfq5g38FPMW5cBCa8=; b=IUt3f+O0Xcb+00wq+xOFu8yZcmeANJrlrkEGvgncw/x87R3D1/9M6xyGTDQR9Tw2N3 5fBTjrax60wbx2gLObglSbyzrzGL9Qv9+rNJMgT3EsiM6BRxNwDwA9w/7K7L1xkdUMTY OyhmHNqxAjEpCNjyX5beqsQp4cDQ5tRt2OjxweREBze9bFXNIPlm/jW9Qm2ZToDIM9Af OZOefJ9RGMONy0yledQ3AK6sbkjr2jHmWAEP6BEH6h5+b2KYQszyoghFyUyXC8uX4JBl ftFZi6H0c+mz7gpVycYhtVhOlfdJATHPi50ppGkih86UkcpHuAW3qdaAXbg4qYf9bvNI wtMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jABfdQfGUZ9bX8q/MIzr5oGGaVPfq5g38FPMW5cBCa8=; b=KKtnp6v09zoXDpnQ+tL+rLw5XssWMqdWfXx0NwRVurcpGFpm9TaSKeLnPQiUpZ2s+x A0jBmnIuR2CIeTk07TFrW/mWWq6U/ZR+9AEV423rpr8Vx1hPe+NfdHxbOSt8hcRjX8sG 3/MftDd7rPkNVi/9KJC2VFLwtYBfeFOmJOpSUpIeUqb3cvWWRpnB+JjU8mUAJiuh/cB4 ok2cY2aaVK0YBAGDtx6q/LPDtxXf3CKGgUEhFx82fPTUjF20XN4rVvSfBU71sOufFM2Q EpHI1PsyyGVSenr9vK7pJkwDlvAiSpWNYW2xgCHwIgxmH1d4zlLAuwhYwWwwHbkqyMOq osdw== X-Gm-Message-State: AJIora9AH/sPxUBjK0rLKH0k9K2l6hgbRIbYqSCT83RiXn2x6w538sDe csYi8BSjawpCVsGvY5HCuWAV77yv1u0VHEEW X-Google-Smtp-Source: AGRyM1tBTRkBvHJD6+alM7XZtEHRFOS1VbgNxhtT+PgeSMORfDOepWpXbZliYymQejo2DriHgNBLdA== X-Received: by 2002:a05:6214:27ed:b0:473:fedb:3055 with SMTP id jt13-20020a05621427ed00b00473fedb3055mr10344777qvb.108.1658751457307; Mon, 25 Jul 2022 05:17:37 -0700 (PDT) Received: from localhost (c-73-125-98-51.hsd1.fl.comcast.net. [73.125.98.51]) by smtp.gmail.com with UTF8SMTPSA id r6-20020a05620a298600b006a787380a5csm9377370qkp.67.2022.07.25.05.17.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 25 Jul 2022 05:17:37 -0700 (PDT) From: Philip McGrath Date: Mon, 25 Jul 2022 08:16:20 -0400 Message-Id: X-Mailer: git-send-email 2.32.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1658751536; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=jABfdQfGUZ9bX8q/MIzr5oGGaVPfq5g38FPMW5cBCa8=; b=NMK9fpz0cW/sddruP5Coz0kKdycl8VO8A1uhpCA/6wNu2EOGoBf2aDwjD2yizhQPnP3p6k GcNrCp5e2tVbNiPHorWk9zgqJTCDAIsqxJqqtJn1qsLAf4Ck9AO3MxjY2VKcxSMNrAQ+N9 U270rXwAGQ7LtNDTP6/SLxCU6tlEnux7YCMHKps9ga1+tP68GW4BepXh+OA6r9Yui1dWDD UWvcewvPY0kP+m6koaPTK0IT1H4D+gtiJWRmE3NMZ48FyJEfywtN5mhavJYONGvHrr+efK sGtHCwTkhChPLsi9IN7mFRBrvNgQc8iSfEdlHNvJ/cTxzDHnLoHqnTbk2F0mvw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1658751536; a=rsa-sha256; cv=none; b=r7Yb9ZUWNLlb7G2j/nDOwdiPZjxDO5xEyMacPOEd4vsq3PxjEafax/Z8N4EpLXvQhQ1+gr mIZZoNhuO6TSZyrMam326ygwsmlcuS+fjk5YsP/1AqgA/m7s6lGHPvjcwpZRju0EeCKtAB rZBPLUVwCqUEzPDGM+Q5RbNE8dVAq8fMzvWK918HBAQew2/qxVyb8sChOTDvMBJQmCzbFi 0rozUtwzVCyXOcP2l3lrB2WUcWDW8qSLBiRyiJXOC2esljQTbyOUh6NZCC9x8I2nHkM+S9 fjuyk5j471nolr060T3LnX3dhiyOPCAVOPmt8xMeqto83QtewbJp5fHr18MGYg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=philipmcgrath.com header.s=google header.b=IUt3f+O0; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: 3.57 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=philipmcgrath.com header.s=google header.b=IUt3f+O0; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 441E91314A X-Spam-Score: 3.57 X-Migadu-Scanner: scn1.migadu.com X-TUID: TDA+lOJkveBa * gnu/packages/patches/ruby-latex-decode-fix-test.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. * gnu/packages/ruby.scm (ruby-latex-decode): New variable. --- gnu/local.mk | 1 + .../patches/ruby-latex-decode-fix-test.patch | 66 +++++++++++++++++++ gnu/packages/ruby.scm | 50 ++++++++++++++ 3 files changed, 117 insertions(+) create mode 100644 gnu/packages/patches/ruby-latex-decode-fix-test.patch diff --git a/gnu/local.mk b/gnu/local.mk index 0c4edf6e56..3bc947f30c 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1774,6 +1774,7 @@ dist_patch_DATA = \ %D%/packages/patches/rocm-comgr-3.1.0-dependencies.patch \ %D%/packages/patches/rocm-opencl-runtime-4.3-noclinfo.patch \ %D%/packages/patches/rocm-opencl-runtime-4.3-noopencl.patch \ + %D%/packages/patches/ruby-latex-decode-fix-test.patch \ %D%/packages/patches/ruby-mustache-1.1.1-fix-race-condition-tests.patch \ %D%/packages/patches/ruby-sanitize-system-libxml.patch \ %D%/packages/patches/rustc-1.39.0-src.patch \ diff --git a/gnu/packages/patches/ruby-latex-decode-fix-test.patch b/gnu/packages/patches/ruby-latex-decode-fix-test.patch new file mode 100644 index 0000000000..58d7d16258 --- /dev/null +++ b/gnu/packages/patches/ruby-latex-decode-fix-test.patch @@ -0,0 +1,66 @@ +From 698e39a251d433e2cd2934586a2dfc5e6582c4f9 Mon Sep 17 00:00:00 2001 +From: Philip McGrath +Date: Sun, 24 Jul 2022 09:12:55 -0400 +Subject: [PATCH] Improve readability of whitespace tests + +This change fixes the test for `~x` in some environments in which it +was previously failing. + +Related to https://github.com/inukshuk/latex-decode/issues/13 +--- + features/step_definitions/latex.rb | 5 +++++ + features/symbols.feature | 7 ------- + features/whitespace.feature | 13 +++++++++++++ + 3 files changed, 18 insertions(+), 7 deletions(-) + create mode 100644 features/whitespace.feature + +diff --git a/features/step_definitions/latex.rb b/features/step_definitions/latex.rb +index 4b1b595..fca63c0 100644 +--- a/features/step_definitions/latex.rb ++++ b/features/step_definitions/latex.rb +@@ -5,3 +5,8 @@ end + Then /^the result should be ('|")(.*)\1$/ do |quote,value| + expect(@result).to eq(value) + end ++ ++# For whitespace or other characters that are hard to read in source code: ++Then /^I should get '([^']*)' \+ U\+(\h{4,}) \+ '([^']*)'$/ do |pre,code,post| ++ expect(@result).to eq(pre + code.hex.chr(Encoding::UTF_8) + post) ++end +diff --git a/features/symbols.feature b/features/symbols.feature +index 46d9a51..f8a5e84 100644 +--- a/features/symbols.feature ++++ b/features/symbols.feature +@@ -12,10 +12,3 @@ Feature: Decode LaTeX symbol directives + | \\uparrow | ↑ | + | \\downarrow | ↓ | + | \\rightarrow | → | +- +- Scenarios: Whitespace +- | latex | unicode | description | +- | x\\,x | x x | small space | +- | x~x | x x | non-breaking space | +- | ~x |  x | non-breaking space | +- +diff --git a/features/whitespace.feature b/features/whitespace.feature +new file mode 100644 +index 0000000..fe5b208 +--- /dev/null ++++ b/features/whitespace.feature +@@ -0,0 +1,13 @@ ++Feature: Decode LaTeX whitespace directives ++ As a hacker who works with LaTeX ++ I want to be able to decode LaTeX whitespace ++ ++ Scenario Outline: LaTeX to Unicode transformation ++ When I decode the string '' ++ Then I should get
 + U+ + 
++
++  Scenarios: Whitespace
++    | latex | pre | code | post | description                |
++    | x~x   | 'x' | 00A0 | 'x'  | non-breaking space         |
++    | ~y    | ''  | 00A0 | 'y'  | leading non-breaking space |
++    | z\\,z | 'z' | 2009 | 'z'  | small space                |
+-- 
+2.32.0
+
diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
index 746bb9b6ce..fb9d5c53b9 100644
--- a/gnu/packages/ruby.scm
+++ b/gnu/packages/ruby.scm
@@ -13111,3 +13111,53 @@ (define-public ruby-ritex
 into HTML pages easy.  It supports most TeX math syntax as well as macros.")
     ;; doesn't clearly state -only vs -or-later
     (license license:gpl2)))
+
+(define-public ruby-latex-decode
+  (let ((commit "08cc2d4a2c1359abaeb2f1e1a9d78e16a546cf7c")
+        (revision "1"))
+    ;; The commit is a released version, but doesn't have a Git tag.
+    ;; Using Git rather than the gem makes it easier to patch.
+    (package
+      (name "ruby-latex-decode")
+      (version (git-version "0.3.2" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/inukshuk/latex-decode")
+                      (commit commit)))
+                (sha256
+                 (base32
+                  "0clvnqms81i33iff3pr3zz8sbyknvg704zghd62ysqrlbi4jpcpk"))
+                (patches
+                 ;; see https://github.com/inukshuk/latex-decode/issues/13
+                 (search-patches "ruby-latex-decode-fix-test.patch"))
+                (file-name (git-file-name name version))))
+      (build-system ruby-build-system)
+      (native-inputs
+       (list ruby-byebug
+             ruby-cucumber
+             ruby-ritex
+             ruby-rspec))
+      (arguments
+       (list
+        #:test-target "cucumber"
+        #:phases
+        #~(modify-phases %standard-phases
+            (add-after 'extract-gemspec 'less-strict-dependencies
+              (lambda args
+                (substitute* "Gemfile"
+                  (("'cucumber', '[^']*'")
+                   "'cucumber'"))))
+            (add-after 'replace-git-ls-files 'replace-another-git-ls-files
+              (lambda args
+                (substitute* "latex-decode.gemspec"
+                  (("`git ls-files -- [{]test,spec,features[}]/\\*`")
+                   "`find {test,spec,features} -type f | sort`")))))))
+      (home-page "https://github.com/inukshuk/latex-decode")
+      (synopsis "Convert LaTeX to Unicode")
+      (description
+       "This package provides a gem to convert LaTeX input to Unicode.  Its
+original use was as an input filter for BibTeX-Ruby, but it can be used
+independently to decode LaTeX.  Many of the patterns used by this Ruby gem are
+based on François Charette's equivalent Perl module @code{LaTeX::Decode}.")
+      (license license:gpl3+))))
-- 
2.32.0