コード例 #1
0
        }//method

        private void ProcessNewLine(Token token)
        {
            if (_insideTable & !_insideCell)
            {
                return;                        //ignore it in one special case - to make output look nicer
            }
            if (_currentHeader != null)
            {
                _output.AppendLine(_currentHeader.CloseHtmlTag);
            }
            else
            {
                _output.AppendLine("<br/>");
            }
            _currentHeader = null;
        }//method
コード例 #2
0
        }//method

        private void ProcessWikiToken(Token token)
        {
            //we check that token actually contains some chars - to allow "invisible spaces" after last table tag
            if (_lastTableTag != null && !_insideCell && token.ValueString.Trim().Length > 0)
            {
                _output.Append(_lastTableTag.OpenHtmlTag);
                _insideCell = true;
            }
            var wikiTerm = token.Terminal as WikiTerminalBase;

            switch (wikiTerm.TermType)
            {
            case WikiTermType.Element:
                _output.Append(wikiTerm.OpenHtmlTag);
                _output.Append(wikiTerm.CloseHtmlTag);
                break;

            case WikiTermType.Format:
                ProcessFormatTag(token);
                break;

            case WikiTermType.Heading:
            case WikiTermType.List:
                _output.Append(wikiTerm.OpenHtmlTag);
                _currentHeader = wikiTerm;
                break;

            case WikiTermType.Block:
                ProcessWikiBlockTag(token);
                break;

            case WikiTermType.Text:
                _output.Append(HtmlEncode(token.ValueString));
                break;

            case WikiTermType.Table:
                if (_insideCell)
                {
                    _output.Append(_lastTableTag.CloseHtmlTag); //write out </td> or </th>
                }
                //We do not write opening tag immediately: we need to know if it is the last table tag on the line.
                // if yes, we don't write it at all; _lastTableTag will be cleared when we start new line
                _lastTableTag = wikiTerm as WikiTagTerminal;
                _insideCell   = false;
                break;
            }
        }