public string CompileForHtml(CSPro.Logic.Colorizer colorizer, string text, HelpComponents helpComponents, TopicCompilerSettingsInterface topicCompilerSettings) { TopicCompiler topicCompiler = new TopicCompiler(colorizer, helpComponents, _preprocessedTopic, topicCompilerSettings); return(topicCompiler.CompileForHtml(text)); }
public TopicCompiler(CSPro.Logic.Colorizer colorizer, HelpComponents helpComponents, Preprocessor.TopicPreprocessor preprocessedTopic, TopicCompilerSettingsInterface topicCompilerSettings) { _helpComponents = helpComponents; _preprocessedTopic = preprocessedTopic; _topicCompilerSettings = topicCompilerSettings; _colorizer = colorizer; _colorizer.SetLinkFormatter(GetHtmlFilenameForKeyword); _sb = new StringBuilder(); _tagSettings = new Dictionary <string, TagSettings>(); _tagSettings.Add(TagTitle, new TagSettings(true, (StartTagHandlerDelegate)StartTitleHandler, (EndTagHandlerDelegate)EndTitleHandler, 0, 1)); _tagSettings.Add(ContextTag, new TagSettings(false, (StartTagHandlerDelegate)StartContextHandler, null, 1, Int32.MaxValue)); _tagSettings.Add(IndentTag, new TagSettings(true, (StartTagHandlerDelegate)StartIndentHandler, (EndTagHandlerDelegate)EndTagHandlerUsingFilledEndTagStack, 0, 1)); _tagSettings.Add(CenterTag, new TagSettings("<div align=\"center\">", "</div>")); _tagSettings.Add(BoldTag, new TagSettings("<b>", "</b>")); _tagSettings.Add(ItalicsTag, new TagSettings("<i>", "</i>")); _tagSettings.Add(SuperscriptTag, new TagSettings("<sup>", "</sup>")); _tagSettings.Add(FontTag, new TagSettings(true, (StartTagHandlerDelegate)StartFontHandler, "</span>", 1, 3)); _tagSettings.Add(ListTag, new TagSettings(true, (StartTagHandlerDelegate)StartListHandler, (EndTagHandlerDelegate)EndTagHandlerUsingFilledEndTagStack, 0, 1)); _tagSettings.Add(ListItemTag, new TagSettings("<li>", "</li>")); _tagSettings.Add(HeaderTag, new TagSettings("<div class=\"header_size header\">", "</div>")); _tagSettings.Add(SubheaderTag, new TagSettings("<div class=\"subheader_size subheader\">", "</div>")); _tagSettings.Add(ImageTag, new TagSettings(false, (StartTagHandlerDelegate)StartImageHandler, null, 1, 2)); _tagSettings.Add(TopicTag, new TagSettings(false, (StartTagHandlerDelegate)StartTopicHandler, null, 1, 1)); _tagSettings.Add(LinkTag, new TagSettings(true, (StartTagHandlerDelegate)StartLinkHandler, "</a>", 1, 1)); _tagSettings.Add(TableTag, new TagSettings(true, (StartTagHandlerDelegate)StartTableHandler, (EndTagHandlerDelegate)EndTableHandler, 1, 4)); _tagSettings.Add(TableCellTag, new TagSettings(true, (StartTagHandlerDelegate)StartTableCellHandler, (EndTagHandlerDelegate)EndTableCellHandler, 0, 2)); _tagSettings.Add(SeeAlsoTag, new TagSettings(false, (StartTagHandlerDelegate)StartSeeAlsoHandler, null, 1, Int32.MaxValue)); _tagSettings.Add(LogicTag, new TagSettings(true, "", (EndTagHandlerDelegate)EndLogicHandler, 0, 0)); _tagSettings.Add(LogicSyntaxTag, new TagSettings(true, (StartTagHandlerDelegate)StartLogicObjectHandler, (EndTagHandlerDelegate)EndLogicSyntaxHandler, 0, 1)); _tagSettings.Add(LogicColorTag, new TagSettings(true, (StartTagHandlerDelegate)StartLogicObjectHandler, (EndTagHandlerDelegate)EndLogicColorHandler, 0, 1)); _tagSettings.Add(LogicArgumentTag, new TagSettings("<span class=\"code_colorization_argument\">", "</span>")); _tagSettings.Add(LogicTableTag, new TagSettings(false, (StartTagHandlerDelegate)StartLogicTableHandler, null, 1, 1)); _tagSettings.Add(MessageTag, new TagSettings(true, "", (EndTagHandlerDelegate)EndMessageHandler, 0, 0)); _tagSettings.Add(ReportTag, new TagSettings(true, (StartTagHandlerDelegate)StartReportHandler, (EndTagHandlerDelegate)EndReportHandler, 0, 1)); _tagSettings.Add(PffTag, new TagSettings(true, "", (EndTagHandlerDelegate)EndPffHandler, 0, 0)); _tagSettings.Add(PffColorTag, new TagSettings(true, "", (EndTagHandlerDelegate)EndPffColorHandler, 0, 0)); _tagSettings.Add(ColorTag, new TagSettings(true, (StartTagHandlerDelegate)StartColorHandler, (EndTagHandlerDelegate)EndColorHandler, 1, 1)); _tagSettings.Add(ColorInlineTag, new TagSettings(true, (StartTagHandlerDelegate)StartColorHandler, (EndTagHandlerDelegate)EndColorInlineHandler, 1, 1)); _tagSettings.Add(HtmlTag, new TagSettings("", "")); _tagSettings.Add(CalloutTag, new TagSettings(true, "<div style=\"background-color: lightgrey;border:1px solid black;margin:10px;padding:10px\">", "</div>", 0, 0)); _tagSettings.Add(PageBreakTag, new TagSettings(false, "<div class=\"new-page\" />", "", 0, 0)); _blockTags = new HashSet <string>(); _blockTags.Add(LogicTag); _blockTags.Add(LogicSyntaxTag); _blockTags.Add(MessageTag); _blockTags.Add(ReportTag); _blockTags.Add(PffTag); _blockTags.Add(ColorTag); _blockTags.Add(HtmlTag); }
public GenerateHelpsForm(HelpComponents helpComponents, GenerationType generationType) { InitializeComponent(); _helpComponents = helpComponents; _generationType = generationType; _colorizer = new CSPro.Logic.Colorizer(Handle.ToInt32()); _projectName = new DirectoryInfo(_helpComponents.projectPath).Name; string outputPath = Path.GetFullPath(Path.Combine(_helpComponents.projectPath, "..", Constants.OutputsDirectoryName)); _temporaryFilesPath = Path.Combine(_helpComponents.projectPath, Constants.TemporaryFileDirectoryName); Directory.CreateDirectory(_temporaryFilesPath); _backgroundThread = new BackgroundWorker(); // for the CHM string outputChmPath = Path.Combine(outputPath, Constants.OutputsChmDirectoryName); Directory.CreateDirectory(outputChmPath); _outputChmFilename = Path.Combine(outputChmPath, _projectName + Constants.ChmFileExtension); File.Delete(_outputChmFilename); _outputTopicFilenames = new Dictionary <Preprocessor.TopicPreprocessor, string>(); _chmTopicCompilerSettings = new GenerateChmTopicCompilerSettings(); // for the website _outputWebsitePath = Path.Combine(outputPath, Constants.OutputsWebsiteDirectoryName, _projectName); if (Directory.Exists(_outputWebsitePath)) { Directory.Delete(_outputWebsitePath, true); } Directory.CreateDirectory(_outputWebsitePath); _websiteTopicCompilerSettings = new GenerateWebsiteTopicCompilerSettings(_helpComponents); // for the PDF string outputPdfPath = Path.Combine(outputPath, Constants.OutputsPdfDirectoryName); Directory.CreateDirectory(outputPdfPath); _outputPdfFilename = Path.Combine(outputPdfPath, _projectName + ".pdf"); File.Delete(_outputPdfFilename); _outputPdfTopicsFilename = Path.Combine(_temporaryFilesPath, "_output_pdf_topics.html"); _pdfTopicCompilerSettings = new GeneratePdfTopicCompilerSettings(); }
public Processor(Form form) { _colorizer = new CSPro.Logic.Colorizer(form.Handle.ToInt32()); _pffColorizer = new PffColorizer(); }