svelte-preprocess-org 0.2.1 → 0.2.3

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/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{execSync as n}from"node:child_process";import{join as r}from"node:path";class t{name;constructor(n){this.name=n}}class e{sexp;constructor(n){this.sexp=n}}function o(n){return n instanceof Object&&"car"in n&&"cdr"in n}function i(n){return null===n}function c(n,r){return{car:n,cdr:r}}function s(...n){if(0===n.length)return null;const[r,...t]=n;return c(r,s(...t))}function u(n){if(o(n))return`(${a(n)})`;if(i(n))return"nil";if("string"==typeof n)return`"${n}"`;if(function(n){return"number"==typeof n}(n))return n.toString();if(function(n){return"boolean"==typeof n}(n))return n?"t":"nil";if(n instanceof t)return n.name;if(n instanceof e)return`'${u(n.sexp)}`;throw new TypeError("Unknown type of S-expression: "+typeof n)}function a(n){let r="";if(o(n.car)?r+=`(${a(n.car)})`:r+=u(n.car),o(n.cdr))r+=` ${a(n.cdr)}`;else{if(i(n.cdr))return r;r+=` . ${u(n.cdr)}`}return r}function f(o){const{extensions:i=[".org"],...a}=o||{};return{markup({content:o,filename:f}){if(f&&!i.some((n=>f.endsWith(n))))return{code:o};const l=function(o,i){const{latexEnvironmentFormat:a,latexFragmentFormat:f,srcBlockFormat:l,imports:m}=i||{};let p=`/usr/bin/env emacs --script ${r(import.meta.dirname,"lisp","convert.el")}`;a&&(p+=` --latex-environment-format ${a}`),f&&(p+=` --latex-fragment-format ${f}`),l&&(p+=` --src-block-format ${l}`),m&&(p+=` --preface '${u(s(new t("setq"),new t("org-svelte-component-import-alist"),new e(s(...Object.entries(m).map((([n,r])=>c(n,r))))))).replaceAll("'","'\\''")}'`);return n(p,{input:o}).toString()}(o,a);return{code:l}}}}export{f as default,f as orgPreprocess};
1
+ import{execSync as n}from"node:child_process";import{join as r}from"node:path";class e{name;constructor(n){this.name=n}}class t{sexp;constructor(n){this.sexp=n}}function o(n){return n instanceof Object&&"car"in n&&"cdr"in n}function c(n){return null===n}function i(n,r){return{car:n,cdr:r}}function a(...n){if(0===n.length)return null;const[r,...e]=n;return i(r,a(...e))}function s(n){if(o(n))return`(${u(n)})`;if(c(n))return"nil";if("string"==typeof n)return`"${n}"`;if(function(n){return"number"==typeof n}(n))return n.toString();if(function(n){return"boolean"==typeof n}(n))return n?"t":"nil";if(n instanceof e)return n.name;if(n instanceof t)return`'${s(n.sexp)}`;throw new TypeError("Unknown type of S-expression: "+typeof n)}function u(n){let r="";if(o(n.car)?r+=`(${u(n.car)})`:r+=s(n.car),o(n.cdr))r+=` ${u(n.cdr)}`;else{if(c(n.cdr))return r;r+=` . ${s(n.cdr)}`}return r}function f(o){const{extensions:c=[".org"],...u}=o||{};return{markup({content:o,filename:f}){if(f&&!c.some((n=>f.endsWith(n))))return{code:o};const l=function(o,c){const{latexEnvironmentFormat:u,latexFragmentFormat:f,srcBlockFormat:l,imports:m}=c||{};let p=`/usr/bin/env emacs --script ${r(import.meta.dirname,"lisp","convert.el")}`;u&&(p+=` --latex-environment-format '${u.replaceAll("'","'\\''")}'`),f&&(p+=` --latex-fragment-format '${f.replaceAll("'","'\\''")}'`),l&&(p+=` --src-block-format '${l.replaceAll("'","'\\''")}'`),m&&(p+=` --preface '${s(a(new e("setq"),new e("org-svelte-component-import-alist"),new t(a(...Object.entries(m).map((([n,r])=>i(n,r))))))).replaceAll("'","'\\''")}'`);return n(p,{input:o}).toString()}(o,u);return{code:l}}}}export{f as default,f as orgPreprocess};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "svelte-preprocess-org",
3
3
  "type": "module",
4
- "version": "0.2.1",
4
+ "version": "0.2.3",
5
5
  "description": "Svelte preprocessor for Org-mode",
6
6
  "author": "RangHo Lee <hello@rangho.me>",
7
7
  "homepage": "https://github.com/RangHo/svelte-preprocess-org",
package/src/emacs.ts CHANGED
@@ -24,13 +24,19 @@ export function convert(content: string, options?: OxSvelteOptions): string {
24
24
  "convert.el",
25
25
  )}`;
26
26
  if (latexEnvironmentFormat) {
27
- command += ` --latex-environment-format ${latexEnvironmentFormat}`;
27
+ command += ` --latex-environment-format '${latexEnvironmentFormat.replaceAll(
28
+ "'",
29
+ "'\\''",
30
+ )}'`;
28
31
  }
29
32
  if (latexFragmentFormat) {
30
- command += ` --latex-fragment-format ${latexFragmentFormat}`;
33
+ command += ` --latex-fragment-format '${latexFragmentFormat.replaceAll(
34
+ "'",
35
+ "'\\''",
36
+ )}'`;
31
37
  }
32
38
  if (srcBlockFormat) {
33
- command += ` --src-block-format ${srcBlockFormat}`;
39
+ command += ` --src-block-format '${srcBlockFormat.replaceAll("'", "'\\''")}'`;
34
40
  }
35
41
  if (imports) {
36
42
  const sexp = list(