Example #1
0
    public static WikiOutput ForFormat(OutputFormat aFormat, WikiOutput parent)
    {
      switch (aFormat)
      {
        case OutputFormat.HTML:
          return new HTMLWikiOutput(parent);

        case OutputFormat.Testing:
          return new TestWikiOutput(parent);

        default:
          throw new Exception("Unsupported output type requested: " + aFormat.ToString());
      }
    }
 public override void OutputTo(WikiOutput output)
 {
     output.ContainerEnd(_type);
 }
Example #3
0
 /// <summary>
 /// Format a given input string to the given output
 /// </summary>pre
 /// <param name="source">Input wiki content as a list of StyledLines</param>
 /// <param name="output">Output object to which output is sent</param>
 /// <param name="namespaceManager">The ContentProviderChain that contains the wiki string text</param>
 /// <param name="maker">A link maker </param>
 /// <param name="external">External wiki map</param>
 /// <param name="headingLevelBase">Relative heading level</param>
 /// <param name="accumulator">composite cache rule in which to accumulate cache rules</param>
 /// 
 public static void Format(QualifiedTopicRevision topic, IList source, WikiOutput output,
     NamespaceManager namespaceManager, LinkMaker maker, ExternalReferencesMap external, int headingLevelBase)
 {
     Formatter f = new Formatter(topic, source, output, namespaceManager, maker, external, headingLevelBase);
     f.Format();
 }
Example #4
0
 /// <summary>
 /// Create a new formatter for a string of input content.
 /// </summary>
 /// <param name="source">Input wiki string</param>
 /// <param name="output">Output object to which output is sent</param>
 /// <param name="namespaceManager">The ContentProviderChain that contains the wiki string text</param>
 /// <param name="maker">A link maker </param>
 /// <param name="external">External wiki map</param>
 /// <param name="headingLevelBase">Relative heading level</param>
 /// <param name="accumulator">composite cache rule in which to accumulate cache rules</param>
 /// 
 Formatter(QualifiedTopicRevision topic, string source, WikiOutput output, NamespaceManager namespaceManager,
     LinkMaker maker, ExternalReferencesMap external, int headingLevelBase)
 {
     _topic = topic;
     _source = SplitStringIntoStyledLines(source, LineStyle.Unchanged);
     _linkMaker = maker;
     NamespaceManager = namespaceManager;
     _output = output;
     _externalWikiMap = external;
     _headingLevelBase = headingLevelBase;
 }
Example #5
0
		/// <summary>
		/// Create a new formatter for an input list of StyledLines
		/// </summary>
		/// <param name="source">Input wiki content as a list of StyledLines</param>
		/// <param name="output">Output object to which output is sent</param>
		/// <param name="contentBase">The ContentBase that contains the wiki string text</param>
		/// <param name="maker">A link maker </param>
		/// <param name="external">External wiki map</param>
		/// <param name="headingLevelBase">Relative heading level</param>
		/// <param name="accumulator">composite cache rule in which to accumulate cache rules</param>
		/// 
		Formatter(AbsoluteTopicName topic, IList source, WikiOutput output, ContentBase contentBase, LinkMaker maker, Hashtable external, int headingLevelBase, CompositeCacheRule accumulator)
		{
			_Topic = topic;
			_Source = source;
			_Output = output;
			_LinkMaker = maker;
			ContentBase = contentBase;
			_ExternalWikiMap = external;
			_HeadingLevelBase = headingLevelBase;
			_CacheRuleAccumulator = accumulator;
		}
Example #6
0
		static public IWikiToPresentation WikiToPresentation(AbsoluteTopicName topic, WikiOutput output, ContentBase contentBase, LinkMaker maker, Hashtable external, int headingLevelBase, CompositeCacheRule accumulator)
		{
			ArrayList lines = new ArrayList();
			lines.Add(new StyledLine("", LineStyle.Unchanged));
			return new Formatter(topic, lines, output, contentBase, maker, external,  headingLevelBase, accumulator);
		}
Example #7
0
		public override void OutputTo(WikiOutput output)
		{
			output.WriteImage(Title, URL, LinkToURL, Height, Width);
		}
 public override void OutputTo(WikiOutput output)
 {
     output.NonBreakingSpace();
 }
 public override void OutputTo(WikiOutput output)
 {
     output.WriteLabel(ForId, Text, Attributes);
 }
Example #10
0
 public WomDocument(WikiOutput parent)
     : base(parent)
 {
     //should use an XmlDocument instead of a StringBuilder in production version ??
     //_filename = filename;
     _intermediate = new StringBuilder(10000);
     urlRegExp = new Regex(urlKeys + urlRegex, RegexOptions.IgnoreCase);
     _templist = new StringBuilder();
     _lastitemlevel = 0;
     _rn = new Random();
     anchorid = 1;
     //tableofcontents = 1;
     //Begin();
 }
Example #11
0
		public override void OutputTo(WikiOutput output)
		{
			output.FormStart(Method, URI);
		}
 public override void OutputTo(WikiOutput output)
 {
     output.FormInputBox(FieldName, FieldValue, FieldLength, Attributes);
 }
 public override void OutputTo(WikiOutput output)
 {
     foreach (IPresentation each in _Children)
         each.OutputTo(output);
 }
 public override void OutputTo(WikiOutput output)
 {
     output.FormEnd();
 }
Example #15
0
		public override void OutputTo(WikiOutput output)
		{
			output.WriteLink(URL, Tip, Content);
		}
 public override void OutputTo(WikiOutput output)
 {
     output.WriteThumbnail(_title,_titleColour,_URL,_imageURL, _size, _borderColour, _borderWidth, _borderStyle,_clickable);
 }
 public override void OutputTo(WikiOutput output)
 {
     output.FormImageButton(FieldName, ImageURI, TipString, Attributes);
 }
Example #18
0
 public IWikiToPresentation WikiToPresentation(QualifiedTopicRevision topic, WikiOutput output,
     NamespaceManager namespaceManager, LinkMaker maker, ExternalReferencesMap external, int headingLevelBase, bool fragment)
 {
     //ArrayList lines = new ArrayList();
     //lines.Add(new StyledLine("", LineStyle.Unchanged));
     //return new Formatter(topic, lines, output, namespaceManager, maker, external, headingLevelBase);
     WomDocument doc = (WomDocument)output;
     doc.Mgr = namespaceManager;
     doc.Fed = _fed;
     doc.FragmentOnly = fragment;
     output.Begin();
     return this;
 }
Example #19
0
		public WikiOutput(WikiOutput parent)
		{
			_TextWriter = new StringWriter();
			_Parent = parent;
		}
 public override void OutputTo(WikiOutput output)
 {
     output.FormCheckbox(FieldName, FieldValue, IsChecked, Attributes);
 }
Example #21
0
		/// <summary>
		/// Format a given input string to the given output
		/// </summary>
		/// <param name="source">Input wiki content as a list of StyledLines</param>
		/// <param name="output">Output object to which output is sent</param>
		/// <param name="contentBase">The ContentBase that contains the wiki string text</param>
		/// <param name="maker">A link maker </param>
		/// <param name="external">External wiki map</param>
		/// <param name="headingLevelBase">Relative heading level</param>
		/// <param name="accumulator">composite cache rule in which to accumulate cache rules</param>
		/// 
		static public void Format(AbsoluteTopicName topic, IList source, WikiOutput output, ContentBase contentBase, LinkMaker maker, Hashtable external, int headingLevelBase, CompositeCacheRule accumulator)
		{
			Formatter f = new Formatter(topic, source, output, contentBase, maker, external, headingLevelBase, accumulator);
			f.Format();
		}
 public override void OutputTo(WikiOutput output)
 {
     output.FormSelectField(FieldName, Size, Multiple, Options, SelectedOption, Values, SelectedValue, Attributes);
 }
Example #23
0
		/// <summary>
		/// Create a new formatter for a string of input content.
		/// </summary>
		/// <param name="source">Input wiki string</param>
		/// <param name="output">Output object to which output is sent</param>
		/// <param name="contentBase">The ContentBase that contains the wiki string text</param>
		/// <param name="maker">A link maker </param>
		/// <param name="external">External wiki map</param>
		/// <param name="headingLevelBase">Relative heading level</param>
		/// <param name="accumulator">composite cache rule in which to accumulate cache rules</param>
		/// 
		Formatter(AbsoluteTopicName topic, string source, WikiOutput output, ContentBase contentBase, LinkMaker maker, Hashtable external, int headingLevelBase, CompositeCacheRule accumulator)
		{
			_Topic = topic;
			_Source = SplitStringIntoStyledLines(source, LineStyle.Unchanged);
			_LinkMaker = maker;	
			ContentBase = contentBase;
			_Output = output;
			_ExternalWikiMap = external;
			_HeadingLevelBase = headingLevelBase;
			_CacheRuleAccumulator = accumulator;
		}
Example #24
0
		public HTMLWikiOutput(WikiOutput parent) : base(parent)
		{
		}
Example #25
0
        /// <summary>
        /// Format the supplied string with the current settings of the Formatter (including to the same Output and cache rule accumulator)
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        private string NestedFormat(string input, WikiOutput parent)
        {
            WikiOutput output = WikiOutput.ForFormat(_output.Format, parent);
            if (!IsBeyondSafeNestingDepth)
            {
                IList lines = SplitStringIntoStyledLines(input, Output.Style);
                Formatter.Format(CurrentTopic, lines, output, NamespaceManager, LinkMaker(), _externalWikiMap, _headingLevelBase);
            }
            else
            {
                /// we're headed for trouble.  The formatting depth is beyond a reasonable depth.  We're likely headed towards
                /// infinite recursion.
                output.WriteErrorMessage("exceeded maximum nesting depth (" + MaximumNestingDepth + ")", "The maximum nesting depth for formatting topics has been exceeded.  This is likely caused by infinite recursion in some WikiTalk.");
            }
            string str = output.ToString();

            // TODO -- Hack alert.  Right now the formatter pretty much always returns its details wrapped in a paragraph.  This is just not
            // what you necessarily want for nested formatting (e.g., if you want just a few words and don't want a para).  So this code strips the
            // enclosing <p> and </p>; it also takes away any training line break stuff
            string open = "<p>";
            string close = "</p>";
            if (str.StartsWith(open))
            {
                str = str.Remove(0, open.Length);
                int lastOne = str.LastIndexOf(close);
                if (lastOne > 0)
                {
                    str = str.Remove(lastOne, close.Length);
                }
            }
            if (str.EndsWith(Environment.NewLine))
                str = str.Substring(0, str.Length - Environment.NewLine.Length);

            // END HACK

            return str;
        }
		public override void OutputTo(WikiOutput output)
		{
			output.FormSubmitButton(FieldName, Label);
		}
Example #27
0
 /// <summary>
 /// Create a new formatter for an input list of StyledLines
 /// </summary>
 /// <param name="source">Input wiki content as a list of StyledLines</param>
 /// <param name="output">Output object to which output is sent</param>
 /// <param name="namespaceManager">The ContentProviderChain that contains the wiki string text</param>
 /// <param name="maker">A link maker </param>
 /// <param name="external">External wiki map</param>
 /// <param name="headingLevelBase">Relative heading level</param>
 /// <param name="accumulator">composite cache rule in which to accumulate cache rules</param>
 /// 
 Formatter(QualifiedTopicRevision topic, IList source, WikiOutput output, NamespaceManager namespaceManager,
     LinkMaker maker, ExternalReferencesMap external, int headingLevelBase)
 {
     _topic = topic;
     _source = source;
     _output = output;
     _linkMaker = maker;
     NamespaceManager = namespaceManager;
     _externalWikiMap = external;
     _headingLevelBase = headingLevelBase;
 }
		public override void OutputTo(WikiOutput output)
		{
			output.FormHiddenField(FieldName, FieldValue, Attributes);
		}
Example #29
0
 public static IWikiToPresentation WikiToPresentation(QualifiedTopicRevision topic, WikiOutput output,
     NamespaceManager namespaceManager, LinkMaker maker, ExternalReferencesMap external, int headingLevelBase)
 {
     ArrayList lines = new ArrayList();
     lines.Add(new StyledLine("", LineStyle.Unchanged));
     return new Formatter(topic, lines, output, namespaceManager, maker, external, headingLevelBase);
 }
 public override void OutputTo(WikiOutput output)
 {
     output.FormTextarea(FieldName, FieldValue, Rows, Cols, Attributes);
 }