Exemple #1
0
        public string Generate(string[] inputFilePaths, string outputDirectory, OutputOptions outputOptions)
        {
            if (inputFilePaths == null)
            {
                throw new ArgumentNullException("inputFilePaths");
            }

            if (string.IsNullOrWhiteSpace(outputDirectory))
            {
                throw new ArgumentNullException("outputDirectory");
            }

            OutputPaths outputPaths = new OutputPaths
                                      (
                outputDirectory: Path.Combine(outputDirectory, "Generated"),
                stylesRelativePath: "styles",
                imagesRelativePath: "images",
                scriptsRelativePath: "scripts",
                structureDefinitionPath: "StructureDefinition",
                valueSetPath: "ValueSet",
                // Kevin Mayfield Leeds Teaching Trust 23/1/2017 added ConceptMap
                conceptMapPath: "ConceptMap"
                                      );

            Pages.Instance.PageHeader      = outputOptions.HeaderText;
            Pages.Instance.PageTitleSuffix = outputOptions.PageTitleSuffix;
            Pages.Instance.TemplatePage    = outputOptions.PageTemplate;

            ResourceFileSet resourceFileSet = new ResourceFileSet();

            resourceFileSet.LoadXmlResourceFiles(inputFilePaths.Where(t => !string.IsNullOrWhiteSpace(t)).ToArray());

            return(GenerateHtml(resourceFileSet, outputPaths, outputOptions));
        }
Exemple #2
0
        public static void WriteImagesToDisk(OutputPaths outputPaths)
        {
            string[] imageNames = GetImageNames();

            foreach (string imageName in imageNames)
            {
                ResourceHelper.WriteResourceToDisk(ImagesResourceLocation + imageName, outputPaths.GetOutputPath(OutputFileType.Image, imageName));
            }
        }
        public static void WriteStylesToDisk(OutputPaths outputPaths)
        {
            string[] styleNames = GetStyleNames();

            foreach (string styleName in styleNames)
            {
                ResourceHelper.WriteResourceToDisk(StylesheetResourceLocation + styleName, outputPaths.GetOutputPath(OutputFileType.Style, styleName));
            }
        }
        public static void WriteScriptsToDisk(OutputPaths outputPaths)
        {
            string[] scriptNames = GetScriptNames();

            foreach (string scriptName in scriptNames)
            {
                ResourceHelper.WriteResourceToDisk(ScriptsResourceLocation + scriptName, outputPaths.GetOutputPath(OutputFileType.Script, scriptName));
            }
        }
Exemple #5
0
        private string GenerateHtml(ResourceFileSet resourceFileSet, OutputPaths outputPaths, OutputOptions outputOptions)
        {
            // copy supporting files
            Styles.WriteStylesToDisk(outputPaths);
            Images.WriteImagesToDisk(outputPaths);
            Scripts.WriteScriptsToDisk(outputPaths);

            // structure definition pages
            StructureDefinitionHtmlGenerator structureDefinitionGenerator = new StructureDefinitionHtmlGenerator(resourceFileSet, outputPaths);

            structureDefinitionGenerator.GenerateAll();

            // valueset pages
            ValueSetHtmlGenerator valuesetGenerator = new ValueSetHtmlGenerator(resourceFileSet, outputPaths);

            valuesetGenerator.GenerateAll();

            // Kevin Mayfield Leeds Teaching Trust 23/1/2017 added ConceptMap
            // conceptmap pages
            ConceptMapHtmlGenerator conceptMapGenerator = new ConceptMapHtmlGenerator(resourceFileSet, outputPaths);

            conceptMapGenerator.GenerateAll();

            if (outputOptions.ShowEverythingOnOnePage)
            {
                ResourceListingHtmlGenerator resourceListingGenerator = new ResourceListingHtmlGenerator(outputPaths, outputOptions);
                resourceListingGenerator.GenerateSingleResourceListingPageWithIntroText("index.html", resourceFileSet, outputOptions.IndexPageHtml);
            }
            else
            {
                ResourceListingHtmlGenerator resourceListingGenerator = new ResourceListingHtmlGenerator(outputPaths, outputOptions);
                resourceListingGenerator.GenerateStructureDefinitionListing("resources.html", resourceFileSet);

                ResourceListingHtmlGenerator valueSetsListingGenerator = new ResourceListingHtmlGenerator(outputPaths, outputOptions);
                resourceListingGenerator.GenerateValueSetListing("valuesets.html", resourceFileSet);

                // Kevin Mayfield Leeds Teaching Trust 23/1/2017 added ConceptMap
                ResourceListingHtmlGenerator conceptMapsListingGenerator = new ResourceListingHtmlGenerator(outputPaths, outputOptions);
                resourceListingGenerator.GenerateConceptMapListing("conceptmaps.html", resourceFileSet);

                GenericPageGenerator pageGenerator = new GenericPageGenerator(outputPaths);
                pageGenerator.Generate("index.html", "Overview", outputOptions.IndexPageHtml);

                pageGenerator.Generate("api.html", "API", GetApiPageContent());
            }

            // profile xml and json files
            SourceFileManager sourceGenerator = new SourceFileManager(outputPaths, resourceFileSet);

            sourceGenerator.CopyXml();
            sourceGenerator.GenerateJson();
            sourceGenerator.CreateRedirectsForProfileUrls();

            return(outputPaths.GetOutputPath(OutputFileType.Html, "index.html"));
        }
        public StructureDefinitionHtmlGenerator(ResourceFileSet resourceFileSet, OutputPaths outputPaths)
        {
            if (resourceFileSet == null)
            {
                throw new ArgumentNullException("profileSet");
            }

            if (outputPaths == null)
            {
                throw new ArgumentNullException("outputPaths");
            }

            _resourceFileSet = resourceFileSet;
            _outputPaths     = outputPaths;
        }
Exemple #7
0
        public ValueSetHtmlGenerator(ResourceFileSet profileSet, OutputPaths outputPaths)
        {
            if (profileSet == null)
            {
                throw new ArgumentNullException("profileSet");
            }

            if (outputPaths == null)
            {
                throw new ArgumentNullException("outputPaths");
            }

            _profileSet  = profileSet;
            _outputPaths = outputPaths;
        }
 public SourceFileManager(OutputPaths outputPaths, ResourceFileSet profileSet)
 {
     _outputPaths = outputPaths;
     _profileSet  = profileSet;
 }
Exemple #9
0
        public static string GenerateBackgroundHierarchyImage(bool[] indents, bool hasChildren, OutputPaths outputPaths)
        {
            string imageName = GetBackgroundHierarchyImageFilename(indents, hasChildren);

            string filePath = outputPaths.GetOutputPath(OutputFileType.Image, imageName);

            using (FileStream stream = new FileStream(filePath, FileMode.Create))
            {
                using (Bitmap bi = new Bitmap(400, 2))
                {
                    using (Graphics graphics = Graphics.FromImage(bi))
                    {
                        using (Pen pen = new Pen(Color.White))
                        {
                            graphics.DrawRectangle(pen, 0, 0, 400, 2);

                            for (int i = 0; i < indents.Length; i++)
                            {
                                if (!indents[i])
                                {
                                    bi.SetPixel(12 + (i * 16), 0, Color.Black);
                                }
                            }

                            if (hasChildren)
                            {
                                bi.SetPixel(12 + (indents.Length * 16), 0, Color.Black);
                            }

                            bi.Save(stream, ImageFormat.Png);
                        }
                    }
                }
            }

            return(imageName);
        }
 public static XElement[] GetStylesheetTags(OutputPaths outputPaths)
 {
     return(GetStyleNames().Select(t => Html.LinkStylesheet(outputPaths.GetRelativePath(OutputFileType.Style, t))).ToArray());
 }
 public TreeViewGenerator(ResourceFileSet resourceFileSet, OutputPaths outputPaths)
 {
     _resourceFileSet = resourceFileSet;
     _outputPaths     = outputPaths;
 }
 internal static object GetScriptTags(OutputPaths outputPaths)
 {
     return(GetScriptNames().Select(t => Html.Script(outputPaths.GetRelativePath(OutputFileType.Script, t))).ToArray());
 }
 public GenericPageGenerator(OutputPaths outputPaths)
 {
     _outputPaths = outputPaths;
 }
Exemple #14
0
 public ResourceListingHtmlGenerator(OutputPaths outputPaths, OutputOptions outputOptions)
 {
     _outputPaths   = outputPaths;
     _outputOptions = outputOptions;
 }