Skip to content

Commit

Permalink
fix: make citations work
Browse files Browse the repository at this point in the history
  • Loading branch information
tefkah committed Jul 18, 2023
1 parent 25f889e commit 67993d3
Show file tree
Hide file tree
Showing 14 changed files with 135 additions and 103 deletions.
1 change: 1 addition & 0 deletions apps/converter-frontend/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"root": "apps/converter-frontend",
"outputPath": "dist/apps/converter-frontend"
},
"dependsOn": ["^build"],
"configurations": {
"production": {},
"development": {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,33 @@ export const citation: Handle = (h: H, citationNode: T, parent?: Parent) => {
const actualSuffix =
maybeSuffix && maybeSuffix !== citationWithoutParens ? maybeSuffix : undefined

const mappedCitations = citations.flatMap(
({ citeKey, prefix, suffix: literalSuffix, label, locator }) => {
const suffix = literalSuffix ?? `${label ? `${label} ` : ''}${locator ?? ''}`
return [
...(prefix ? [arg(prefix.trim(), { braces: '[]' })] : []),
...(suffix
? [arg(suffix.trim(), { braces: '[]' })]
: prefix
? [arg('', { braces: '[]' })]
: []),
arg(citeKey),
]
},
)

const args: Argument[] = [
...(actualPrefix ? [arg(actualPrefix, { braces: '[]' })] : []),
...(actualSuffix ? [arg(actualSuffix, { braces: '[]' })] : []),
arg(citations.join(', ')),
...mappedCitations,
]
console.log({
args,
formattedCitation,
citations,
})

return m(formattedCitation.startsWith('(') ? 'textcite' : 'parencite', args)
return m(formattedCitation.startsWith('(') ? 'parencites' : 'textcites', args)
}
}
// Endnote/Citavi citation
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { Document, P, Root } from 'ooxast'
import { Macro } from '@unified-latex/unified-latex-types'
import { p } from './handlers/p.js'
import { P, Root } from 'ooxast'
import { toUnifiedLatex } from './ooxast-util-to-unified-latex.js'
import { toString } from '@unified-latex/unified-latex-util-to-string'
import { m } from '@unified-latex/unified-latex-builder'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import { DocxVFileData } from 'docx-to-vfile'
import { escapeLatex } from './util/escape.js'
import { listMatcher, listStyleHandler } from './handlers/paragraph/list.js'
import { defaultFormattingHandlers } from './handlers/defaultFormattingHandlers.js'
import { x } from 'xastscript'

export { one } from './one.js'
export { all } from './all.js'
Expand Down
76 changes: 0 additions & 76 deletions libs/rejour/rejour-relatex/src/lib/bak.ts

This file was deleted.

1 change: 1 addition & 0 deletions libs/reoff/reoff-markup-to-style/.github/funding.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: tefkah
3 changes: 0 additions & 3 deletions libs/reoff/reoff-markup-to-style/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@
"import": "./index.js"
}
},
"dependencies": {
"xast-util-select": "latest"
},
"main": "./index.js",
"module": "./index.js",
"types": "./index.d.ts",
Expand Down
6 changes: 4 additions & 2 deletions libs/reoff/reoff-markup-to-style/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
"projectType": "library",
"targets": {
"build": {
"executor": "better-nx-tsc:tsc",
// "executor": "better-nx-tsc:tsc",
"executor": "@nrwl/js:tsc",
"outputs": ["{options.outputPath}"],
"options": {
"rootDir": "libs/reoff/reoff-markup-to-style/src",
"outputPath": "dist/libs/reoff/reoff-markup-to-style/",
"outputPath": "dist/libs/reoff/reoff-markup-to-style",
"tsConfig": "libs/reoff/reoff-markup-to-style/tsconfig.lib.json",
"packageJson": "libs/reoff/reoff-markup-to-style/package.json",
"main": "libs/reoff/reoff-markup-to-style/src/index.ts",
"assets": ["libs/reoff/reoff-markup-to-style/*.md"],
"updateBuildableProjectDepsInPackageJson": true,
Expand Down
Empty file.
2 changes: 1 addition & 1 deletion libs/reoff/reoff-markup-to-style/tsconfig.lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
"types": ["node"]
},
"exclude": ["**/*.spec.ts", "**/*.test.ts", "jest.config.ts", "vite.config.ts"],
"include": ["**/*.ts"]
"include": ["src/**/*.ts"]
}
1 change: 1 addition & 0 deletions libs/xast/xast-util-is-element/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"main": "libs/xast/xast-util-is-element/src/index.ts",
"assets": ["libs/xast/xast-util-is-element/*.md"],
"updateBuildableProjectDepsInPackageJson": true,
"buildableProjectDepsInPackageJsonType": "dependencies",
"clean": true
},
"dependsOn": [
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@
"@testing-library/react": "14.0.0",
"@trumbitta/nx-plugin-unused-deps": "^1.12.1",
"@types/express": "4.17.14",
"@types/fs-extra": "^11.0.1",
"@types/jest": "29.5.0",
"@types/moo": "^0.5.5",
"@types/nearley": "^2.11.2",
Expand All @@ -225,6 +226,7 @@
"@vercel/remote-nx": "^1.0.1",
"@vitest/coverage-c8": "~0.29.8",
"@vitest/ui": "^0.29.8",
"@vscode/ripgrep": "^1.15.5",
"autoprefixer": "10.4.13",
"babel-jest": "29.4.3",
"commander": "^9.0.0",
Expand All @@ -244,6 +246,7 @@
"eslint-plugin-regexp": "^1.13.0",
"eslint-plugin-svelte3": "^3.1.2",
"eslint-plugin-unicorn": "^41.0.0",
"fs-extra": "^11.1.1",
"husky": "^8.0.0",
"jest": "29.4.3",
"jest-environment-jsdom": "29.4.3",
Expand Down
Loading

0 comments on commit 67993d3

Please sign in to comment.