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
        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"));
        }
Exemple #3
0
 public ResourceListingHtmlGenerator(OutputPaths outputPaths, OutputOptions outputOptions)
 {
     _outputPaths   = outputPaths;
     _outputOptions = outputOptions;
 }