Skip to content

Commit b565ec0

Browse files
build: align word-to-html with doc-converter-swift Refs #21 #12
Co-Authored-By: kiki830621 <kiki830621@gmail.com>
1 parent e3ac0f3 commit b565ec0

6 files changed

Lines changed: 21 additions & 23 deletions

File tree

Package.swift

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ let package = Package(
99
],
1010
dependencies: [
1111
.package(url: "https://github.com/apple/swift-argument-parser", from: "1.3.0"),
12-
.package(url: "https://github.com/PsychQuant/doc-converter-swift.git", from: "0.3.0"),
13-
.package(name: "CommonConverterSwift", path: "packages/common-converter-swift"),
12+
.package(url: "https://github.com/PsychQuant/doc-converter-swift.git", from: "0.4.0"),
1413
.package(url: "https://github.com/PsychQuant/word-to-md-swift.git", from: "0.1.0"),
1514
.package(url: "https://github.com/PsychQuant/ooxml-swift.git", from: "0.5.0"),
1615
.package(url: "https://github.com/PsychQuant/markdown-swift.git", from: "0.1.0"),
@@ -28,7 +27,7 @@ let package = Package(
2827
.target(
2928
name: "MarkerWordConverter",
3029
dependencies: [
31-
.product(name: "CommonConverterSwift", package: "CommonConverterSwift"),
30+
.product(name: "CommonConverterSwift", package: "doc-converter-swift"),
3231
.product(name: "OOXMLSwift", package: "ooxml-swift"),
3332
.product(name: "MarkdownSwift", package: "markdown-swift"),
3433
.product(name: "MarkerSwift", package: "marker-swift"),
@@ -37,8 +36,7 @@ let package = Package(
3736
.executableTarget(
3837
name: "MacDocCLI",
3938
dependencies: [
40-
.product(name: "CommonConverterSwift", package: "CommonConverterSwift"),
41-
.product(name: "DocConverterSwift", package: "doc-converter-swift"),
39+
.product(name: "CommonConverterSwift", package: "doc-converter-swift"),
4240
.product(name: "WordToMDSwift", package: "word-to-md-swift"),
4341
.product(name: "HTMLToMDSwift", package: "HTMLToMDSwift"),
4442
.product(name: "MDToHTMLSwift", package: "MDToHTMLSwift"),

Sources/MacDocCLI/MacDoc+WordHTML.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import ArgumentParser
22
import Foundation
3-
import DocConverterSwift
3+
import CommonConverterSwift
44
import WordToHTMLSwift
55

66
// MARK: - word-to-html

packages/word-to-html-swift/Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ let package = Package(
88
.library(name: "WordToHTMLSwift", targets: ["WordToHTMLSwift"]),
99
],
1010
dependencies: [
11-
.package(url: "https://github.com/PsychQuant/doc-converter-swift.git", from: "0.3.0"),
11+
.package(url: "https://github.com/PsychQuant/doc-converter-swift.git", from: "0.4.0"),
1212
.package(url: "https://github.com/PsychQuant/ooxml-swift.git", from: "0.5.3"),
1313
],
1414
targets: [
1515
.target(
1616
name: "WordToHTMLSwift",
1717
dependencies: [
18-
.product(name: "DocConverterSwift", package: "doc-converter-swift"),
18+
.product(name: "CommonConverterSwift", package: "doc-converter-swift"),
1919
.product(name: "OOXMLSwift", package: "ooxml-swift"),
2020
]
2121
),

packages/word-to-html-swift/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Direct Word (.docx) → HTML converter for macdoc.
1313
## Usage
1414

1515
```swift
16-
import DocConverterSwift
16+
import CommonConverterSwift
1717
import WordToHTMLSwift
1818

1919
let converter = WordHTMLConverter()

packages/word-to-html-swift/Sources/WordToHTMLSwift/WordHTMLConverter.swift

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import Foundation
2-
import DocConverterSwift
2+
import CommonConverterSwift
33
import OOXMLSwift
44

55
public struct WordHTMLConverter: DocumentConverter {
66
public static let sourceFormat = "docx"
77

88
public init() {}
99

10-
public func convert<W: DocConverterSwift.StreamingOutput>(
10+
public func convert<W: StreamingOutput>(
1111
input: URL,
1212
output: inout W,
1313
options: ConversionOptions
@@ -16,7 +16,7 @@ public struct WordHTMLConverter: DocumentConverter {
1616
try convert(document: document, source: input, output: &output, options: options)
1717
}
1818

19-
public func convert<W: DocConverterSwift.StreamingOutput>(
19+
public func convert<W: StreamingOutput>(
2020
document: WordDocument,
2121
output: inout W,
2222
options: ConversionOptions = .default
@@ -28,12 +28,12 @@ public struct WordHTMLConverter: DocumentConverter {
2828
document: WordDocument,
2929
options: ConversionOptions = .default
3030
) throws -> String {
31-
var writer = DocConverterSwift.StringOutput()
31+
var writer = StringOutput()
3232
try convert(document: document, output: &writer, options: options)
3333
return writer.content
3434
}
3535

36-
private func convert<W: DocConverterSwift.StreamingOutput>(
36+
private func convert<W: StreamingOutput>(
3737
document: WordDocument,
3838
source: URL?,
3939
output: inout W,
@@ -73,7 +73,7 @@ public struct WordHTMLConverter: DocumentConverter {
7373

7474
// MARK: - Document Shell
7575

76-
private func emitFrontmatter<W: DocConverterSwift.StreamingOutput>(
76+
private func emitFrontmatter<W: StreamingOutput>(
7777
document: WordDocument,
7878
source: URL?,
7979
title: String,
@@ -91,7 +91,7 @@ public struct WordHTMLConverter: DocumentConverter {
9191
try output.writeLine("-->")
9292
}
9393

94-
private func emitDocumentStart<W: DocConverterSwift.StreamingOutput>(
94+
private func emitDocumentStart<W: StreamingOutput>(
9595
title: String,
9696
output: inout W
9797
) throws {
@@ -112,15 +112,15 @@ public struct WordHTMLConverter: DocumentConverter {
112112
try output.writeLine(" <main class=\"document\">")
113113
}
114114

115-
private func emitDocumentEnd<W: DocConverterSwift.StreamingOutput>(output: inout W) throws {
115+
private func emitDocumentEnd<W: StreamingOutput>(output: inout W) throws {
116116
try output.writeLine(" </main>")
117117
try output.writeLine("</body>")
118118
try output.writeLine("</html>")
119119
}
120120

121121
// MARK: - Blocks
122122

123-
private func emitParagraph<W: DocConverterSwift.StreamingOutput>(
123+
private func emitParagraph<W: StreamingOutput>(
124124
_ paragraph: Paragraph,
125125
context: inout ConversionContext,
126126
output: inout W
@@ -159,7 +159,7 @@ public struct WordHTMLConverter: DocumentConverter {
159159
try output.writeLine(" <p>\(html)</p>")
160160
}
161161

162-
private func emitTable<W: DocConverterSwift.StreamingOutput>(
162+
private func emitTable<W: StreamingOutput>(
163163
_ table: Table,
164164
context: inout ConversionContext,
165165
output: inout W
@@ -249,7 +249,7 @@ public struct WordHTMLConverter: DocumentConverter {
249249
}
250250
}
251251

252-
private func emitListBlock<W: DocConverterSwift.StreamingOutput>(
252+
private func emitListBlock<W: StreamingOutput>(
253253
_ items: [FlatListItem],
254254
output: inout W
255255
) throws {
@@ -260,7 +260,7 @@ public struct WordHTMLConverter: DocumentConverter {
260260
}
261261
}
262262

263-
private func renderList<W: DocConverterSwift.StreamingOutput>(
263+
private func renderList<W: StreamingOutput>(
264264
items: [FlatListItem],
265265
index: inout Int,
266266
level: Int,
@@ -423,7 +423,7 @@ public struct WordHTMLConverter: DocumentConverter {
423423

424424
// MARK: - Footnotes
425425

426-
private func emitFootnotes<W: DocConverterSwift.StreamingOutput>(
426+
private func emitFootnotes<W: StreamingOutput>(
427427
context: ConversionContext,
428428
output: inout W
429429
) throws {

packages/word-to-html-swift/Tests/WordToHTMLSwiftTests/WordHTMLConverterTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import Foundation
2-
import DocConverterSwift
2+
import CommonConverterSwift
33
import OOXMLSwift
44
@testable import WordToHTMLSwift
55

0 commit comments

Comments
 (0)