summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNguyễn Gia Phong <cnx@loang.net>2026-03-09 15:20:34 +0900
committerNguyễn Gia Phong <cnx@loang.net>2026-04-02 11:35:51 +0900
commit3d3e8d7d6763ac1a5ac55a08dde976f943425a05 (patch)
tree19627bb0c299fa540a7657a2be740fb5d9f0f555
parentf52e17b7366ce115bff41b3c894d8e6b7be34544 (diff)
gnu: Add lua-djot.
* gnu/packages/lua.scm (lua5.4-djot, lua-djot) (lua5.2-djot, lua5.1-djot): New variables. Change-Id: I152a723dcece7218def021fbaefa50a662a811e0 Reviewed-by: Carlo Zancanaro <carlo@zancanaro.id.au>
-rw-r--r--gnu/packages/lua.scm63
1 files changed, 63 insertions, 0 deletions
diff --git a/gnu/packages/lua.scm b/gnu/packages/lua.scm
index 5de59de4bb4..dab1249f1c6 100644
--- a/gnu/packages/lua.scm
+++ b/gnu/packages/lua.scm
@@ -26,6 +26,7 @@
;;; Copyright © 2025 Zheng Junjie <z572@z572.online>
;;; Copyright © 2025 Ashish SHUKLA <ashish.is@lostca.se>
;;; Copyright © 2025 Aaron Boyd <aaron.boyd.org@gmail.com>
+;;; Copyright © 2026 Nguyễn Gia Phong <cnx@loang.net>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -1201,6 +1202,68 @@ on numbers.")
(define-public lua5.1-bitop
(make-lua-bitop "lua5.1-bitop" lua-5.1))
+(define (make-lua-djot name lua)
+ (package
+ (name name)
+ (version "0.2.1")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/jgm/djot.lua")
+ (commit version)))
+ (file-name (git-file-name name version))
+ (sha256 (base32 "0kivx4yyj2zhj23d93h5rr0ab7gkazd3z7r7aqv1bgmigcw47pj2"))
+ (modules '((guix build utils)))
+ (snippet #~(begin
+ (delete-file-recursively "clib")
+ (delete-file-recursively "doc/api")
+ (delete-file "doc/djot.1")))))
+ (build-system gnu-build-system)
+ (arguments
+ (list
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'patch-makefile
+ (lambda _
+ (substitute* "Makefile"
+ (("^all: .*") "all:\n"))))
+ (delete 'configure)
+ (replace 'check
+ (lambda* (#:key tests? #:allow-other-keys)
+ (when tests?
+ (invoke "lua" "test.lua"))))
+ (replace 'install
+ (lambda _
+ (let ((lua-path
+ (string-append
+ #$output
+ "/share/lua/"
+ #$(version-major+minor (package-version lua)))))
+ (install-file "djot.lua" lua-path)
+ (copy-recursively "djot" (string-append lua-path "/djot"))))))))
+ (native-inputs (list lua))
+ (home-page "https://github.com/jgm/djot.lua")
+ (synopsis "Lua parser for the djot light markup language")
+ (description
+ "This package provides a Lua parser for djot, a light markup syntax.
+It can produce an AST, rendered HTML, or a stream of match tokens
+that identify elements by source position, which could be used
+for syntax highlighting or a linting tool.")
+ (license license:expat)))
+
+(define-public lua5.4-djot
+ (make-lua-djot "lua5.4-djot" lua-5.4))
+
+(define-public lua-djot
+ (make-lua-djot "lua-djot" lua))
+
+(define-public lua5.2-djot
+ (make-lua-djot "lua5.2-djot" lua-5.2))
+
+(define-public lua5.1-djot
+ (make-lua-djot "lua5.1-djot" lua-5.1))
+
(define-public lutok
(package
(name "lutok")