svelte-preprocess-org 0.2.4 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +22 -30
- package/.editorconfig +0 -15
- package/.gitmodules +0 -3
- package/README.md +0 -11
- package/dist/emacs.d.ts +0 -7
- package/dist/index.d.ts +0 -8
- package/dist/index.js +0 -1
- package/dist/lisp/convert.el +0 -86
- package/dist/lisp/ox-svelte/LICENSE +0 -674
- package/dist/lisp/ox-svelte/README.md +0 -4
- package/dist/lisp/ox-svelte/README.org +0 -3
- package/dist/lisp/ox-svelte/index.d.ts +0 -19
- package/dist/lisp/ox-svelte/ox-svelte.el +0 -353
- package/dist/lisp/ox-svelte/package.json +0 -11
- package/dist/lisp/ox-svelte/pnpm-lock.yaml +0 -155
- package/dist/sexp.d.ts +0 -17
- package/eslint.config.js +0 -9
- package/jest.config.js +0 -11
- package/prettier.config.js +0 -5
- package/rollup.config.js +0 -22
- package/src/emacs.ts +0 -55
- package/src/index.ts +0 -29
- package/src/lisp/convert.el +0 -86
- package/src/lisp/ox-svelte/LICENSE +0 -674
- package/src/lisp/ox-svelte/README.md +0 -4
- package/src/lisp/ox-svelte/index.d.ts +0 -19
- package/src/lisp/ox-svelte/ox-svelte.el +0 -353
- package/src/lisp/ox-svelte/package.json +0 -11
- package/src/lisp/ox-svelte/pnpm-lock.yaml +0 -155
- package/src/sexp.ts +0 -112
- package/test/sexp.test.ts +0 -45
- package/tsconfig.json +0 -17
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { SvelteComponent } from 'svelte';
|
|
2
|
-
|
|
3
|
-
declare module 'ox-svelte' {
|
|
4
|
-
export type OrgModule = {
|
|
5
|
-
default: typeof SvelteComponent;
|
|
6
|
-
metadata: OrgMetadata;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export type OrgMetadata = {
|
|
10
|
-
title: string?;
|
|
11
|
-
subtitle: string?;
|
|
12
|
-
author: string?;
|
|
13
|
-
date: string?;
|
|
14
|
-
description: string?;
|
|
15
|
-
keywords: string[]?;
|
|
16
|
-
language: string?;
|
|
17
|
-
creator: string?;
|
|
18
|
-
};
|
|
19
|
-
}
|
|
@@ -1,353 +0,0 @@
|
|
|
1
|
-
;;; ox-svelte.el --- Svelte Backend for Org Export Engine -*- lexical-binding: t -*-
|
|
2
|
-
|
|
3
|
-
;; Copyright (C) 2024 RangHo Lee
|
|
4
|
-
|
|
5
|
-
;; Author: RangHo Lee <hello@rangho.me>
|
|
6
|
-
|
|
7
|
-
;; This file is NOT part of GNU Emacs.
|
|
8
|
-
|
|
9
|
-
;; This program is free software: you can redistribute it and/or modify
|
|
10
|
-
;; it under the terms of the GNU General Public License as published by
|
|
11
|
-
;; the Free Software Foundation, either version 3 of the License, or
|
|
12
|
-
;; (at your option) any later version.
|
|
13
|
-
|
|
14
|
-
;; This program is distributed in the hope that it will be useful,
|
|
15
|
-
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16
|
-
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
17
|
-
;; GNU General Public License for more details.
|
|
18
|
-
|
|
19
|
-
;; You should have received a copy of the GNU General Public License
|
|
20
|
-
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
21
|
-
|
|
22
|
-
;;; Commentary:
|
|
23
|
-
|
|
24
|
-
;; This library implements a Svelte backend for Org mode generic exporter.
|
|
25
|
-
;; It is based on the HTML backend, and generates a HTML file per Org file.
|
|
26
|
-
|
|
27
|
-
;;; Code:
|
|
28
|
-
|
|
29
|
-
(require 'json)
|
|
30
|
-
(require 'org)
|
|
31
|
-
(require 'org-element)
|
|
32
|
-
(require 'ox)
|
|
33
|
-
(require 'ox-html)
|
|
34
|
-
|
|
35
|
-
(defgroup org-export-svelte nil
|
|
36
|
-
"Options for exporting Org mode files to Svelte."
|
|
37
|
-
:tag "Org Export Svelte"
|
|
38
|
-
:group 'org-export)
|
|
39
|
-
|
|
40
|
-
(defcustom org-svelte-component-import-alist
|
|
41
|
-
nil
|
|
42
|
-
"Alist of components to import in the generated Svelte file.
|
|
43
|
-
|
|
44
|
-
The `car' of each element is the component name, and the `cdr' is the path to
|
|
45
|
-
the component file relative to the generated Svelte file. This list is provided
|
|
46
|
-
to import shared components that are used to render certain Org elements (e.g.
|
|
47
|
-
using a custom component to render LaTeX fragments).
|
|
48
|
-
|
|
49
|
-
If this list is nil, no components will be imported.
|
|
50
|
-
|
|
51
|
-
For example, if you want to import a component named `LaTeX' from the path
|
|
52
|
-
`./components/LaTeX.svelte', you can set this variable as follows:
|
|
53
|
-
|
|
54
|
-
(setq org-svelte-component-import-alist
|
|
55
|
-
\\'((\"LaTeX\" . \"./components/LaTeX.svelte\")))
|
|
56
|
-
|
|
57
|
-
And the generated Svelte file will contain the following import statement:
|
|
58
|
-
|
|
59
|
-
import LaTeX from './components/LaTeX.svelte';"
|
|
60
|
-
:group 'org-export-svelte
|
|
61
|
-
:type '(repeat (cons (string "Component name")
|
|
62
|
-
(string "Component path"))))
|
|
63
|
-
|
|
64
|
-
(defcustom org-svelte-raw-script-content
|
|
65
|
-
""
|
|
66
|
-
"JavaScript code that will be included in the module context script verbatim.
|
|
67
|
-
|
|
68
|
-
The content of this variable will be inserted right after the generated import
|
|
69
|
-
statements. It must contain a valid JavaScript code, as this Emacs module will
|
|
70
|
-
perform no validation.
|
|
71
|
-
|
|
72
|
-
In the similar sense, it is highly recommended that you always use semicolons
|
|
73
|
-
at least for this section. Your script, combined with automatically generated
|
|
74
|
-
import statements and metadata storage, may be parsed unexpectedly if you rely
|
|
75
|
-
on JavaScript semicolon correction mechanism."
|
|
76
|
-
:group 'org-export-svelte
|
|
77
|
-
:type 'string)
|
|
78
|
-
|
|
79
|
-
(defconst org-svelte--component-import-format
|
|
80
|
-
"import %s from '%s';"
|
|
81
|
-
"Format string that will be used to generate the import statement.")
|
|
82
|
-
|
|
83
|
-
(defconst org-svelte-metadata-format
|
|
84
|
-
"export const metadata = %s;"
|
|
85
|
-
"Format string that will be used to generate the metadata.")
|
|
86
|
-
|
|
87
|
-
(defconst org-svelte--module-context-script-regexp
|
|
88
|
-
"<script context=\"module\">"
|
|
89
|
-
"Regexp that matches the opening tag of the module-context script.")
|
|
90
|
-
|
|
91
|
-
(defcustom org-svelte-id-attribute-type
|
|
92
|
-
nil
|
|
93
|
-
"Type of ID attribute to use in the generated Svelte code.
|
|
94
|
-
|
|
95
|
-
This option can be nil (the default) or t to remove all ID attributes or to use
|
|
96
|
-
the default ID generation algorithm."
|
|
97
|
-
:group 'org-export-svelte
|
|
98
|
-
:type '(choice (const :tag "Default" nil)
|
|
99
|
-
(const :tag "Remove all" t)))
|
|
100
|
-
|
|
101
|
-
(defcustom org-svelte-latex-environment-format
|
|
102
|
-
"{@html %s}"
|
|
103
|
-
"Format string that will be used to generate the LaTeX environment.
|
|
104
|
-
|
|
105
|
-
The format string should contain a single `%s' specifier, which will be replaced
|
|
106
|
-
with the LaTeX environment's source code as a JavaScript raw string.
|
|
107
|
-
|
|
108
|
-
By default, the source code will be printed as a raw HTML string."
|
|
109
|
-
:group 'org-export-svelte
|
|
110
|
-
:type 'string)
|
|
111
|
-
|
|
112
|
-
(defcustom org-svelte-latex-fragment-format
|
|
113
|
-
"{@html %s}"
|
|
114
|
-
"Format string that will be used to generate the LaTeX fragment.
|
|
115
|
-
|
|
116
|
-
The format string should contain a single `%s' specifier, which will be replaced
|
|
117
|
-
with the LaTeX fragment's source code as a JavaScript raw string.
|
|
118
|
-
|
|
119
|
-
By default, the source code will be printed as-is."
|
|
120
|
-
:group 'org-export-svelte
|
|
121
|
-
:type 'string)
|
|
122
|
-
|
|
123
|
-
(defcustom org-svelte-src-block-format
|
|
124
|
-
"<pre><code class=\"language-%s\">{@html %s.replaceAll('<', '<').replaceAll('>', '>')}</code></pre>"
|
|
125
|
-
"Format string that will be used to generate the source block.
|
|
126
|
-
|
|
127
|
-
The format string should contain two `%s' specifiers. The first specifier will
|
|
128
|
-
be replaced with the language of the source block, and the second specifier will
|
|
129
|
-
be replaced with the source code of the source block as a JavaScript raw string.
|
|
130
|
-
|
|
131
|
-
By default, the source code will be encosed in a <code> tag with the language
|
|
132
|
-
class inside a <pre> tag."
|
|
133
|
-
:group 'org-export-svelte
|
|
134
|
-
:type 'string)
|
|
135
|
-
|
|
136
|
-
(org-export-define-derived-backend 'svelte 'html
|
|
137
|
-
:menu-entry '(?S "Export to Svelte"
|
|
138
|
-
((?S "As Svelte buffer"
|
|
139
|
-
(lambda (a s v _b)
|
|
140
|
-
(org-svelte-export-as-svelte a s v)))
|
|
141
|
-
(?s "As Svelte file"
|
|
142
|
-
(lambda (a s v _b)
|
|
143
|
-
(org-svelte-export-to-svelte a s v)))))
|
|
144
|
-
:translate-alist '((export-block . org-svelte-export-block)
|
|
145
|
-
(export-snippet . org-svelte-export-snippet)
|
|
146
|
-
(inner-template . org-svelte-inner-template)
|
|
147
|
-
(keyword . org-svelte-keyword)
|
|
148
|
-
(latex-environment . org-svelte-latex-environment)
|
|
149
|
-
(latex-fragment . org-svelte-latex-fragment)
|
|
150
|
-
(src-block . org-svelte-src-block)
|
|
151
|
-
(template . org-svelte-template))
|
|
152
|
-
:options-alist '( ; Overriding HTML options
|
|
153
|
-
(:html-doctype "HTML_DOCTYPE" nil "html5")
|
|
154
|
-
(:html-html5-fancy nil nil t)))
|
|
155
|
-
|
|
156
|
-
(defun org-svelte--convert-to-raw-string (string)
|
|
157
|
-
"Convert STRING to a JavaScript raw string.
|
|
158
|
-
|
|
159
|
-
This function converts the given string to a JavaScript raw template string.
|
|
160
|
-
The result of this function, therefore, can be inserted where a JavaScript
|
|
161
|
-
value is appropriate.
|
|
162
|
-
|
|
163
|
-
This function expects a standalone string that does not depend on any string
|
|
164
|
-
interpolation. Every instance of backticks and substitution markers will be
|
|
165
|
-
escaped accordingly.
|
|
166
|
-
|
|
167
|
-
For example, one could use this function to insert a string into a JavaScript:
|
|
168
|
-
(format \"const str = %s;\"
|
|
169
|
-
(org-svelte--convert-to-raw-string \"Hello, World!\")
|
|
170
|
-
|
|
171
|
-
Where the result would be:
|
|
172
|
-
const str = String.raw`Hello, World!`;"
|
|
173
|
-
(let* ((escaped-string (replace-regexp-in-string "`"
|
|
174
|
-
"\\`"
|
|
175
|
-
string))
|
|
176
|
-
(escaped-string (replace-regexp-in-string "\\${"
|
|
177
|
-
"\\\\${"
|
|
178
|
-
escaped-string)))
|
|
179
|
-
(format "String.raw`%s`" escaped-string)))
|
|
180
|
-
|
|
181
|
-
(defun org-svelte-export-block (export-block _contents _info)
|
|
182
|
-
"Transcode an EXPORT-BLOCK element from Org to Svelte.
|
|
183
|
-
CONTENTS is nil. INFO is a plist holding contextual information."
|
|
184
|
-
(when (or (string= (org-element-property :type export-block) "HTML")
|
|
185
|
-
(string= (org-element-property :type export-block) "SVELTE"))
|
|
186
|
-
(org-remove-indentation (org-element-property :value export-block))))
|
|
187
|
-
|
|
188
|
-
(defun org-svelte-export-snippet (export-snippet _contents _info)
|
|
189
|
-
"Transcode an EXPORT-SNIPPET element from Org to Svelte.
|
|
190
|
-
CONTENTS is nil. INFO is a plist holding contextual information."
|
|
191
|
-
(when (or (eq (org-export-snippet-backend export-snippet) 'svelte)
|
|
192
|
-
(eq (org-export-snippet-backend export-snippet) 'html))
|
|
193
|
-
(org-element-property :value export-snippet)))
|
|
194
|
-
|
|
195
|
-
(defun org-svelte-keyword (keyword _contents _info)
|
|
196
|
-
"Transcode a KEYWORD element from Org to Svelte.
|
|
197
|
-
CONTENTS is nil. INFO is a plist holding contextual information."
|
|
198
|
-
(when (or (string= (org-element-property :key keyword) "HTML")
|
|
199
|
-
(string= (org-element-property :key keyword) "SVELTE"))
|
|
200
|
-
(org-element-property :value keyword)))
|
|
201
|
-
|
|
202
|
-
(defun org-svelte-latex-environment (latex-environment _contents info)
|
|
203
|
-
"Transcode a LATEX-ENVIRONMENT element from Org to Svelte.
|
|
204
|
-
CONTENTS is nil. INFO is a plist holding contextual information."
|
|
205
|
-
(when (plist-get info :with-latex)
|
|
206
|
-
(let ((frag (org-remove-indentation
|
|
207
|
-
(org-element-property :value latex-environment)))
|
|
208
|
-
(label (org-html--reference latex-environment info t)))
|
|
209
|
-
(format org-svelte-latex-environment-format
|
|
210
|
-
(org-svelte--convert-to-raw-string
|
|
211
|
-
(if (org-string-nw-p label)
|
|
212
|
-
(replace-regexp-in-string "\\`.*"
|
|
213
|
-
(format "\\&\n\\\\label{%s}" label)
|
|
214
|
-
frag)
|
|
215
|
-
frag))))))
|
|
216
|
-
|
|
217
|
-
(defun org-svelte-latex-fragment (latex-fragment _contents info)
|
|
218
|
-
"Transcode a LATEX-FRAGMENT element from Org to Svelte.
|
|
219
|
-
CONTENTS is nil. INFO is a plist holding contextual information."
|
|
220
|
-
(when (plist-get info :with-latex)
|
|
221
|
-
(let ((frag (org-element-property :value latex-fragment)))
|
|
222
|
-
(cond
|
|
223
|
-
((string-match-p "^\\\\(" frag)
|
|
224
|
-
(format org-svelte-latex-fragment-format
|
|
225
|
-
(org-svelte--convert-to-raw-string (substring frag 2 -2))))
|
|
226
|
-
((string-match-p "^\\\\\\[" frag)
|
|
227
|
-
(format org-svelte-latex-environment-format
|
|
228
|
-
(org-svelte--convert-to-raw-string (substring frag 2 -2))))))))
|
|
229
|
-
|
|
230
|
-
(defun org-svelte-src-block (src-block _contents info)
|
|
231
|
-
"Transcode a SRC-BLOCK element from Org to Svelte.
|
|
232
|
-
CONTENTS is nil. INFO is a plist holding contextual information."
|
|
233
|
-
(let ((lang (org-element-property :language src-block))
|
|
234
|
-
(code (org-export-format-code-default src-block info)))
|
|
235
|
-
(format org-svelte-src-block-format
|
|
236
|
-
lang
|
|
237
|
-
(org-svelte--convert-to-raw-string code))))
|
|
238
|
-
|
|
239
|
-
(defun org-svelte--generate-imports (info)
|
|
240
|
-
"Generate import statements for components.
|
|
241
|
-
INFO is a plist holding contextual information."
|
|
242
|
-
(let ((imports (mapcar (lambda (component)
|
|
243
|
-
(format org-svelte--component-import-format
|
|
244
|
-
(car component)
|
|
245
|
-
(cdr component)))
|
|
246
|
-
org-svelte-component-import-alist)))
|
|
247
|
-
(string-join imports "\n")))
|
|
248
|
-
|
|
249
|
-
(defun org-svelte--generate-metadata-export (info)
|
|
250
|
-
"Return a JSON string containing the metadata of the current Org file.
|
|
251
|
-
INFO is a plist holding contextual information."
|
|
252
|
-
(let ((title (org-export-data (plist-get info :title) info))
|
|
253
|
-
(subtitle (org-export-data (plist-get info :subtitle) info))
|
|
254
|
-
(author (org-export-data (plist-get info :author) info))
|
|
255
|
-
(date (org-export-data (org-export-get-date info "%Y-%m-%d") info))
|
|
256
|
-
(description (plist-get info :description))
|
|
257
|
-
(keywords (plist-get info :keywords))
|
|
258
|
-
(language (plist-get info :language))
|
|
259
|
-
(creator (plist-get info :creator)))
|
|
260
|
-
(format org-svelte-metadata-format
|
|
261
|
-
(json-encode `((title . ,title)
|
|
262
|
-
(subtitle . ,subtitle)
|
|
263
|
-
(author . ,author)
|
|
264
|
-
(date . ,date)
|
|
265
|
-
(description . ,description)
|
|
266
|
-
(keywords . ,keywords)
|
|
267
|
-
(language . ,language)
|
|
268
|
-
(creator . ,creator))))))
|
|
269
|
-
|
|
270
|
-
(defun org-svelte--module-context-script (info)
|
|
271
|
-
"Generate the module-context script that imports assets and exports metadata.
|
|
272
|
-
INFO is a plist holding contextual information."
|
|
273
|
-
(let ((imports (org-svelte--generate-imports info))
|
|
274
|
-
(metadata (org-svelte--generate-metadata-export info)))
|
|
275
|
-
(format "<script context=\"module\">\n%s\n%s\n%s\n</script>\n"
|
|
276
|
-
imports
|
|
277
|
-
org-svelte-raw-script-content
|
|
278
|
-
metadata)))
|
|
279
|
-
|
|
280
|
-
(defun org-svelte-inner-template (contents _info)
|
|
281
|
-
"Return body of document after converting it to Svelte.
|
|
282
|
-
CONTENTS is the transcoded contents string. INFO is a plist holding export
|
|
283
|
-
options."
|
|
284
|
-
(let* ((contents (if (not org-svelte-id-attribute-type)
|
|
285
|
-
(replace-regexp-in-string
|
|
286
|
-
" id=\"[[:alpha:]-]*org[[:alnum:]]\\{7\\}\""
|
|
287
|
-
""
|
|
288
|
-
contents t)
|
|
289
|
-
contents)))
|
|
290
|
-
contents))
|
|
291
|
-
|
|
292
|
-
(defun org-svelte-template (contents info)
|
|
293
|
-
"Return complete document string after Svelte conversion.
|
|
294
|
-
CONTENTS is the transcoded contents string. INFO is a plist used as a
|
|
295
|
-
communication channel."
|
|
296
|
-
(concat (org-svelte--module-context-script info)
|
|
297
|
-
contents))
|
|
298
|
-
|
|
299
|
-
;;;###autoload
|
|
300
|
-
(defun org-svelte-export-as-svelte
|
|
301
|
-
(&optional async subtreep visible-only)
|
|
302
|
-
"Export current buffer to a Svelte component buffer.
|
|
303
|
-
|
|
304
|
-
If narrowing is active in the current buffer, only export its
|
|
305
|
-
narrowed part.
|
|
306
|
-
|
|
307
|
-
If a region is active, export that region.
|
|
308
|
-
|
|
309
|
-
A non-nil optional argument ASYNC means the process should happen
|
|
310
|
-
asynchronously. The resulting buffer should be accessible
|
|
311
|
-
through the `org-export-stack' interface.
|
|
312
|
-
|
|
313
|
-
When optional argument SUBTREEP is non-nil, export the sub-tree
|
|
314
|
-
at point, extracting information from the headline properties
|
|
315
|
-
first.
|
|
316
|
-
|
|
317
|
-
When optional argument VISIBLE-ONLY is non-nil, don't export
|
|
318
|
-
contents of hidden elements."
|
|
319
|
-
(interactive)
|
|
320
|
-
(org-export-to-buffer 'svelte "*Org Svelte Export*"
|
|
321
|
-
async subtreep visible-only nil nil
|
|
322
|
-
(lambda ()
|
|
323
|
-
(if (fboundp 'web-mode)
|
|
324
|
-
(web-mode)
|
|
325
|
-
(html-mode)))))
|
|
326
|
-
|
|
327
|
-
;;;###autoload
|
|
328
|
-
(defun org-svelte-export-to-svelte
|
|
329
|
-
(&optional async subtreep visible-only)
|
|
330
|
-
"Export current buffer to a Svelte component file.
|
|
331
|
-
|
|
332
|
-
If narrowing is active in the current buffer, only export its
|
|
333
|
-
narrowed part.
|
|
334
|
-
|
|
335
|
-
If a region is active, export that region.
|
|
336
|
-
|
|
337
|
-
A non-nil optional argument ASYNC means the process should happen
|
|
338
|
-
asynchronously. The resulting file should be accessible through
|
|
339
|
-
the `org-export-stack' interface.
|
|
340
|
-
|
|
341
|
-
When optional argument SUBTREEP is non-nil, export the sub-tree
|
|
342
|
-
at point, extracting information from the headline properties
|
|
343
|
-
first.
|
|
344
|
-
|
|
345
|
-
When optional argument VISIBLE-ONLY is non-nil, don't export
|
|
346
|
-
contents of hidden elements."
|
|
347
|
-
(interactive)
|
|
348
|
-
(org-export-to-file 'svelte (org-export-output-file-name ".svelte" subtreep)
|
|
349
|
-
async subtreep visible-only))
|
|
350
|
-
|
|
351
|
-
(provide 'ox-svelte)
|
|
352
|
-
|
|
353
|
-
;;; ox-svelte.el ends here
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "ox-svelte",
|
|
3
|
-
"version": "0.1.0",
|
|
4
|
-
"description": "Org-mode exporter backend for Svelte components (type definitions)",
|
|
5
|
-
"types": "index.d.ts",
|
|
6
|
-
"author": "RangHo Lee <hello@rangho.me>",
|
|
7
|
-
"license": "GPL-3.0-or-later",
|
|
8
|
-
"devDependencies": {
|
|
9
|
-
"svelte": "^4.2.12"
|
|
10
|
-
}
|
|
11
|
-
}
|
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
lockfileVersion: '6.0'
|
|
2
|
-
|
|
3
|
-
settings:
|
|
4
|
-
autoInstallPeers: true
|
|
5
|
-
excludeLinksFromLockfile: false
|
|
6
|
-
|
|
7
|
-
devDependencies:
|
|
8
|
-
svelte:
|
|
9
|
-
specifier: ^4.2.12
|
|
10
|
-
version: 4.2.12
|
|
11
|
-
|
|
12
|
-
packages:
|
|
13
|
-
|
|
14
|
-
/@ampproject/remapping@2.2.1:
|
|
15
|
-
resolution: {integrity: sha512-lFMjJTrFL3j7L9yBxwYfCq2k6qqwHyzuUl/XBnif78PWTJYyL/dfowQHWE3sp6U6ZzqWiiIZnpTMO96zhkjwtg==}
|
|
16
|
-
engines: {node: '>=6.0.0'}
|
|
17
|
-
dependencies:
|
|
18
|
-
'@jridgewell/gen-mapping': 0.3.4
|
|
19
|
-
'@jridgewell/trace-mapping': 0.3.23
|
|
20
|
-
dev: true
|
|
21
|
-
|
|
22
|
-
/@jridgewell/gen-mapping@0.3.4:
|
|
23
|
-
resolution: {integrity: sha512-Oud2QPM5dHviZNn4y/WhhYKSXksv+1xLEIsNrAbGcFzUN3ubqWRFT5gwPchNc5NuzILOU4tPBDTZ4VwhL8Y7cw==}
|
|
24
|
-
engines: {node: '>=6.0.0'}
|
|
25
|
-
dependencies:
|
|
26
|
-
'@jridgewell/set-array': 1.1.2
|
|
27
|
-
'@jridgewell/sourcemap-codec': 1.4.15
|
|
28
|
-
'@jridgewell/trace-mapping': 0.3.23
|
|
29
|
-
dev: true
|
|
30
|
-
|
|
31
|
-
/@jridgewell/resolve-uri@3.1.2:
|
|
32
|
-
resolution: {integrity: sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==}
|
|
33
|
-
engines: {node: '>=6.0.0'}
|
|
34
|
-
dev: true
|
|
35
|
-
|
|
36
|
-
/@jridgewell/set-array@1.1.2:
|
|
37
|
-
resolution: {integrity: sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==}
|
|
38
|
-
engines: {node: '>=6.0.0'}
|
|
39
|
-
dev: true
|
|
40
|
-
|
|
41
|
-
/@jridgewell/sourcemap-codec@1.4.15:
|
|
42
|
-
resolution: {integrity: sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==}
|
|
43
|
-
dev: true
|
|
44
|
-
|
|
45
|
-
/@jridgewell/trace-mapping@0.3.23:
|
|
46
|
-
resolution: {integrity: sha512-9/4foRoUKp8s96tSkh8DlAAc5A0Ty8vLXld+l9gjKKY6ckwI8G15f0hskGmuLZu78ZlGa1vtsfOa+lnB4vG6Jg==}
|
|
47
|
-
dependencies:
|
|
48
|
-
'@jridgewell/resolve-uri': 3.1.2
|
|
49
|
-
'@jridgewell/sourcemap-codec': 1.4.15
|
|
50
|
-
dev: true
|
|
51
|
-
|
|
52
|
-
/@types/estree@1.0.5:
|
|
53
|
-
resolution: {integrity: sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==}
|
|
54
|
-
dev: true
|
|
55
|
-
|
|
56
|
-
/acorn@8.11.3:
|
|
57
|
-
resolution: {integrity: sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==}
|
|
58
|
-
engines: {node: '>=0.4.0'}
|
|
59
|
-
hasBin: true
|
|
60
|
-
dev: true
|
|
61
|
-
|
|
62
|
-
/aria-query@5.3.0:
|
|
63
|
-
resolution: {integrity: sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A==}
|
|
64
|
-
dependencies:
|
|
65
|
-
dequal: 2.0.3
|
|
66
|
-
dev: true
|
|
67
|
-
|
|
68
|
-
/axobject-query@4.0.0:
|
|
69
|
-
resolution: {integrity: sha512-+60uv1hiVFhHZeO+Lz0RYzsVHy5Wr1ayX0mwda9KPDVLNJgZ1T9Ny7VmFbLDzxsH0D87I86vgj3gFrjTJUYznw==}
|
|
70
|
-
dependencies:
|
|
71
|
-
dequal: 2.0.3
|
|
72
|
-
dev: true
|
|
73
|
-
|
|
74
|
-
/code-red@1.0.4:
|
|
75
|
-
resolution: {integrity: sha512-7qJWqItLA8/VPVlKJlFXU+NBlo/qyfs39aJcuMT/2ere32ZqvF5OSxgdM5xOfJJ7O429gg2HM47y8v9P+9wrNw==}
|
|
76
|
-
dependencies:
|
|
77
|
-
'@jridgewell/sourcemap-codec': 1.4.15
|
|
78
|
-
'@types/estree': 1.0.5
|
|
79
|
-
acorn: 8.11.3
|
|
80
|
-
estree-walker: 3.0.3
|
|
81
|
-
periscopic: 3.1.0
|
|
82
|
-
dev: true
|
|
83
|
-
|
|
84
|
-
/css-tree@2.3.1:
|
|
85
|
-
resolution: {integrity: sha512-6Fv1DV/TYw//QF5IzQdqsNDjx/wc8TrMBZsqjL9eW01tWb7R7k/mq+/VXfJCl7SoD5emsJop9cOByJZfs8hYIw==}
|
|
86
|
-
engines: {node: ^10 || ^12.20.0 || ^14.13.0 || >=15.0.0}
|
|
87
|
-
dependencies:
|
|
88
|
-
mdn-data: 2.0.30
|
|
89
|
-
source-map-js: 1.0.2
|
|
90
|
-
dev: true
|
|
91
|
-
|
|
92
|
-
/dequal@2.0.3:
|
|
93
|
-
resolution: {integrity: sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==}
|
|
94
|
-
engines: {node: '>=6'}
|
|
95
|
-
dev: true
|
|
96
|
-
|
|
97
|
-
/estree-walker@3.0.3:
|
|
98
|
-
resolution: {integrity: sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==}
|
|
99
|
-
dependencies:
|
|
100
|
-
'@types/estree': 1.0.5
|
|
101
|
-
dev: true
|
|
102
|
-
|
|
103
|
-
/is-reference@3.0.2:
|
|
104
|
-
resolution: {integrity: sha512-v3rht/LgVcsdZa3O2Nqs+NMowLOxeOm7Ay9+/ARQ2F+qEoANRcqrjAZKGN0v8ymUetZGgkp26LTnGT7H0Qo9Pg==}
|
|
105
|
-
dependencies:
|
|
106
|
-
'@types/estree': 1.0.5
|
|
107
|
-
dev: true
|
|
108
|
-
|
|
109
|
-
/locate-character@3.0.0:
|
|
110
|
-
resolution: {integrity: sha512-SW13ws7BjaeJ6p7Q6CO2nchbYEc3X3J6WrmTTDto7yMPqVSZTUyY5Tjbid+Ab8gLnATtygYtiDIJGQRRn2ZOiA==}
|
|
111
|
-
dev: true
|
|
112
|
-
|
|
113
|
-
/magic-string@0.30.7:
|
|
114
|
-
resolution: {integrity: sha512-8vBuFF/I/+OSLRmdf2wwFCJCz+nSn0m6DPvGH1fS/KiQoSaR+sETbov0eIk9KhEKy8CYqIkIAnbohxT/4H0kuA==}
|
|
115
|
-
engines: {node: '>=12'}
|
|
116
|
-
dependencies:
|
|
117
|
-
'@jridgewell/sourcemap-codec': 1.4.15
|
|
118
|
-
dev: true
|
|
119
|
-
|
|
120
|
-
/mdn-data@2.0.30:
|
|
121
|
-
resolution: {integrity: sha512-GaqWWShW4kv/G9IEucWScBx9G1/vsFZZJUO+tD26M8J8z3Kw5RDQjaoZe03YAClgeS/SWPOcb4nkFBTEi5DUEA==}
|
|
122
|
-
dev: true
|
|
123
|
-
|
|
124
|
-
/periscopic@3.1.0:
|
|
125
|
-
resolution: {integrity: sha512-vKiQ8RRtkl9P+r/+oefh25C3fhybptkHKCZSPlcXiJux2tJF55GnEj3BVn4A5gKfq9NWWXXrxkHBwVPUfH0opw==}
|
|
126
|
-
dependencies:
|
|
127
|
-
'@types/estree': 1.0.5
|
|
128
|
-
estree-walker: 3.0.3
|
|
129
|
-
is-reference: 3.0.2
|
|
130
|
-
dev: true
|
|
131
|
-
|
|
132
|
-
/source-map-js@1.0.2:
|
|
133
|
-
resolution: {integrity: sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==}
|
|
134
|
-
engines: {node: '>=0.10.0'}
|
|
135
|
-
dev: true
|
|
136
|
-
|
|
137
|
-
/svelte@4.2.12:
|
|
138
|
-
resolution: {integrity: sha512-d8+wsh5TfPwqVzbm4/HCXC783/KPHV60NvwitJnyTA5lWn1elhXMNWhXGCJ7PwPa8qFUnyJNIyuIRt2mT0WMug==}
|
|
139
|
-
engines: {node: '>=16'}
|
|
140
|
-
dependencies:
|
|
141
|
-
'@ampproject/remapping': 2.2.1
|
|
142
|
-
'@jridgewell/sourcemap-codec': 1.4.15
|
|
143
|
-
'@jridgewell/trace-mapping': 0.3.23
|
|
144
|
-
'@types/estree': 1.0.5
|
|
145
|
-
acorn: 8.11.3
|
|
146
|
-
aria-query: 5.3.0
|
|
147
|
-
axobject-query: 4.0.0
|
|
148
|
-
code-red: 1.0.4
|
|
149
|
-
css-tree: 2.3.1
|
|
150
|
-
estree-walker: 3.0.3
|
|
151
|
-
is-reference: 3.0.2
|
|
152
|
-
locate-character: 3.0.0
|
|
153
|
-
magic-string: 0.30.7
|
|
154
|
-
periscopic: 3.1.0
|
|
155
|
-
dev: true
|
package/dist/sexp.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export type Sexp = Value | Cell;
|
|
2
|
-
export type Value = Atom | Quote | string | number | boolean | null;
|
|
3
|
-
export type Cell = {
|
|
4
|
-
car: Sexp;
|
|
5
|
-
cdr: Sexp;
|
|
6
|
-
};
|
|
7
|
-
export declare class Atom {
|
|
8
|
-
name: string;
|
|
9
|
-
constructor(name: string);
|
|
10
|
-
}
|
|
11
|
-
export declare class Quote {
|
|
12
|
-
sexp: Sexp;
|
|
13
|
-
constructor(sexp: Sexp);
|
|
14
|
-
}
|
|
15
|
-
export declare function cons(car: Sexp, cdr: Sexp): Cell;
|
|
16
|
-
export declare function list(...args: Sexp[]): Sexp;
|
|
17
|
-
export declare function stringify(sexp: Sexp): string;
|
package/eslint.config.js
DELETED
package/jest.config.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/** @type {import('ts-jest').JestConfigWithTsJest} */
|
|
2
|
-
const config = {
|
|
3
|
-
preset: "ts-jest/presets/default-esm",
|
|
4
|
-
moduleDirectories: ["node_modules", "src"],
|
|
5
|
-
moduleNameMapper: {
|
|
6
|
-
"^@/.*": "<rootDir>/src/$1",
|
|
7
|
-
"^(\\.{1,2}/.*)\\.js$": "$1",
|
|
8
|
-
},
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export default config;
|
package/prettier.config.js
DELETED
package/rollup.config.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import commonjs from "@rollup/plugin-commonjs";
|
|
2
|
-
import nodeResolve from "@rollup/plugin-node-resolve";
|
|
3
|
-
import terser from "@rollup/plugin-terser";
|
|
4
|
-
import typescript from "@rollup/plugin-typescript";
|
|
5
|
-
import copy from "rollup-plugin-copy";
|
|
6
|
-
|
|
7
|
-
export default {
|
|
8
|
-
input: "src/index.ts",
|
|
9
|
-
output: {
|
|
10
|
-
dir: "dist",
|
|
11
|
-
format: "es",
|
|
12
|
-
},
|
|
13
|
-
plugins: [
|
|
14
|
-
copy({
|
|
15
|
-
targets: [{ src: "src/lisp", dest: "dist" }],
|
|
16
|
-
}),
|
|
17
|
-
nodeResolve(),
|
|
18
|
-
commonjs(),
|
|
19
|
-
typescript(),
|
|
20
|
-
terser(),
|
|
21
|
-
],
|
|
22
|
-
};
|
package/src/emacs.ts
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { execSync } from "node:child_process";
|
|
2
|
-
import { join } from "node:path";
|
|
3
|
-
|
|
4
|
-
import { Atom, Quote, cons, list, stringify } from "./sexp.js";
|
|
5
|
-
|
|
6
|
-
export interface OxSvelteOptions {
|
|
7
|
-
latexEnvironmentFormat?: string;
|
|
8
|
-
latexFragmentFormat?: string;
|
|
9
|
-
srcBlockFormat?: string;
|
|
10
|
-
imports?: Record<string, string>;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export function convert(content: string, options?: OxSvelteOptions): string {
|
|
14
|
-
const {
|
|
15
|
-
latexEnvironmentFormat,
|
|
16
|
-
latexFragmentFormat,
|
|
17
|
-
srcBlockFormat,
|
|
18
|
-
imports,
|
|
19
|
-
} = options || {};
|
|
20
|
-
|
|
21
|
-
let command = `/usr/bin/env emacs --script ${join(
|
|
22
|
-
import.meta.dirname,
|
|
23
|
-
"lisp",
|
|
24
|
-
"convert.el",
|
|
25
|
-
)}`;
|
|
26
|
-
if (latexEnvironmentFormat) {
|
|
27
|
-
command += ` --latex-environment-format '${latexEnvironmentFormat.replaceAll(
|
|
28
|
-
"'",
|
|
29
|
-
"'\\''",
|
|
30
|
-
)}'`;
|
|
31
|
-
}
|
|
32
|
-
if (latexFragmentFormat) {
|
|
33
|
-
command += ` --latex-fragment-format '${latexFragmentFormat.replaceAll(
|
|
34
|
-
"'",
|
|
35
|
-
"'\\''",
|
|
36
|
-
)}'`;
|
|
37
|
-
}
|
|
38
|
-
if (srcBlockFormat) {
|
|
39
|
-
command += ` --src-block-format '${srcBlockFormat.replaceAll("'", "'\\''")}'`;
|
|
40
|
-
}
|
|
41
|
-
if (imports) {
|
|
42
|
-
const sexp = list(
|
|
43
|
-
new Atom("setq"),
|
|
44
|
-
new Atom("org-svelte-component-import-alist"),
|
|
45
|
-
new Quote(
|
|
46
|
-
list(...Object.entries(imports).map(([key, val]) => cons(key, val))),
|
|
47
|
-
),
|
|
48
|
-
);
|
|
49
|
-
command += ` --preface '${stringify(sexp).replaceAll("'", "'\\''")}'`;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const result = execSync(command, { input: content }).toString();
|
|
53
|
-
|
|
54
|
-
return result;
|
|
55
|
-
}
|