示例#1
0
文件: Node.cs 项目: Torvin/Telecord
        public Node Visit(Node node)
        {
            return(node switch
            {
                TextNode text => VisitText(text),
                StyleNode style => VisitStyle(style),
                NewlineNode nl => VisitNewline(nl),
                CodeNode code => VisitCode(code),
                LinkNode link => VisitLink(link),
                MentionNode mention => VisitMention(mention),
                ChannelNode channel => VisitChannel(channel),
                RoleNode role => VisitRole(role),
                CustomEmojiNode emoji => VisitCustomEmoji(emoji),
                ContainerNode container => VisitContainer(container),

                _ => throw new ArgumentException($"Unknown node type: {node.GetType()}."),
            });
示例#2
0
 public override Node VisitNewline(NewlineNode nl)
 {
     Text("\n");
     return(nl);
 }
示例#3
0
 public override Node VisitNewline(NewlineNode nl)
 {
     _builder.Append("<br>");
     return(nl);
 }