Exemple #1
0
        public string GetHtml(WIKIParser parser, string linkBase, int constraintCount, bool includeLabel)
        {
            StringBuilder sb = new StringBuilder();

            foreach (ConstraintPart cPart in this.parts)
            {
                switch (cPart.PartType)
                {
                case ConstraintPart.PartTypes.Keyword:
                case ConstraintPart.PartTypes.Context:
                case ConstraintPart.PartTypes.Template:
                case ConstraintPart.PartTypes.Vocabulary:
                case ConstraintPart.PartTypes.Constraint:
                    sb.Append("<b>" + cPart.Text + "</b>");
                    break;

                case ConstraintPart.PartTypes.Link:
                    sb.Append(string.Format("<a href=\"{0}{1}\">{2}</a>", linkBase, cPart.LinkDestination, cPart.Text));
                    break;

                case ConstraintPart.PartTypes.PrimitiveText:
                    sb.Append(parser.ParseAsHtml(cPart.Text));
                    break;

                default:
                    sb.Append(cPart.Text);
                    break;
                }
            }

            if (includeLabel && !string.IsNullOrEmpty(this.Label))
            {
                string additionalLabel = string.Format("<br/>Note: {0}", this.Label);
                sb.Append(additionalLabel);
            }

            return(sb.ToString());
        }
Exemple #2
0
 internal static string HtmlFormatDescriptiveText(WIKIParser parser, string text)
 {
     return(parser.ParseAsHtml(text));
 }