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 {
|
||||||
data class UrlNode(val url: UrlUrlNode, val urlNameNode: UrlNameNode, val urlTitleNode: UrlTitleNode?) :
|
return "!" + urlUrlNode.print()
|
||||||
InlineNode()
|
}
|
||||||
|
}
|
||||||
data class UrlUrlNode(val url: String) : InlineNode()
|
|
||||||
data class UrlTitleNode(val title: String) : InlineNode()
|
data class UrlNode(val url: UrlUrlNode, val urlNameNode: UrlNameNode, val urlTitleNode: UrlTitleNode?) :
|
||||||
data class UrlNameNode(val name: String) : InlineNode()
|
InlineNode() {
|
||||||
|
override fun print(): String {
|
||||||
|
return "[${urlNameNode.print()}](${url.print()} ${urlTitleNode?.print().orEmpty()})"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
data class UrlUrlNode(val url: String) : InlineNode() {
|
||||||
|
override fun print(): String {
|
||||||
|
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