Subject: bug#31949: closed (Re: [bug#31949] [PATCH] gnu: Add docx2txt.)

From: [email-masked] (GNU bug Tracking System)
Date: Sat, 07 Jul 2018 15:54:02 +0000

Your bug report

#31949: [PATCH] gnu: Add docx2txt.

which was filed against the guix-patches package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
31949: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=31949
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: [bug#31949] [PATCH] gnu: Add docx2txt.
From: [email-masked] (Ludovic Courtès)
To: Pierre Neidhardt <[email-masked]>
Cc: [email-masked]
Date: Sat, 07 Jul 2018 17:53:28 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Hello Pierre,

Pierre Neidhardt <[email-masked]> skribis:

> * gnu/packages/textutils.scm (docx2txt): New variable.

Perfect.  Applied, thanks!

Ludo’.

Subject: [PATCH] gnu: Add docx2txt.
From: Pierre Neidhardt <[email-masked]>
To: [email-masked]
Date: Sat, 23 Jun 2018 15:32:37 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

* gnu/packages/textutils.scm (docx2txt): New variable.
---
 gnu/packages/textutils.scm | 65 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 65 insertions(+)

diff --git a/gnu/packages/textutils.scm b/gnu/packages/textutils.scm
index 5734bf62d..8eec045a6 100644
--- a/gnu/packages/textutils.scm
+++ b/gnu/packages/textutils.scm
@@ -14,6 +14,7 @@
 ;;; Copyright © 2017 Kei Kebreau <[email-masked]>
 ;;; Copyright © 2017 Alex Vong <[email-masked]>
 ;;; Copyright © 2018 Tobias Geerinckx-Rice <[email-masked]>
+;;; Copyright © 2018 Pierre Neidhardt <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -675,3 +676,67 @@ 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
+                    "http://downloads.sourceforge.net/docx2txt/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 .docx files, with good formatting")
+    (description
+     "@command{docx2txt} is a perl based command line utility to convert
+Microsoft Office™ .docx documents to equivalent text documents. Latest version
+supports following features during text extraction.
+
+@itemize
+@item Character conversions (\" ' < & > -, fractions and some mathematical
+symbols, etc.); 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+)))
-- 
2.17.1