Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,48 @@ packages/
!packages/tex-to-docx-swift/Sources/TeXToDOCX/TeXPreambleParser.swift
!packages/tex-to-docx-swift/Tests/
!packages/tex-to-docx-swift/Tests/TeXToDOCXTests/
!packages/bib-apa-to-html-swift/
!packages/bib-apa-to-html-swift/Package.swift
!packages/bib-apa-to-html-swift/Sources/
!packages/bib-apa-to-html-swift/Sources/BibAPAToHTML/
!packages/bib-apa-to-html-swift/Sources/BibAPAToHTML/APACSS.swift
!packages/bib-apa-to-html-swift/Sources/BibAPAToHTML/BibToAPAHTMLFormatter.swift
!packages/bib-apa-to-html-swift/Sources/BibAPAToHTML/HTMLRenderer.swift
!packages/bib-apa-to-html-swift/Sources/BibAPAToHTML/Reexports.swift
!packages/bib-apa-to-html-swift/Tests/
!packages/bib-apa-to-html-swift/Tests/BibAPAToHTMLTests/
!packages/bib-apa-to-html-swift/Tests/BibAPAToHTMLTests/HTMLRendererTests.swift
!packages/bib-apa-to-json-swift/
!packages/bib-apa-to-json-swift/Package.swift
!packages/bib-apa-to-json-swift/Sources/
!packages/bib-apa-to-json-swift/Sources/BibAPAToJSON/
!packages/bib-apa-to-json-swift/Sources/BibAPAToJSON/BibToAPAJSONFormatter.swift
!packages/bib-apa-to-json-swift/Tests/
!packages/bib-apa-to-json-swift/Tests/BibAPAToJSONTests/
!packages/bib-apa-to-json-swift/Tests/BibAPAToJSONTests/JSONFormatterTests.swift
!packages/bib-apa-to-md-swift/
!packages/bib-apa-to-md-swift/Package.swift
!packages/bib-apa-to-md-swift/Sources/
!packages/bib-apa-to-md-swift/Sources/BibAPAToMD/
!packages/bib-apa-to-md-swift/Sources/BibAPAToMD/BibToAPAFormatter.swift
!packages/bib-apa-to-md-swift/Sources/BibAPAToMD/MarkdownRenderer.swift
!packages/bib-apa-to-md-swift/Tests/
!packages/bib-apa-to-md-swift/Tests/BibAPAToMDTests/
!packages/bib-apa-to-md-swift/Tests/BibAPAToMDTests/BibToAPAFormatterTests.swift
!packages/bib-apa-to-md-swift/Tests/BibAPAToMDTests/IntegrationTests.swift
!packages/bib-apa-swift/
!packages/bib-apa-swift/Package.swift
!packages/bib-apa-swift/Sources/
!packages/bib-apa-swift/Sources/BibAPA/
!packages/bib-apa-swift/Sources/BibAPA/APAReferenceRenderer.swift
!packages/bib-apa-swift/Sources/BibAPA/APAStyler.swift
!packages/bib-apa-swift/Sources/BibAPA/APAStylerHelpers.swift
!packages/bib-apa-swift/Sources/BibAPA/Models/
!packages/bib-apa-swift/Sources/BibAPA/Models/APAReference.swift
!packages/bib-apa-swift/Sources/BibAPA/Models/TextSegment.swift
!packages/bib-apa-swift/Tests/
!packages/bib-apa-swift/Tests/BibAPATests/
!packages/bib-apa-swift/Tests/BibAPATests/APAStylerTests.swift
mcp/

# Local test files (personal .note, .pptx, .docx etc.)
Expand Down
3 changes: 2 additions & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,8 @@ swift build
| `packages/markdown-swift` | https://github.com/PsychQuant/markdown-swift.git | Markdown 生成 |
| `packages/marker-swift` | https://github.com/PsychQuant/marker-swift.git | 圖片分類 |
| `packages/surya-swift` | (local only) | OCR 文字辨識 |
| `packages/pdf-to-latex-swift` | (local, in macdoc repo) | PDF → LaTeX pipeline |
| `packages/pdf-to-latex-swift` | https://github.com/PsychQuant/pdf-to-latex-swift.git | PDF → LaTeX pipeline (consumed via remote url dep since #79) |
| `packages/ocr-swift` | https://github.com/PsychQuant/ocr-swift.git | OCR pipeline (MLX + Ollama backends, PDFKit extractor; consumed via remote url dep since #79) |
| `mcp/che-word-mcp` | https://github.com/PsychQuant/che-word-mcp.git | Word MCP |
| `mcp/che-pdf-mcp` | https://github.com/PsychQuant/che-pdf-mcp.git | PDF MCP |
| `reference/pandoc` | https://github.com/jgm/pandoc.git | 參考用 |
Expand Down
18 changes: 18 additions & 0 deletions Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 3 additions & 10 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ let package = Package(
.package(url: "https://github.com/PsychQuant/common-converter-swift.git", from: "0.4.0"),
.package(url: "https://github.com/PsychQuant/word-to-md-swift.git", from: "0.5.1"),
.package(name: "MarkerWordConverter", path: "packages/marker-word-converter-swift"),
.package(name: "pdf-to-latex-swift", path: "packages/pdf-to-latex-swift"),
.package(url: "https://github.com/PsychQuant/pdf-to-latex-swift.git", from: "0.1.0"),
.package(name: "PDFToMD", path: "packages/pdf-to-md-swift"),
.package(name: "WordToHTML", path: "packages/word-to-html-swift"),
.package(name: "HTMLToWord", path: "packages/html-to-word-swift"),
Expand All @@ -28,7 +28,7 @@ let package = Package(
.package(url: "https://github.com/PsychQuant/note-to-html-swift.git", from: "0.1.0"),
.package(url: "https://github.com/PsychQuant/note-to-pdf-swift.git", from: "0.1.0"),
.package(url: "https://github.com/PsychQuant/word-builder-swift.git", from: "0.9.0"),
.package(name: "OCRSwift", path: "packages/ocr-swift"),
.package(url: "https://github.com/PsychQuant/ocr-swift.git", from: "0.1.0"),
],
targets: [
.executableTarget(
Expand All @@ -52,17 +52,10 @@ let package = Package(
.product(name: "TeXToDOCX", package: "TeXToDOCX"),
.product(name: "NoteToHTML", package: "note-to-html-swift"),
.product(name: "NoteToPDF", package: "note-to-pdf-swift"),
.product(name: "OCRCore", package: "OCRSwift"),
.product(name: "OCRCore", package: "ocr-swift"),
.product(name: "ArgumentParser", package: "swift-argument-parser"),
]
),
.testTarget(
name: "WordToMDTests",
dependencies: [
.product(name: "WordToMDSwift", package: "word-to-md-swift"),
],
resources: [.copy("Fixtures")]
),
.testTarget(
name: "MacDocCLITests",
dependencies: []
Expand Down
25 changes: 25 additions & 0 deletions packages/bib-apa-swift/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// swift-tools-version: 5.9
import PackageDescription

let package = Package(
name: "BibAPA",
platforms: [.macOS(.v14)],
products: [
.library(name: "BibAPA", targets: ["BibAPA"])
],
dependencies: [
.package(name: "BiblatexAPA", path: "../biblatex-apa-swift"),
],
targets: [
.target(
name: "BibAPA",
dependencies: ["BiblatexAPA"],
path: "Sources/BibAPA"
),
.testTarget(
name: "BibAPATests",
dependencies: ["BibAPA"],
path: "Tests/BibAPATests"
)
]
)
31 changes: 31 additions & 0 deletions packages/bib-apa-swift/Sources/BibAPA/APAReferenceRenderer.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// APAReferenceRenderer.swift — Protocol for rendering APAReference to output format

/// Renders an APAReference into a specific output format (Markdown, HTML, Astro props, etc.).
public protocol APAReferenceRenderer {
associatedtype Output

func render(_ reference: APAReference) -> Output

func renderArticle(_ ref: APAArticleRef) -> Output
func renderBook(_ ref: APABookRef) -> Output
func renderChapter(_ ref: APAChapterRef) -> Output
func renderThesis(_ ref: APAThesisRef) -> Output
func renderReport(_ ref: APAReportRef) -> Output
func renderPresentation(_ ref: APAPresentationRef) -> Output
func renderOnline(_ ref: APAOnlineRef) -> Output
}

// Default dispatch
extension APAReferenceRenderer {
public func render(_ reference: APAReference) -> Output {
switch reference {
case .article(let ref): return renderArticle(ref)
case .book(let ref): return renderBook(ref)
case .chapter(let ref): return renderChapter(ref)
case .thesis(let ref): return renderThesis(ref)
case .report(let ref): return renderReport(ref)
case .presentation(let ref): return renderPresentation(ref)
case .online(let ref): return renderOnline(ref)
}
}
}
Loading
Loading