private string GenerateHtml(ConceptMapFile conceptMapFile) { string displayName = conceptMapFile.ConceptMap.name.value; object[] content = GenerateContent(conceptMapFile, displayName); string contentHtml = Html.Div(content.ToArray()).ToString(SaveOptions.DisableFormatting); return(Pages.Instance.GetPage(displayName, contentHtml, "0.1", DateTime.Now)); }
public void Generate(ConceptMapFile conceptMapFile) { if (!_profileSet.ConceptMapFiles.Contains(conceptMapFile)) { throw new ArgumentException("ConceptMap does not exist in FhirXmlProfileSet", "conceptMap"); } string html = GenerateHtml(conceptMapFile); _outputPaths.WriteUtf8File(OutputFileType.Html, conceptMapFile.OutputHtmlFilename, html); }
private object[] GenerateContent(ConceptMapFile conceptMapFile, string displayName) { List <object> content = new List <object>(); ConceptMap conceptMap = conceptMapFile.ConceptMap; string name = conceptMap.name.value; string url = ""; if (conceptMap.url != null) { url = conceptMap.url.value; } content.AddRange(new object[] { Html.H3(GetConceptMapNameLabel(name)), Html.P("The official URL for this value set is: "), Html.Pre(url), Html.P(GetMaturity(conceptMapFile.Maturity)), }); string description = conceptMap.description.WhenNotNull(t => t.value); string referenceUrl = conceptMap.GetExtensionValueAsString(FhirConstants.ValueSetSourceReferenceExtensionUrl); string oid = conceptMap.GetExtensionValueAsString(FhirConstants.ValueSetOidExtensionUrl); if ((!string.IsNullOrWhiteSpace(description)) || (!string.IsNullOrWhiteSpace(referenceUrl)) || (!string.IsNullOrWhiteSpace(oid))) { content.AddRange(new object[] { Html.H3("Description"), GetFormattedDescription(description, referenceUrl, oid) }); } content.AddRange(new object[] { Html.H3("Definition"), GenerateDefinition(conceptMap) }); string copyright = conceptMap.copyright.WhenNotNull(t => t.value); if (!string.IsNullOrEmpty(copyright)) { content.AddRange(new object[] { Html.H3("Copyright"), Html.P(copyright) }); } content.AddRange(new object[] { Html.H3("Schemas"), StructureDefinitionHtmlGenerator.GetSchemasList(new object[] { Html.A(_outputPaths.GetRelativePath(OutputFileType.ConceptMap, conceptMapFile.OutputXmlFilename), "ConceptMap XML"), Html.A(_outputPaths.GetRelativePath(OutputFileType.ConceptMap, conceptMapFile.OutputJsonFilename), "ConceptMap JSON") }) }); return(content.ToArray()); }