Skip to content

Commit

Permalink
adding starter version
Browse files Browse the repository at this point in the history
  • Loading branch information
leogdion committed Aug 5, 2023
1 parent efbca68 commit af40df2
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions Sources/ContributeWordPress/MarkdownProcessor+Starter.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import Contribute
import Foundation
import SyndiKit
import Yams

#if canImport(FoundationNetworking)
import FoundationNetworking
#endif

extension MarkdownProcessor where ContentURLGeneratorType == SectionContentURLGenerator,
MarkdownContentBuilderType == MarkdownContentYAMLBuilder<
Source,
FilteredHTMLMarkdownExtractor<Source>,
FrontMatterYAMLExporter<Source, SpecFrontMatterTranslator>
> {
public static func begin(
importFrom exportsDirectoryURL: URL,
to rootPublishSiteURL: URL,
usingGenerator markdownGenerator: MarkdownGenerator,
filteringPostsWith postFilters: [PostFilter] = .default,
redirectsFormattedUsing redirectFromatter: RedirectFormatter? = nil,
importAssetsBy assetImportSetting: AssetImportSetting = .download,
overwriteAssets: Bool = false
) throws {
let settings = Settings(
rootPublishSiteURL: rootPublishSiteURL,
exportsDirectoryURL: exportsDirectoryURL,
markdownGenerator: markdownGenerator,
assetImportSetting: assetImportSetting,
overwriteAssets: overwriteAssets
)
let processor = MarkdownProcessor(
postFilters: postFilters,
redirectFromatter: redirectFromatter
)
try processor.begin(withSettings: settings)
}

Check warning on line 37 in Sources/ContributeWordPress/MarkdownProcessor+Starter.swift

View check run for this annotation

Codecov / codecov/patch

Sources/ContributeWordPress/MarkdownProcessor+Starter.swift#L24-L37

Added lines #L24 - L37 were not covered by tests

public static func begin(
importFrom exportsDirectoryURL: URL,
to rootPublishSiteURL: URL,
filteringPostsWith postFilters: [PostFilter] = .default,
redirectsFormattedUsing redirectFromatter: RedirectFormatter? = nil,
importAssetsBy assetImportSetting: AssetImportSetting = .download,
overwriteAssets: Bool = false,
shellOut: @escaping (String, [String]) throws -> String
) throws {
try begin(
importFrom: exportsDirectoryURL,
to: rootPublishSiteURL,
usingGenerator: PandocMarkdownGenerator(shellOut: shellOut),
filteringPostsWith: postFilters,
redirectsFormattedUsing: redirectFromatter,
importAssetsBy: assetImportSetting,
overwriteAssets: overwriteAssets
)
}

Check warning on line 57 in Sources/ContributeWordPress/MarkdownProcessor+Starter.swift

View check run for this annotation

Codecov / codecov/patch

Sources/ContributeWordPress/MarkdownProcessor+Starter.swift#L47-L57

Added lines #L47 - L57 were not covered by tests
}

0 comments on commit af40df2

Please sign in to comment.