summary refs log tree commit diff
path: root/gnu/packages/textutils.scm
diff options
context:
space:
mode:
authorMarius Bakke <mbakke@fastmail.com>2018-07-24 19:56:35 +0200
committerMarius Bakke <mbakke@fastmail.com>2018-07-24 19:56:35 +0200
commit706ae8e15c8d36b0aee7c19c54c143d3e17f5784 (patch)
treee9fe8ebfb1417d30979b5413165599f066a1c504 /gnu/packages/textutils.scm
parent3e95125e9bd0676d4a9add9105217ad3eaef3ff0 (diff)
parent8440db459a10daa24282038f35bc0b6771bd51ab (diff)
downloadguix-706ae8e15c8d36b0aee7c19c54c143d3e17f5784.tar.gz
Merge branch 'master' into core-updates
Diffstat (limited to 'gnu/packages/textutils.scm')
-rw-r--r--gnu/packages/textutils.scm84
1 files changed, 82 insertions, 2 deletions
diff --git a/gnu/packages/textutils.scm b/gnu/packages/textutils.scm
index 5734bf62d6..355683df8a 100644
--- a/gnu/packages/textutils.scm
+++ b/gnu/packages/textutils.scm
@@ -14,6 +14,7 @@
 ;;; Copyright © 2017 Kei Kebreau <kkebreau@posteo.net>
 ;;; Copyright © 2017 Alex Vong <alexvong1995@gmail.com>
 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2018 Pierre Neidhardt <ambrevar@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -337,7 +338,7 @@ as existing hashing techniques, with provably negligible risk of collisions.")
 (define-public oniguruma
   (package
     (name "oniguruma")
-    (version "5.9.6")
+    (version "6.8.2")
     (source (origin
               (method url-fetch)
               (uri (string-append "https://github.com/kkos/"
@@ -345,7 +346,7 @@ as existing hashing techniques, with provably negligible risk of collisions.")
                                   "/onig-" version ".tar.gz"))
               (sha256
                (base32
-                "19s79vsclqn170mw0ajwv7j37qsbn4f1yjz3yavnhvva6c820r6m"))))
+                "00s9gjgb3srn5sbmx4x9bssn52mi04d868ghizssdhjlddgxmsmd"))))
     (build-system gnu-build-system)
     (home-page "https://github.com/kkos/oniguruma")
     (synopsis "Regular expression library")
@@ -354,6 +355,20 @@ characteristic of this library is that different character encoding for every
 regular expression object can be specified.")
     (license license:bsd-2)))
 
+;; PHP < 7.3.0 requires this old version.  Remove once no longer needed.
+(define-public oniguruma-5
+  (package
+    (inherit oniguruma)
+    (version "5.9.6")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://github.com/kkos/"
+                                  "oniguruma/releases/download/v" version
+                                  "/onig-" version ".tar.gz"))
+              (sha256
+               (base32
+                "19s79vsclqn170mw0ajwv7j37qsbn4f1yjz3yavnhvva6c820r6m"))))))
+
 (define-public antiword
   (package
     (name "antiword")
@@ -675,3 +690,68 @@ and Cython.")
 measuring and checking the width of strings, with support east asian text.")
     (home-page "https://github.com/jessevdk/go-flags")
     (license license:expat)))
+
+(define-public docx2txt
+  (package
+    (name "docx2txt")
+    (version "1.4")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                    "mirror://sourceforge/docx2txt/docx2txt/v"
+                    version "/docx2txt-" version ".tgz"))
+              (sha256
+               (base32
+                "06vdikjvpj6qdb41d8wzfnyj44jpnknmlgbhbr1w215420lpb5xj"))))
+    (build-system gnu-build-system)
+    (inputs
+     `(("unzip" ,unzip)
+       ("perl" ,perl)))
+    (arguments
+     `(#:tests? #f                      ; No tests.
+       #:make-flags (list (string-append "BINDIR="
+                                         (assoc-ref %outputs "out") "/bin")
+                          (string-append "CONFIGDIR="
+                                         (assoc-ref %outputs "out") "/etc")
+                          ;; Makefile seems to be a bit dumb at guessing.
+                          (string-append "INSTALL=install")
+                          (string-append "PERL=perl"))
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (add-after 'install 'fix-install
+           (lambda* (#:key outputs inputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (bin (string-append out "/bin"))
+                    (config (string-append out "/etc/docx2txt.config"))
+                    (unzip (assoc-ref inputs "unzip")))
+               ;; According to INSTALL, the .sh wrapper can be skipped.
+               (delete-file (string-append bin "/docx2txt.sh"))
+               (rename-file (string-append bin "/docx2txt.pl")
+                            (string-append bin "/docx2txt"))
+               (substitute* config
+                 (("config_unzip         => '/usr/bin/unzip',")
+                  (string-append "config_unzip         => '"
+                                 unzip
+                                 "/bin/unzip',")))
+               ;; Makefile is wrong.
+               (chmod config #o644)))))))
+    (synopsis "Recover text from @file{.docx} files, with good formatting")
+    (description
+     "@command{docx2txt} is a Perl based command line utility to convert
+Microsoft Office @file{.docx} documents to equivalent text documents.  Latest
+version supports following features during text extraction.
+
+@itemize
+@item Character conversions; currency characters are converted to respective
+names like Euro.
+@item Capitalisation of text blocks.
+@item Center and right justification of text fitting in a line of
+(configurable) 80 columns.
+@item Horizontal ruler, line breaks, paragraphs separation, tabs.
+@item Indicating hyperlinked text along with the hyperlink (configurable).
+@item Handling (bullet, decimal, letter, roman) lists along with (attempt at)
+indentation.
+@end itemize\n")
+    (home-page "http://docx2txt.sourceforge.net")
+    (license license:gpl3+)))