/// <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); }
public GlossaryTopicWriter(TopicData topic, TopicParserResult parserResult, IDictionary<string, TopicData> name2topic, XmlWriter writer) : base(topic, parserResult, name2topic, writer) { }
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); } }