Skip to content

Commit

Permalink
Fixed it! Adapting the tip in johnxnguyen/Down#242 sorted it
Browse files Browse the repository at this point in the history
  • Loading branch information
djstevenson committed Jan 23, 2021
1 parent 15d9027 commit 0833d5f
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 28 deletions.
6 changes: 3 additions & 3 deletions Sources/SongsToTheSiren/Markdown/DownAliases.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Down

typealias DownNode = Down.Node
typealias DownText = Down.Text
typealias DownImage = Down.Image
typealias DownNode = Node
typealias DownText = Text
typealias DownImage = Image
2 changes: 1 addition & 1 deletion Sources/SongsToTheSiren/Markdown/HtmlAliases.swift
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
import Html
typealias HtmlNode = Html.Node
typealias HtmlNode = Node
49 changes: 25 additions & 24 deletions Sources/SongsToTheSiren/Markdown/HtmlVisitor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,90 +5,91 @@ import Html

struct HtmlVisitor: Visitor {

typealias Result = String
typealias Result = HtmlNode

private func nodeWithChildren(_ node: DownNode, value: String) -> String {
let children = visitChildren(of: node).joined()
return "\(value)\(children)"
private func nodeWithChildren(_ node: DownNode, value: String) -> HtmlNode {
// let children = visitChildren(of: node).joined()
// return "\(value)\(children)"
return HtmlNode()
}

public func visit(document node: Document) -> String {
public func visit(document node: Document) -> HtmlNode {
return nodeWithChildren(node, value: "xyzzy \(#line)")
}

public func visit(blockQuote node: BlockQuote) -> String {
public func visit(blockQuote node: BlockQuote) -> HtmlNode {
nodeWithChildren(node, value: "xyzzy \(#line)")
}

public func visit(list node: List) -> String {
public func visit(list node: List) -> HtmlNode {
nodeWithChildren(node, value: "xyzzy \(#line)")
}

public func visit(item node: Item) -> String {
public func visit(item node: Item) -> HtmlNode {
nodeWithChildren(node, value: "xyzzy \(#line)")
}

public func visit(codeBlock node: CodeBlock) -> String {
public func visit(codeBlock node: CodeBlock) -> HtmlNode {
nodeWithChildren(node, value: "xyzzy \(#line)")
}

public func visit(htmlBlock node: HtmlBlock) -> String {
public func visit(htmlBlock node: HtmlBlock) -> HtmlNode {
nodeWithChildren(node, value: "xyzzy \(#line)")
}

public func visit(customBlock node: CustomBlock) -> String {
public func visit(customBlock node: CustomBlock) -> HtmlNode {
nodeWithChildren(node, value: "xyzzy \(#line)")
}

public func visit(paragraph node: Paragraph) -> String {
public func visit(paragraph node: Paragraph) -> HtmlNode {
nodeWithChildren(node, value: "xyzzy \(#line)")
}

public func visit(heading node: Heading) -> String {
public func visit(heading node: Heading) -> HtmlNode {
nodeWithChildren(node, value: "xyzzy \(#line)")
}

public func visit(thematicBreak node: ThematicBreak) -> String {
public func visit(thematicBreak node: ThematicBreak) -> HtmlNode {
nodeWithChildren(node, value: "xyzzy \(#line)")
}

public func visit(text node: Down.Text) -> String {
public func visit(text node: DownText) -> HtmlNode {
nodeWithChildren(node, value: "xyzzy \(#line)")
}

public func visit(softBreak node: SoftBreak) -> String {
public func visit(softBreak node: SoftBreak) -> HtmlNode {
nodeWithChildren(node, value: "xyzzy \(#line)")
}

public func visit(lineBreak node: LineBreak) -> String {
public func visit(lineBreak node: LineBreak) -> HtmlNode {
nodeWithChildren(node, value: "xyzzy \(#line)")
}

public func visit(code node: Code) -> String {
public func visit(code node: Code) -> HtmlNode {
nodeWithChildren(node, value: "xyzzy \(#line)")
}

public func visit(htmlInline node: HtmlInline) -> String {
public func visit(htmlInline node: HtmlInline) -> HtmlNode {
nodeWithChildren(node, value: "xyzzy \(#line)")
}

public func visit(customInline node: CustomInline) -> String {
public func visit(customInline node: CustomInline) -> HtmlNode {
nodeWithChildren(node, value: "xyzzy \(#line)")
}

public func visit(emphasis node: Emphasis) -> String {
public func visit(emphasis node: Emphasis) -> HtmlNode {
nodeWithChildren(node, value: "xyzzy \(#line)")
}

public func visit(strong node: Strong) -> String {
public func visit(strong node: Strong) -> HtmlNode {
nodeWithChildren(node, value: "xyzzy \(#line)")
}

public func visit(link node: Link) -> String {
public func visit(link node: Link) -> HtmlNode {
nodeWithChildren(node, value: "xyzzy \(#line)")
}

public func visit(image node: Down.Image) -> String {
public func visit(image node: DownImage) -> HtmlNode {
nodeWithChildren(node, value: "xyzzy \(#line)")
}

Expand Down

0 comments on commit 0833d5f

Please sign in to comment.