gnu: poke: Update to 1.3.
[jackhill/guix/guix.git] / gnu / packages / markup.scm
index 4426258..368976b 100644 (file)
@@ -1,8 +1,12 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2015 Mathieu Lirzin <mthl@openmailbox.org>
 ;;; Copyright © 2015 David Thompson <davet@gnu.org>
-;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
-;;; Copyright © 2017 ng0 <ng0@infotropique.org>
+;;; Copyright © 2016, 2019 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2017 Nikita <nikita@n0.is>
+;;; Copyright © 2017–2021 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
+;;; Copyright © 2020 EuAndreh <eu@euandre.org>
+;;; Copyright © 2021 Noisytoot <noisytoot@disroot.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
 (define-module (gnu packages markup)
   #:use-module (guix licenses)
   #:use-module (guix download)
+  #:use-module (guix git-download)
   #:use-module (guix packages)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system trivial)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system perl)
+  #:use-module (guix build-system python)
+  #:use-module (guix utils)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages)
   #:use-module (gnu packages perl)
+  #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
   #:use-module (gnu packages web))
 
     (name "hoedown")
     (version "3.0.7")
     (source (origin
-             (method url-fetch)
-             (uri (string-append "https://github.com/hoedown/hoedown/archive/"
-                                 version ".tar.gz"))
-             (file-name (string-append name "-" version ".tar.gz"))
+             (method git-fetch)
+             (uri (git-reference
+                    (url "https://github.com/hoedown/hoedown")
+                    (commit version)))
+             (file-name (git-file-name name version))
              (sha256
               (base32
-               "0859dc2xjasd6kgkshi8mb20kbyw5sql1ln0hw3bfaf33qdh5dh1"))))
+               "1kr3hxjg2dgmwy9738qgj3sh3f5cygx0zxskkfhrg7x19bq9yd26"))))
     (build-system gnu-build-system)
     (arguments
      '(#:make-flags (list "CC=gcc" (string-append "PREFIX=" %output))
@@ -85,14 +94,15 @@ processing library written in C.")
                                       "/bin/unzip")))
            (mkdir-p out)
            (with-directory-excursion out
-             (system* unzip source)
+             (invoke unzip source)
              (mkdir "bin")
              (mkdir-p "share/doc")
              (rename-file "Markdown_1.0.1/Markdown.pl" "bin/markdown")
              (rename-file "Markdown_1.0.1/Markdown Readme.text"
                           "share/doc/README")
              (patch-shebang "bin/markdown" (list perlbd))
-             (delete-file-recursively "Markdown_1.0.1"))))))
+             (delete-file-recursively "Markdown_1.0.1"))
+           #t))))
     (native-inputs `(("unzip" ,unzip)))
     (inputs `(("perl" ,perl)))
     (home-page "http://daringfireball.net/projects/markdown")
@@ -107,19 +117,19 @@ convert it to structurally valid XHTML (or HTML).")
 (define-public discount
   (package
     (name "discount")
-    (version "2.2.2")
+    (version "2.2.7")
     (source (origin
              (method url-fetch)
              (uri (string-append
                    "http://www.pell.portland.or.us/~orc/Code/"
-                   name "/" name "-" version ".tar.bz2"))
-             (file-name (string-append name "-" version ".tar.gz"))
+                   "discount/discount-" version ".tar.bz2"))
              (sha256
               (base32
-               "0r4gjyk1ngx47zhb25q0gkjm3bz2m5x8ngrk6rim3y1y3rricygc"))))
+               "024mxv0gpvilyfczarcgy5m7h4lv6qvhjfpf5i73qkxhszjjn9mi"))))
     (build-system gnu-build-system)
     (arguments
      `(#:test-target "test"
+       #:parallel-build? #f             ; libmarkdown won't be built in time
        #:make-flags (list
                      (string-append "LFLAGS=-L. -Wl,-rpath="
                                     (assoc-ref %outputs "out") "/lib"))
@@ -134,16 +144,20 @@ convert it to structurally valid XHTML (or HTML).")
              #t))
          (replace 'configure
            (lambda* (#:key inputs outputs #:allow-other-keys)
-             (setenv "CC" "gcc")
-             (zero? (system*
-                     "./configure.sh"
-                     (string-append "--prefix=" (assoc-ref outputs "out"))
-                     "--shared")))))))
+             (let ((out (assoc-ref outputs "out")))
+               (setenv "CC" ,(cc-for-target))
+               ;; The ‘validate-runpath’ phase fails otherwise.
+               (setenv "LDFLAGS" (string-append "-Wl,-rpath=" out "/lib"))
+               (invoke "./configure.sh"
+                       (string-append "--prefix=" out)
+                       "--shared")))))))
+    (native-inputs
+     `(("pkg-config" ,pkg-config)))
     (synopsis "Markdown processing library, written in C")
     (description
      "Discount is a markdown implementation, written in C.  It provides a
 @command{markdown} command, and a library.")
-    (home-page "http://www.pell.portland.or.us/~orc/Code/discount/")
+    (home-page "https://www.pell.portland.or.us/~orc/Code/discount/")
     (license bsd-3)))
 
 (define-public perl-text-markdown-discount
@@ -173,11 +187,12 @@ convert it to structurally valid XHTML (or HTML).")
                 (string-append
                       "OTHERLDFLAGS = -lmarkdown -Wl,-rpath="
                       (assoc-ref inputs "discount")
-                      "/lib"))))))))
+                      "/lib")))
+             #t)))))
     (inputs
      `(("discount" ,discount)))
     (home-page
-     "http://search.cpan.org/dist/Text-Markdown-Discount")
+     "https://metacpan.org/release/Text-Markdown-Discount")
     (synopsis
      "Fast function for converting Markdown to HTML using Discount")
     (description
@@ -193,15 +208,25 @@ implementation.
 (define-public cmark
   (package
     (name "cmark")
-    (version "0.28.0")
+    (version "0.29.0")
     (source (origin
-             (method url-fetch)
-             (uri (string-append "https://github.com/jgm/cmark/archive/"
-                                 version ".tar.gz"))
-             (file-name (string-append name "-" version ".tar.gz"))
+             (method git-fetch)
+             (uri (git-reference
+                    (url "https://github.com/jgm/cmark")
+                    (commit version)))
+             (file-name (git-file-name name version))
              (sha256
               (base32
-               "03pypf2mcacfa7lrwz66lh5hydsycc33arp1nx1lljbq98gikkv8"))))
+               "0r7jpqhgnssq444i8pwji2g36058vfzwkl70wbiwj13h4w5rfc8f"))
+             (modules '((guix build utils)))
+             (snippet
+              '(begin
+                 ;; Mimic upstream commit 68c3a91166347 to fix a test failure
+                 ;; when using Python 3.8.  Remove for versions > 0.29.
+                 ;; See <https://github.com/commonmark/cmark/issues/313>.
+                 (substitute* "test/normalize.py"
+                   (("cgi") "html"))
+                 #t))))
     (build-system cmake-build-system)
     (arguments
      '(#:test-target "test"))
@@ -210,11 +235,11 @@ implementation.
     (description "CommonMark is a strongly defined, highly compatible
 specification of Markdown.  cmark is the C reference implementation of
 CommonMark.  It provides @code{libcmark} shared library for parsing
-CommonMark to an abstract syntax tree (AST) and rendering the document
+CommonMark to an abstract syntax tree (@dfn{AST}) and rendering the document
 as HTML, groff man, LaTeX, CommonMark, or an XML representation of the
 AST.  The package also provides the command-line program @command{cmark}
 for parsing and rendering CommonMark.")
-    (home-page "http://commonmark.org")
+    (home-page "https://commonmark.org")
     ;; cmark is distributed with a BSD-2 license, but some components are Expat
     ;; licensed. The CommonMark specification is Creative Commons CC-BY-SA 4.0
     ;; licensed. See 'COPYING' in the source distribution for more information.
@@ -223,22 +248,22 @@ for parsing and rendering CommonMark.")
 (define-public smu
   (package
     (name "smu")
-    (version "1.4")
+    (version "1.5")
     (source
      (origin
-       (method url-fetch)
-       (uri (string-append "https://github.com/Gottox/smu/archive/v"
-                           version ".tar.gz"))
-       (file-name (string-append name "-" version ".tar.gz"))
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/Gottox/smu")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
        (sha256
-        (base32
-         "0iazl45rkz8ngsb5hpykl76w0ngvdvqqhym1qz5wykgmrzk293rp"))))
+        (base32 "1jm7lhnzjx4q7gcwlkvsbffcy0zppywyh50d71ami6dnq182vvcc"))))
     (build-system gnu-build-system)
     (arguments
      `(#:make-flags (list "CC=gcc"
                           (string-append "PREFIX="
                                          (assoc-ref %outputs "out")))
-       #:tests? #f ;No tests included
+       #:tests? #f                      ; no tests included
        #:phases
        (modify-phases %standard-phases
          (delete 'configure))))
@@ -255,3 +280,47 @@ Smu was started as a rewrite of Markdown but became something more
 lightweight and consistent.  The biggest difference between Markdown
 and smu is that smu doesn't support reference style links.")
     (license x11)))
+
+(define-public md4c
+  (package
+    (name "md4c")
+    (version "0.4.8")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/mity/md4c/")
+             (commit (string-append "release-" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "12pdh4rfjc3b0cblj5nz3jksr2376lx8ay0vw5dwa1s97q09pczq"))))
+    (build-system cmake-build-system)
+    (arguments '(#:tests? #f))
+    (home-page "https://github.com/mity/md4c/")
+    (synopsis "C Markdown parser compliant to CommonMark")
+    (description "MD4C is a C Markdown parser with a
+SAX-like interface.  It is compliant to the CommonMark specification,
+with a few extensions.")
+    (license expat)))
+
+(define-public python-mistletoe
+  (package
+    (name "python-mistletoe")
+    (version "0.7.2")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "mistletoe" version))
+       (sha256
+        (base32 "18z6hqfnfjqnrcgfgl5pkj9ggf9yx0yyy94azcn1qf7hqn6g3l14"))))
+    (build-system python-build-system)
+    (home-page "https://github.com/miyuchina/mistletoe")
+    (synopsis "Extensible Markdown parser in pure Python")
+    (description
+     "The @code{mistletoe} Markdown parser is a CommonMark-compliant Markdown
+parser that supports definitions of custom tokens.
+
+Parsing Markdown into an abstract syntax tree also allows @code{mistletoe} to
+swap out renderers for different output formats, without touching any of the
+core components.")
+    (license expat)))