feat: change to xelatex
This commit is contained in:
parent
10d20a8786
commit
fae2ba9c54
5 changed files with 16 additions and 9 deletions
|
|
@ -34,6 +34,7 @@ LABEL repo="https://github.com/C4illin/ConvertX"
|
||||||
RUN apk --no-cache add \
|
RUN apk --no-cache add \
|
||||||
pandoc \
|
pandoc \
|
||||||
texlive \
|
texlive \
|
||||||
|
texlive-xetex \
|
||||||
texmf-dist-latexextra \
|
texmf-dist-latexextra \
|
||||||
ffmpeg \
|
ffmpeg \
|
||||||
graphicsmagick \
|
graphicsmagick \
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ A self-hosted online file converter. Supports 831 different formats. Written wit
|
||||||
|------------------------------------------------------------------------------|---------------|---------------|-------------|
|
|------------------------------------------------------------------------------|---------------|---------------|-------------|
|
||||||
| [libjxl](https://github.com/libjxl/libjxl) | JPEG XL | 11 | 11 |
|
| [libjxl](https://github.com/libjxl/libjxl) | JPEG XL | 11 | 11 |
|
||||||
| [Vips](https://github.com/libvips/libvips) | Images | 45 | 23 |
|
| [Vips](https://github.com/libvips/libvips) | Images | 45 | 23 |
|
||||||
| [PDFLaTeX](https://www.math.rug.nl/~trentelman/jacob/pdflatex/pdflatex.html) | Documents | 1 | 1 |
|
| [XeLaTeX](https://tug.org/xetex/) | Documents | 1 | 1 |
|
||||||
| [Pandoc](https://pandoc.org/) | Documents | 43 | 65 |
|
| [Pandoc](https://pandoc.org/) | Documents | 43 | 65 |
|
||||||
| [GraphicsMagick](http://www.graphicsmagick.org/) | Images | 166 | 133 |
|
| [GraphicsMagick](http://www.graphicsmagick.org/) | Images | 166 | 133 |
|
||||||
| [FFmpeg](https://ffmpeg.org/) | Video | ~473 | ~280 |
|
| [FFmpeg](https://ffmpeg.org/) | Video | ~473 | ~280 |
|
||||||
|
|
|
||||||
|
|
@ -16,9 +16,9 @@ import {
|
||||||
} from "./graphicsmagick";
|
} from "./graphicsmagick";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
convert as convertPdflatex,
|
convert as convertxelatex,
|
||||||
properties as propertiesPdflatex,
|
properties as propertiesxelatex,
|
||||||
} from "./pdflatex";
|
} from "./xelatex";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
convert as convertLibjxl,
|
convert as convertLibjxl,
|
||||||
|
|
@ -63,9 +63,9 @@ const properties: {
|
||||||
properties: propertiesImage,
|
properties: propertiesImage,
|
||||||
converter: convertImage,
|
converter: convertImage,
|
||||||
},
|
},
|
||||||
pdflatex: {
|
xelatex: {
|
||||||
properties: propertiesPdflatex,
|
properties: propertiesxelatex,
|
||||||
converter: convertPdflatex,
|
converter: convertxelatex,
|
||||||
},
|
},
|
||||||
pandoc: {
|
pandoc: {
|
||||||
properties: propertiesPandoc,
|
properties: propertiesPandoc,
|
||||||
|
|
|
||||||
|
|
@ -127,9 +127,15 @@ export function convert(
|
||||||
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
||||||
options?: any,
|
options?: any,
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
|
// set xelatex here
|
||||||
|
const xelatex = ["pdf", "latex"];
|
||||||
|
let option = "";
|
||||||
|
if (xelatex.includes(convertTo)) {
|
||||||
|
option = "--pdf-engine=xelatex";
|
||||||
|
}
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
exec(
|
exec(
|
||||||
`pandoc "${filePath}" -f ${fileType} -t ${convertTo} -o "${targetPath}"`,
|
`pandoc ${option} "${filePath}" -f ${fileType} -t ${convertTo} -o "${targetPath}"`,
|
||||||
(error, stdout, stderr) => {
|
(error, stdout, stderr) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
reject(`error: ${error}`);
|
reject(`error: ${error}`);
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ export function convert(
|
||||||
.join("/")
|
.join("/")
|
||||||
.replace("./", "");
|
.replace("./", "");
|
||||||
exec(
|
exec(
|
||||||
`pdflatex -interaction=nonstopmode -output-directory="${outputPath}" "${filePath}"`,
|
`latexmk -xelatex -interaction=nonstopmode -output-directory="${outputPath}" "${filePath}"`,
|
||||||
(error, stdout, stderr) => {
|
(error, stdout, stderr) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
reject(`error: ${error}`);
|
reject(`error: ${error}`);
|
||||||
Loading…
Add table
Add a link
Reference in a new issue