-
Notifications
You must be signed in to change notification settings - Fork 1
D40 add implicit figures for lexical #62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
81ef11f
feat: add a isMilkdown prop and activate implicit figures if not Milk…
lqvd 7d3e7bd
feat: test out whether figures are produced
lqvd 9e03a62
fix: correct ternary
lqvd edf7ff1
feat: test out whether figures are produced again
lqvd 0f010de
fix: set figure to stay in place in text
lqvd 58bc9f4
fix: revert fromString change
lqvd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -13,6 +13,7 @@ export const schema = z.array( | |
| fileName: z.string(), | ||
| typeOfFile: TypeOfFileSchema, | ||
| markdown: z.string(), | ||
| isMilkdown: z.boolean().optional(), | ||
| }) | ||
| ); | ||
|
|
||
|
|
@@ -55,11 +56,17 @@ export const handler = async function ( | |
| const generateFile = async ( | ||
| pandocArgs: string[], | ||
| destFilePath: string, | ||
| markdown: string | ||
| markdown: string, | ||
| isMilkdown: boolean = true | ||
| ) => { | ||
| // pandoc source format | ||
| // If Milkdown, disable the implicit_figures extension to remove all image captions | ||
| const fromString = isMilkdown ? "markdown-implicit_figures" : "markdown+implicit_figures"; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggest don't put the type in the name, because it is already typed. Make a more general name for this variable. |
||
| // const fromString = "markdown+implicit_figures"; | ||
|
|
||
| try { | ||
| await pdcTs.Execute({ | ||
| from: "markdown-implicit_figures", // pandoc source format (disabling the implicit_figures extension to remove all image captions) | ||
| from: fromString, | ||
| to: "latex", // pandoc output format | ||
| pandocArgs, | ||
| spawnOpts: { argv0: "+RTS -M512M -RTS" }, | ||
|
|
@@ -76,7 +83,7 @@ export const handler = async function ( | |
| } | ||
|
|
||
| const TeXoutput = await pdcTs.Execute({ | ||
| from: "markdown-implicit_figures", // pandoc source format (disabling the implicit_figures extension to remove all image captions) | ||
| from: fromString, | ||
| to: "latex", // pandoc output format | ||
| pandocArgs, | ||
| outputToFile: false, // Controls whether the output will be returned as a string or written to a file | ||
|
|
@@ -130,6 +137,7 @@ export const handler = async function ( | |
| let url = ""; | ||
| for (let eachRequestData of requestData) { | ||
| const markdown = eachRequestData.markdown; | ||
| const isMilkdown = eachRequestData.isMilkdown; | ||
|
|
||
| switch (eachRequestData.typeOfFile) { | ||
| case "PDF": | ||
|
|
@@ -138,7 +146,8 @@ export const handler = async function ( | |
| const generatePDFResult = await generateFile( | ||
| ["--pdf-engine=xelatex", `--template=./template.latex`], | ||
| localPathPDF, | ||
| markdown | ||
| markdown, | ||
| isMilkdown | ||
| ); | ||
|
|
||
| if (generatePDFResult?.statusCode) { | ||
|
|
@@ -154,7 +163,8 @@ export const handler = async function ( | |
| await generateFile( | ||
| [`--template=./template.latex`], | ||
| localPathTEX, | ||
| markdown | ||
| markdown, | ||
| isMilkdown | ||
| ); | ||
|
|
||
| const s3PathTEX = `${eachRequestData.userId}/${filenameTEX}`; | ||
|
|
||
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be better to generalise this to e.g.
implicitFigures: z.boolean().optional(),?Milkdown isn't fundamental here.