-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add glossary * working changes * Remove useless comment * Add initial changes to build glossaries (not complete as we need to connect the export system to the rest of the application and instruct in the options when the make of glossaries is necessary) * Add build for glossaries. Build command works and glossary is present in the final PDF, but there are still some errors raised * Do not raise error when glossary node is encountered * Do not build glossaries while extracting parts. This commit makes the change 'complete'. The code is not perfect though and needs a couple improvements * Apply feedback from review and remove TEX rendering from jtex to myst-to-tex * Fix linting issues * Remove wrong comment * Fix empty glossary preamble case, a string+undefined results in 'undefined' being appended * Redirect output to logfile when running makeglossaries command * Better empty object check * Fix typo * Bette newline handling * Simplify logic around term and definition text extraction * Fix extra space in output * Fix additional undesired newline when rendering glossary terms without referecnes * Add tests for glossaries * Add changeset * Add test for parts * Fix lint format * Fix failing tests in myst-cli * Fix linting issues
- Loading branch information
1 parent
392ba77
commit 9965925
Showing
18 changed files
with
925 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
'myst-common': patch | ||
'myst-to-tex': patch | ||
'myst-cli': patch | ||
'jtex': patch | ||
--- | ||
|
||
Added support for glossaries and TEX/PDF export. Now it is possible to render glossaries in TeX and PDF documents. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,27 @@ | ||
import path from 'node:path'; | ||
import type MystTemplate from 'myst-templates'; | ||
|
||
export function pdfExportCommand(texFile: string, logFile: string, template?: MystTemplate) { | ||
export function pdfExportCommand( | ||
texFile: string, | ||
logFile: string, | ||
template?: MystTemplate, | ||
): string { | ||
const templateYml = template?.getValidatedTemplateYml(); | ||
const engine = templateYml?.build?.engine ?? '-xelatex'; | ||
if (process.platform === 'win32') { | ||
return `latexmk -f ${engine} -synctex=1 -interaction=batchmode -file-line-error -latexoption="-shell-escape" ${texFile} 1> ${logFile} 2>&1`; | ||
} else { | ||
return `latexmk -f ${engine} -synctex=1 -interaction=batchmode -file-line-error -latexoption="-shell-escape" ${texFile} &> ${logFile}`; | ||
} | ||
const baseCommand = `latexmk -f ${engine} -synctex=1 -interaction=batchmode -file-line-error -latexoption="-shell-escape" ${texFile}`; | ||
|
||
return createCommand(baseCommand, logFile); | ||
} | ||
|
||
export function texMakeGlossariesCommand(texFile: string, logFile: string): string { | ||
const fileNameNoExt = path.basename(texFile, '.tex'); | ||
const baseCommand = `makeglossaries ${fileNameNoExt}`; | ||
|
||
return createCommand(baseCommand, logFile); | ||
} | ||
|
||
function createCommand(baseCommand: string, logFile: string): string { | ||
return process.platform === 'win32' | ||
? `${baseCommand} 1> ${logFile} 2>&1` | ||
: `${baseCommand} &> ${logFile}`; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.