Exemplo n.º 1
0
        public string CompileForHtml(Form form, string text, HelpComponents helpComponents,
                                     TopicCompilerSettingsInterface topicCompilerSettings)
        {
            TopicCompiler topicCompiler = new TopicCompiler(form, helpComponents, _preprocessedTopic, topicCompilerSettings);

            return(topicCompiler.CompileForHtml(text));
        }
Exemplo n.º 2
0
        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));
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        public TopicCompiler(HelpComponents helpComponents,Preprocessor.TopicPreprocessor preprocessedTopic,TopicCompilerSettingsInterface topicCompilerSettings)
        {
            _helpComponents = helpComponents;
            _preprocessedTopic = preprocessedTopic;
            _topicCompilerSettings = topicCompilerSettings;
            _sb = new StringBuilder();

            _tagSettings = new Dictionary<string,TagSettings>();
            _tagSettings.Add(TagTitle,new TagSettings(true,null,(EndTagHandlerDelegate)EndTitleHandler,0,0));
            _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(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(TitleHeaderTag,new TagSettings(false,(StartTagHandlerDelegate)StartTitleHeaderHandler,null,0,0));
            _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,3));
            _tagSettings.Add(TableCellTag,new TagSettings(true,(StartTagHandlerDelegate)StartTableCellHandler,(EndTagHandlerDelegate)EndTableCellHandler,0,1));
            _tagSettings.Add(SeeAlsoTag,new TagSettings(false,(StartTagHandlerDelegate)StartSeeAlsoHandler,null,1,Int32.MaxValue));
            _tagSettings.Add(LogicTag,new TagSettings(true,"",(EndTagHandlerDelegate)EndLogicHandler,0,0));
            _tagSettings.Add(LogicColorTag,new TagSettings(true,"",(EndTagHandlerDelegate)EndLogicColorHandler,0,0));
            _tagSettings.Add(PffTag,new TagSettings(true,"",(EndTagHandlerDelegate)EndPffHandler,0,0));
            _tagSettings.Add(PffColorTag,new TagSettings(true,"",(EndTagHandlerDelegate)EndPffColorHandler,0,0));
            _tagSettings.Add(HtmlTag,new TagSettings("",""));

            _blockTags = new Dictionary<string,string>();
            _blockTags.Add(MakeTag(LogicTag,true),MakeTag(LogicTag,false));
            _blockTags.Add(MakeTag(PffTag,true),MakeTag(PffTag,false));
            _blockTags.Add(MakeTag(HtmlTag,true),MakeTag(HtmlTag,false));
        }
Exemplo n.º 5
0
 public string CompileForHtml(string[] lines,HelpComponents helpComponents,TopicCompilerSettingsInterface topicCompilerSettings)
 {
     TopicCompiler topicCompiler = new TopicCompiler(helpComponents,_preprocessedTopic,topicCompilerSettings);
     return topicCompiler.CompileForHtml(lines);
 }
Exemplo n.º 6
0
 public TopicCompiler(Form form, HelpComponents helpComponents, Preprocessor.TopicPreprocessor preprocessedTopic,
                      TopicCompilerSettingsInterface topicCompilerSettings)
     :   this(new CSPro.Logic.Colorizer(form.Handle.ToInt32()), helpComponents, preprocessedTopic, topicCompilerSettings)
 {
 }