Пример #1
0
    public static System.Windows.Documents.Section GetDescription(CiComplItem item)
    {
        var m = new CiText();

        m.StartParagraph();
        m.Append(item.kind.ToString() + " "); m.Bold(item.Text); m.Append(".");
        m.EndParagraph();
        if (_GetText(item, out string s))
        {
            m.CodeBlock(s);
        }
        return(m.Result);
    }
Пример #2
0
    public static System.Windows.Documents.Section GetDescription(CiComplItem item)
    {
        var snippet = item as _CiComplItemSnippet;
        var m       = new CiText();

        m.StartParagraph();
        m.Append("Snippet "); m.Bold(item.Text); m.Append(".");
        _AppendInfo(snippet.x);
        bool isList = snippet.x.HasElements;

        if (isList)
        {
            foreach (var v in snippet.x.Elements("list"))
            {
                m.Separator();
                m.StartParagraph();
                m.Append(StringUtil.RemoveUnderlineChar(v.Attr("item")));
                _AppendInfo(v);
                _AppendCode(v);
            }
        }
        else
        {
            _AppendCode(snippet.x);
        }
        if (snippet.x.Attr(out string more, "more"))
        {
            if (isList)
            {
                m.Separator();
            }
            m.StartParagraph(); m.Append(more); m.EndParagraph();
        }
        return(m.Result);

        void _AppendInfo(XElement x)
        {
            if (x.Attr(out string info, "info"))
            {
                m.Append(" " + info);
            }
            m.EndParagraph();
        }

        void _AppendCode(XElement x)
        {
            m.CodeBlock(x.Value.Replace("$end$", ""));
        }
    }