feat: urlのprintを追加
This commit is contained in:
parent
5fd15c975b
commit
579343145e
|
@ -76,13 +76,35 @@ sealed class AstNode {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
data class ImageNode(val urlUrlNode: UrlNode) : InlineNode()
|
data class ImageNode(val urlUrlNode: UrlNode) : InlineNode() {
|
||||||
|
override fun print(): String {
|
||||||
|
return "!" + urlUrlNode.print()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
data class UrlNode(val url: UrlUrlNode, val urlNameNode: UrlNameNode, val urlTitleNode: UrlTitleNode?) :
|
data class UrlNode(val url: UrlUrlNode, val urlNameNode: UrlNameNode, val urlTitleNode: UrlTitleNode?) :
|
||||||
InlineNode()
|
InlineNode() {
|
||||||
|
override fun print(): String {
|
||||||
|
return "[${urlNameNode.print()}](${url.print()} ${urlTitleNode?.print().orEmpty()})"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
data class UrlUrlNode(val url: String) : InlineNode()
|
data class UrlUrlNode(val url: String) : InlineNode() {
|
||||||
data class UrlTitleNode(val title: String) : InlineNode()
|
override fun print(): String {
|
||||||
data class UrlNameNode(val name: String) : InlineNode()
|
return url
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
data class UrlTitleNode(val title: String) : InlineNode() {
|
||||||
|
override fun print(): String {
|
||||||
|
return "\"$title\""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
data class UrlNameNode(val name: String) : InlineNode() {
|
||||||
|
override fun print(): String {
|
||||||
|
return name
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue