Compare commits
7 Commits
94dd2f4a8e
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
c0787f8ee1
|
|||
|
28736ce6c0
|
|||
|
1eadafd8e0
|
|||
|
61f7a1fb28
|
|||
|
d851c7de92
|
|||
|
86f211ba50
|
|||
|
8bec97a8a0
|
11
.build.yml
11
.build.yml
@@ -1,11 +0,0 @@
|
|||||||
image: alpine/edge
|
|
||||||
packages:
|
|
||||||
- emacs
|
|
||||||
- make
|
|
||||||
sources:
|
|
||||||
- https://git.sr.ht/~abrahms/ox-gemini
|
|
||||||
tasks:
|
|
||||||
- build: |
|
|
||||||
cd ox-gemini
|
|
||||||
make update
|
|
||||||
make compile
|
|
||||||
75
.drone.yml
Normal file
75
.drone.yml
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: emacs 26
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: tests
|
||||||
|
image: silex/emacs:26-alpine
|
||||||
|
commands:
|
||||||
|
- apk add npm make
|
||||||
|
- npm install -g @emacs-eask/cli
|
||||||
|
- make clean
|
||||||
|
- make package
|
||||||
|
- make install
|
||||||
|
- make compile
|
||||||
|
- make checkdoc
|
||||||
|
- make lint
|
||||||
|
- make clean
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: emacs 27
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: tests
|
||||||
|
image: silex/emacs:27-alpine
|
||||||
|
commands:
|
||||||
|
- apk add npm make
|
||||||
|
- npm install -g @emacs-eask/cli
|
||||||
|
- make clean
|
||||||
|
- make package
|
||||||
|
- make install
|
||||||
|
- make compile
|
||||||
|
- make checkdoc
|
||||||
|
- make lint
|
||||||
|
- make clean
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: emacs 28
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: tests
|
||||||
|
image: silex/emacs:28-alpine
|
||||||
|
commands:
|
||||||
|
- apk add npm make
|
||||||
|
- npm install -g @emacs-eask/cli
|
||||||
|
- make clean
|
||||||
|
- make package
|
||||||
|
- make install
|
||||||
|
- make compile
|
||||||
|
- make checkdoc
|
||||||
|
- make lint
|
||||||
|
- make clean
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: emacs master
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: tests
|
||||||
|
image: silex/emacs:master-alpine
|
||||||
|
commands:
|
||||||
|
- apk add npm make
|
||||||
|
- npm install -g @emacs-eask/cli
|
||||||
|
- make clean
|
||||||
|
- make package
|
||||||
|
- make install
|
||||||
|
- make compile
|
||||||
|
- make checkdoc
|
||||||
|
- make lint
|
||||||
|
- make clean
|
||||||
17
.gitignore
vendored
17
.gitignore
vendored
@@ -1,2 +1,17 @@
|
|||||||
|
# ignore these directories
|
||||||
|
/.git
|
||||||
|
/recipes
|
||||||
|
|
||||||
|
# ignore log files
|
||||||
|
/.log
|
||||||
|
|
||||||
|
# ignore generated files
|
||||||
*.elc
|
*.elc
|
||||||
.elpa/
|
|
||||||
|
# eask packages
|
||||||
|
.eask/
|
||||||
|
dist/
|
||||||
|
|
||||||
|
# packaging
|
||||||
|
*-autoloads.el
|
||||||
|
*-pkg.el
|
||||||
|
|||||||
14
Eask
Normal file
14
Eask
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
(package "ox-gemini"
|
||||||
|
"0.2.0"
|
||||||
|
"Output gemini formatted documents from org-mode")
|
||||||
|
|
||||||
|
(website-url "https://labs.phundrak.com/phundrak/ox-gemini")
|
||||||
|
(keywords "lisp" "org-mode")
|
||||||
|
|
||||||
|
(package-file "ox-gemini.el")
|
||||||
|
|
||||||
|
(script "test" "echo \"Error: no test specified\" && exit 1")
|
||||||
|
|
||||||
|
(source "gnu")
|
||||||
|
|
||||||
|
(depends-on "emacs" "26.1")
|
||||||
70
Makefile
70
Makefile
@@ -1,16 +1,64 @@
|
|||||||
EMACS = emacs
|
EMACS ?= emacs
|
||||||
|
EASK ?= eask
|
||||||
|
|
||||||
compile: clean lint
|
.PHONY: clean package install compile test checkdoc lint
|
||||||
${EMACS} --version
|
|
||||||
${EMACS} -batch -l test/elpa.el -l test/compile.el
|
|
||||||
|
|
||||||
clean:
|
# (Option 1): Basic for beginner, only tests for package's installation
|
||||||
rm -f *.elc
|
ci: clean package install compile
|
||||||
|
# (Option 2): Advanced for a high-quality package
|
||||||
|
#ci: clean package install compile checkdoc lint test
|
||||||
|
|
||||||
|
# Build an package artefact, default to `dist` folder
|
||||||
|
#
|
||||||
|
# This is used to test if your package can be built correctly before the
|
||||||
|
# package installation.
|
||||||
|
package:
|
||||||
|
@echo "Packaging..."
|
||||||
|
$(EASK) package
|
||||||
|
|
||||||
|
# Install package
|
||||||
|
#
|
||||||
|
# If your package is a single file package, you generally wouldn't need to
|
||||||
|
install:
|
||||||
|
@echo "Installing..."
|
||||||
|
$(EASK) install
|
||||||
|
|
||||||
|
# Byte-compile package
|
||||||
|
#
|
||||||
|
# Compile all your package .el files to .elc
|
||||||
|
compile:
|
||||||
|
@echo "Compiling..."
|
||||||
|
$(EASK) compile
|
||||||
|
|
||||||
|
# Run regression tests
|
||||||
|
#
|
||||||
|
# The default test is `ert`; but Eask also support other regression test!
|
||||||
|
# See https://emacs-eask.github.io/Getting-Started/Commands-and-options/#-linter
|
||||||
|
test:
|
||||||
|
@echo "Testing..."
|
||||||
|
$(EASK) install-deps --dev
|
||||||
|
$(EASK) test ert ./test/*.el
|
||||||
|
|
||||||
|
# Run checkdoc
|
||||||
|
#
|
||||||
|
# See https://www.emacswiki.org/emacs/CheckDoc
|
||||||
|
checkdoc:
|
||||||
|
@echo "Checking documentation..."
|
||||||
|
$(EASK) lint checkdoc --strict
|
||||||
|
|
||||||
|
# Lint package metadata
|
||||||
|
#
|
||||||
|
# See https://github.com/purcell/package-lint
|
||||||
lint:
|
lint:
|
||||||
${EMACS} --batch -l test/lint.el
|
@echo "Linting..."
|
||||||
|
$(EASK) lint package
|
||||||
|
|
||||||
update:
|
# Clean up
|
||||||
${EMACS} -batch -l test/make-update.el
|
#
|
||||||
|
# This will clean all the entire workspace including the following folders
|
||||||
.PHONY: update compile test clean
|
# and files
|
||||||
|
#
|
||||||
|
# - .eask folder (sandbox)
|
||||||
|
# - all .elc files
|
||||||
|
clean:
|
||||||
|
$(EASK) clean all
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
# ox-gemini
|
|
||||||
|
|
||||||
This adds support for exporting org files in gemini format. Many things in here were taken from the ascii exporter, from which this one derives.
|
|
||||||
|
|
||||||
- Read more about gemini here: https://gemini.circumlunar.space/
|
|
||||||
- Read more about org-mode here: https://orgmode.org/
|
|
||||||
|
|
||||||
## License
|
|
||||||
This software is licensed under GPLv3.
|
|
||||||
29
README.org
Normal file
29
README.org
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
#+title: ox-gemini
|
||||||
|
|
||||||
|
#+html: <a href="https://drone.phundrak.com/phundrak/ox-gemini"><img src="https://drone.phundrak.com/api/badges/phundrak/ox-gemini/status.svg" /></a>
|
||||||
|
|
||||||
|
Forked from Justin Abrahms’ [[https://git.sr.ht/~abrahms/ox-gemini][original ox-gemini]].
|
||||||
|
|
||||||
|
* =ox-gemini=
|
||||||
|
This adds support for exporting org files in gemini format. Many
|
||||||
|
things in here were taken from the ascii exporter, from which this one
|
||||||
|
derives.
|
||||||
|
|
||||||
|
- Read more about gemini here: https://gemini.circumlunar.space/
|
||||||
|
- Read more about org-mode here: https://orgmode.org/
|
||||||
|
|
||||||
|
* What this fork adds
|
||||||
|
Not much, really. For now, this is just a way for me to apply a fix in
|
||||||
|
gemini links as described in commit [[https://labs.phundrak.com/phundrak/ox-gemini/commit/94dd2f4a8e5ca50bbfb857395d98da88bf581b6c][94dd2f4]].
|
||||||
|
This forks fixes two issues the original =ox-gemini= has:
|
||||||
|
- link descriptions include a newline when the orgmode code also does,
|
||||||
|
which breaks things (see commit [[https://labs.phundrak.com/phundrak/ox-gemini/commit/94dd2f4a8e5ca50bbfb857395d98da88bf581b6c][94dd2f4]])
|
||||||
|
- inline code carries a trailing whitespace (see commit [[https://labs.phundrak.com/phundrak/ox-gemini/commit/1eadafd8e0f9848bb0119076cab15f0b5b23ed0c][1eadafd8e0]])
|
||||||
|
|
||||||
|
TODOs formerly in =ox-gemini.el= have also been moved to issues.
|
||||||
|
|
||||||
|
** Eask
|
||||||
|
This project is managed with [[https://github.com/emacs-eask/cli][Eask]].
|
||||||
|
|
||||||
|
* License
|
||||||
|
This software is licensed under GPLv3.
|
||||||
39
ox-gemini.el
39
ox-gemini.el
@@ -1,12 +1,27 @@
|
|||||||
;;; ox-gemini.el --- Output gemini formatted documents from org-mode -*- lexical-binding: t; -*-
|
;;; ox-gemini.el --- Output gemini formatted documents from org-mode -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
;; Author: Justin Abrahms <justin@abrah.ms>
|
;; Author: Justin Abrahms <justin@abrah.ms>
|
||||||
;; URL: https://git.sr.ht/~abrahms/ox-gemini
|
;; Maintainer: Lucien Cartier-Tilet <lucien@phundrak.com>
|
||||||
;; Keywords: lisp gemini
|
;; URL: https://labs.phundrak.com/phundrak/ox-gemini
|
||||||
;; Version: 0
|
;; Version: 0.2.0
|
||||||
|
;; Keywords: lisp org-mode
|
||||||
;; Package-Requires: ((emacs "26.1"))
|
;; Package-Requires: ((emacs "26.1"))
|
||||||
;; SPDX-License-Identifier: GPL-3.0-or-later
|
;; SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
;; This file is not part of GNU Emacs.
|
||||||
|
|
||||||
|
;; This program is free software: you can redistribute it and/or modify
|
||||||
|
;; it under the terms of the GNU General Public License as published by
|
||||||
|
;; the Free Software Foundation, either version 3 of the License, or
|
||||||
|
;; (at your option) any later version.
|
||||||
|
|
||||||
|
;; This program is distributed in the hope that it will be useful,
|
||||||
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
;; GNU General Public License for more details.
|
||||||
|
|
||||||
|
;; You should have received a copy of the GNU General Public License
|
||||||
|
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
;;; Commentary:
|
;;; Commentary:
|
||||||
;;
|
;;
|
||||||
@@ -22,17 +37,11 @@
|
|||||||
(require 'cl-lib)
|
(require 'cl-lib)
|
||||||
(require 'url-util)
|
(require 'url-util)
|
||||||
|
|
||||||
;; TODO:
|
|
||||||
;; Sublists aren't supported in gemini
|
|
||||||
;; There's a trailing space after inline code samples
|
|
||||||
;; If you link a file to an absolute path, the links break
|
|
||||||
;; bare links don't work (e.g. directly linking https://google.com)
|
|
||||||
|
|
||||||
;;; Code:
|
;;; Code:
|
||||||
|
|
||||||
(org-export-define-derived-backend 'gemini 'ascii
|
(org-export-define-derived-backend 'gemini 'ascii
|
||||||
:menu-entry
|
:menu-entry
|
||||||
'(?g "Export to Gemini"
|
'(?G "Export to Gemini"
|
||||||
((?b "To buffer"
|
((?b "To buffer"
|
||||||
(lambda (a s v b)
|
(lambda (a s v b)
|
||||||
(org-gemini-export-to-buffer a s v b nil)))
|
(org-gemini-export-to-buffer a s v b nil)))
|
||||||
@@ -82,7 +91,9 @@ ITEM is the parsed-org element with all properties."
|
|||||||
INPUT is either a \\='src-block\\=' or \\='example-block\\='
|
INPUT is either a \\='src-block\\=' or \\='example-block\\='
|
||||||
element. INFO is a plist."
|
element. INFO is a plist."
|
||||||
;; there's a bug here where there's a trailing space in the ``
|
;; there's a bug here where there's a trailing space in the ``
|
||||||
(format "`%s`" (org-export-format-code-default input info)))
|
(format "`%s`" (replace-regexp-in-string (rx (* whitespace) eot)
|
||||||
|
""
|
||||||
|
(org-export-format-code-default input info))))
|
||||||
|
|
||||||
(defun org-gemini-code-block (src-block _contents info)
|
(defun org-gemini-code-block (src-block _contents info)
|
||||||
"SRC-BLOCK is a codeblock. INFO is a plist."
|
"SRC-BLOCK is a codeblock. INFO is a plist."
|
||||||
@@ -109,7 +120,8 @@ INFO is a plist."
|
|||||||
(concat (file-name-sans-extension (org-element-property :path link)) ".gmi")
|
(concat (file-name-sans-extension (org-element-property :path link)) ".gmi")
|
||||||
raw-path))
|
raw-path))
|
||||||
(desc (org-element-contents link))
|
(desc (org-element-contents link))
|
||||||
(anchor (string-replace "\n" " "
|
(anchor (replace-regexp-in-string (regexp-quote "\n")
|
||||||
|
" "
|
||||||
(org-export-data
|
(org-export-data
|
||||||
(or desc (org-element-property :raw-link link))
|
(or desc (org-element-property :raw-link link))
|
||||||
info))))
|
info))))
|
||||||
@@ -152,8 +164,7 @@ contextual information."
|
|||||||
(if (or (not headline) (org-export-low-level-p headline info)) 0
|
(if (or (not headline) (org-export-low-level-p headline info)) 0
|
||||||
(plist-get info :ascii-inner-margin))))))
|
(plist-get info :ascii-inner-margin))))))
|
||||||
|
|
||||||
(defun org-gemini--build-title
|
(defun org-gemini--build-title (element info _text-width &optional _underline _notags toc)
|
||||||
(element info _text-width &optional _underline _notags toc)
|
|
||||||
"Build a title heading.
|
"Build a title heading.
|
||||||
|
|
||||||
ELEMENT is an org-element. TOC is whether to show the table of contents.
|
ELEMENT is an org-element. TOC is whether to show the table of contents.
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
;; bail out on compilation warnings and errors
|
|
||||||
(setq byte-compile-error-on-warn t)
|
|
||||||
(setq byte-compile--use-old-handlers nil)
|
|
||||||
|
|
||||||
;; compile *.el files
|
|
||||||
(dolist (file (file-expand-wildcards "*.el"))
|
|
||||||
(unless (byte-compile-file file)
|
|
||||||
(kill-emacs 1)))
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
(setq package-user-dir
|
|
||||||
(expand-file-name (format ".elpa/%s/elpa" emacs-version)))
|
|
||||||
(package-initialize)
|
|
||||||
(add-to-list 'load-path default-directory)
|
|
||||||
16
test/lint.el
16
test/lint.el
@@ -1,16 +0,0 @@
|
|||||||
(message "Emacs version: %s" emacs-version)
|
|
||||||
|
|
||||||
(dolist (file (file-expand-wildcards "*.el"))
|
|
||||||
(let ((checkdoc-diagnostic-buffer "*warn*")
|
|
||||||
;; bail out on checkdoc warnings
|
|
||||||
(checkdoc-create-error-function (lambda (text start end &optional unfixable)
|
|
||||||
(message "%s:%s %s"
|
|
||||||
file
|
|
||||||
(line-number-at-pos start)
|
|
||||||
text)
|
|
||||||
(kill-emacs 1))))
|
|
||||||
(with-current-buffer (find-file-noselect file)
|
|
||||||
;; Eval the buffer first because otherwise checkdoc isn't smart
|
|
||||||
;; enough to recognize that some symbols are defined.
|
|
||||||
(eval-buffer)
|
|
||||||
(checkdoc-current-buffer t))))
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
;; list of the all the dependencies, including the dev dependencies
|
|
||||||
(defvar dev-packages '(evil evil-test-helpers))
|
|
||||||
|
|
||||||
;; initialize package.el
|
|
||||||
(setq package-user-dir
|
|
||||||
(expand-file-name (format ".elpa/%s/elpa" emacs-version)))
|
|
||||||
(message "installing in %s ...\n" package-user-dir)
|
|
||||||
(package-initialize)
|
|
||||||
(setq package-archives
|
|
||||||
'(("melpa" . "http://melpa.org/packages/")
|
|
||||||
("gnu" . "http://elpa.gnu.org/packages/")))
|
|
||||||
(package-refresh-contents)
|
|
||||||
|
|
||||||
;; install dependencies
|
|
||||||
(dolist (package dev-packages)
|
|
||||||
(unless (package-installed-p package)
|
|
||||||
(ignore-errors
|
|
||||||
(package-install package))))
|
|
||||||
|
|
||||||
;; upgrade dependencies
|
|
||||||
(save-window-excursion
|
|
||||||
(package-list-packages t)
|
|
||||||
(condition-case nil
|
|
||||||
(progn
|
|
||||||
(package-menu-mark-upgrades)
|
|
||||||
(package-menu-execute t))
|
|
||||||
(error
|
|
||||||
(message "All packages up to date"))))
|
|
||||||
Reference in New Issue
Block a user