Exemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TopicWriter"/> class.
 /// </summary>
 /// <param name="topic">Current topic.</param>
 /// <param name="parserResult">Parser result.</param>
 /// <param name="name2topic">Mapping from topic name to data.</param>
 /// <param name="writer">XML writer.</param>
 protected TopicWriter(TopicData topic, TopicParserResult parserResult, IDictionary<string, TopicData> name2topic, XmlWriter writer)
     : base(writer)
 {
     this.topic = topic;
     this.document = parserResult.Document;
     this.name2topic = name2topic;
     this.state = new WriterState();
     this.commandWriter = new Lazy<Writers.CommandWriter>(CreateCommandWriter);
     this.containerElementNames = new Lazy<IEnumerable<string>>(GetContainerElementNames);
     this.includeSeeAlso = new Lazy<bool>(GetIncludeSeeAlso);
 }
Exemplo n.º 2
0
 public GlossaryTopicWriter(TopicData topic, TopicParserResult parserResult, IDictionary<string, TopicData> name2topic, XmlWriter writer)
     : base(topic, parserResult, name2topic, writer)
 {
 }
Exemplo n.º 3
0
 private static TopicWriter Create(TopicData topic, TopicParserResult parserResult, IDictionary<string, TopicData> name2topic, XmlWriter writer)
 {
     switch (topic.Type)
     {
         case TopicType.Empty:
             return new EmptyTopicWriter(topic, parserResult, name2topic, writer);
         case TopicType.General:
             return new GeneralTopicWriter(topic, parserResult, name2topic, writer);
         case TopicType.Glossary:
             return new GlossaryTopicWriter(topic, parserResult, name2topic, writer);
         case TopicType.HowTo:
             return new HowToTopicWriter(topic, parserResult, name2topic, writer);
         case TopicType.Orientation:
             return new OrientationTopicWriter(topic, parserResult, name2topic, writer);
         default:
             throw new InvalidOperationException("Unexpected topic type: " + topic.Type);
     }
 }