예제 #1
0
        private static XmlReader CreateSourceXml(Project project, Options options)
        {
            var xElements =
                from source in project.Sources
                let highlighter = DocumentationManager.TryGetDefinitionByIdentifier(source.Language)
                                  select new XElement(
                    "File",
                    new XElement("Identifier", source.Identifier),
                    highlighter.HighlightLines(source.OriginalLines));
            var reader = new XDocument(new XElement("Source", xElements)).CreateReader();

            if (options.SaveXmls)
            {
                new XDocument(new XElement("Source", xElements)).Save(EnvVar.XmlOutputPath(options.OutputDirectory, "source.xml"));
            }

            return(reader);
        }
예제 #2
0
파일: Project.cs 프로젝트: CPardi/Doctran
        public XElement XEle(XElement xmlPassthrough)
        {
            var xEle = new XElement("Project");

            xEle.Add(xmlPassthrough);
            xEle.Add(new XElement("DocCreated", DateTime.Now.ToXElement()));
            xEle.Add(
                from info in this.SubObjects.OfType <Description>()
                select new XElement("Description", info.Basic, info.Detailed));

            var sourceXEle = new XElement(this.SourcesXmlHead);

            foreach (var source in this.Sources)
            {
                var generator = DocumentationManager.TryGetDefinitionByIdentifier(source.Language);
                sourceXEle.Add(generator.ParsedSourcesToXml(source));
            }

            xEle.Add(sourceXEle);
            return(xEle);
        }