unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Christina O'Donnell <cdo@mutix.org>
To: 56576@debbugs.gnu.org
Cc: Maxime Devos <maximedevos@telnet.be>,
	Christina O'Donnell <cdo@mutix.org>,
	Steve George <steve@futrile.net>
Subject: [bug#56576] [PATCH v3 1/3] gnu: Add markdeep.
Date: Wed,  3 Apr 2024 23:46:32 +0100	[thread overview]
Message-ID: <aa7483564f086c1dd70c428c0156ef8355e76a61.1712184392.git.cdo@mutix.org> (raw)
In-Reply-To: <20220715145735.5752-1-antero@mailbox.org>

* gnu packages/documentation.scm (markdeep): New variable.

Change-Id: I34303377f50740ba357c1bb299c9434079a6e23d
---
 gnu/packages/documentation.scm | 65 ++++++++++++++++++++++++++++++++++
 1 file changed, 65 insertions(+)

Hi,

I've gone through these patches, making the changes that Maxime listed
and that came up from `guix lint`. I've added the additional package
markdeep, which is a css/javascript rendering library needed for stddoc.

I checked these very carefully, but I'm new to this so it's likely that
I've made at least a few mistakes. Everything appears to be working as
far as I've tested it. I had anything to test nuklear with, so I'm
taking that part on faith.

Let me know whether there's anything that I could change or do better
for next time. 

Kind regards,
Christina

diff --git a/gnu/packages/documentation.scm b/gnu/packages/documentation.scm
index 83c4313bd7..da930c7304 100644
--- a/gnu/packages/documentation.scm
+++ b/gnu/packages/documentation.scm
@@ -37,6 +37,7 @@ (define-module (gnu packages documentation)
   #:use-module (guix git-download)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system cmake)
+  #:use-module (guix build-system copy)
   #:use-module (guix build-system perl)
   #:use-module (guix build-system python)
   #:use-module (guix build-system qt)
@@ -57,11 +58,13 @@ (define-module (gnu packages documentation)
   #:use-module (gnu packages graphviz)
   #:use-module (gnu packages gettext)
   #:use-module (gnu packages glib)
+  #:use-module (gnu packages javascript)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages qt)
   #:use-module (gnu packages sqlite)
   #:use-module (gnu packages sphinx)
+  #:use-module (gnu packages uglifyjs)
   #:use-module (gnu packages xml)
   #:use-module (gnu packages xorg))
 
@@ -453,3 +456,65 @@ (define-public zeal
       (description "Zeal is a simple offline documentation browser
 inspired by Dash.")
       (license license:gpl3+))))
+
+(define-public markdeep
+  (package
+    (name "markdeep")
+    (version "1.16")
+    (home-page "https://casual-effects.com/markdeep/")
+    (source
+     (origin (method git-fetch)
+             (uri (git-reference
+                   (url "https://github.com/morgan3d/markdeep")
+                   (commit (string-append "v0" version))))
+             (sha256
+              (base32 "05bvw3993xh1260ckclwk4jw38hvgiff0b2940ryhbhz0p1k41l8"))))
+    (build-system copy-build-system)
+    (arguments
+     (list #:modules '((guix build utils)
+                       (guix build copy-build-system)
+                       (ice-9 popen))
+           #:install-plan ''(("." "/share/markdeep/"))
+           #:phases
+           #~(modify-phases %standard-phases
+          (add-after 'unpack 'patch-urls
+            (lambda _
+              (for-each (lambda (filename)
+
+                          (substitute* filename
+                            ;; Don't include a reference to the remote version.
+                            (("<script src=\"https://casual-effects\\.com/\
+markdeep/latest/markdeep\\.min\\.js\\?\"></script>")
+                             "")
+                            (("MATHJAX_URL = .*$")
+                             ;; Use our local copy of mathjax
+                             (string-append "MATHJAX_URL = 'file://" #$js-mathjax
+                                            "/share/javascript/es5/tex-mml-chtml.js'"))))
+                        (find-files "." (lambda (file stat)
+                                          (string-suffix? ".js" file))))))
+          (add-before 'install 'minify
+            (lambda _
+              (for-each (lambda (filename)
+                          (let ((minified-filename
+                                 (string-append (string-drop-right filename 3)
+                                                ".min.js")))
+                          (format #t "~a -> ~a~%" filename minified-filename)
+                          (let ((minified (open-pipe* OPEN_READ "uglifyjs" filename)))
+                            (call-with-output-file minified-filename
+                              (lambda (port)
+                                (dump-port minified port)))
+
+                            (let ((exit (close-pipe minified)))
+                              (unless (zero? exit)
+                                (error "uglifyjs failed" exit))))))
+                        (find-files "latest"
+                                    (lambda (path stat)
+                                      (and (string-suffix? ".js" path)
+                                           (not (string-suffix? ".min.js" path)))))))))))
+    (inputs (list js-mathjax))
+    (native-inputs (list uglifyjs))
+    (synopsis "Tool for displaying markdown documents in a web-browser")
+    (description "Markdeep is a technology for writing plain text documents that can
+be displayed in any web browser, whether local or remote.  It supports diagrams,
+calendars, equations, and other features as extensions of Markdown syntax.")
+    (license license:bsd-2)))

base-commit: 4d994f98a49e1a6e58b9b0b512a05efc1c431a50
-- 
2.41.0





  parent reply	other threads:[~2024-04-03 22:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-15 14:57 [bug#56576] [PATCH] gnu: Add nuklear Antero Mejr via Guix-patches via
2022-08-05  3:03 ` 宋文武 via Guix-patches via
2022-08-06 22:57 ` [bug#56576] [PATCH 1/2] gnu: Add stddoc Antero Mejr via Guix-patches via
2022-08-06 22:57   ` [bug#56576] [PATCH 2/2] gnu: Add nuklear Antero Mejr via Guix-patches via
2022-08-07 12:10   ` [bug#56576] [PATCH 1/2] gnu: Add stddoc Maxime Devos
2024-04-03 22:46 ` Christina O'Donnell [this message]
2024-04-03 22:46   ` [bug#56576] [PATCH v3 2/3] " Christina O'Donnell
2024-04-03 22:46   ` [bug#56576] [PATCH v3 3/3] gnu: Add nuklear Christina O'Donnell
2024-04-11 10:37   ` bug#56576: [PATCH v3 1/3] gnu: Add markdeep Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aa7483564f086c1dd70c428c0156ef8355e76a61.1712184392.git.cdo@mutix.org \
    --to=cdo@mutix.org \
    --cc=56576@debbugs.gnu.org \
    --cc=maximedevos@telnet.be \
    --cc=steve@futrile.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).