/// <summary> /// Creates the object to make copy of the web files template replacing texts /// </summary> /// <returns>The text replacements tool</returns> private Replacements CreateTextReplacements() { // Generate search form HTML code: // TODO: Remove html resources //string textSearch = Project.FullTextSearch ? Resources.SearchFormFullText : Resources.SearchFormSimple; // Ugly thing: On search.aspx page there can be page header an footer, and they can contain // links to previous, next and home. Make a static replacement now: string header = Decorator.HeaderHtmlCode.Replace(HtmlPageDecorator.HOMEPAGELINK, "#") .Replace(HtmlPageDecorator.PREVIOUSPAGELINK, "#") .Replace(HtmlPageDecorator.NEXTPAGELINK, "#"); string footer = Decorator.FooterHtmlCode.Replace(HtmlPageDecorator.HOMEPAGELINK, "#") .Replace(HtmlPageDecorator.PREVIOUSPAGELINK, "#") .Replace(HtmlPageDecorator.NEXTPAGELINK, "#"); // Create standard replacements: Replacements replacements = new Replacements(); replacements.Add("%BOOLFULLSEARCH%", Project.FullTextSearch ? "true" : "false"); replacements.Add("%TITLE%", HttpUtility.HtmlEncode(Project.HelpTitle)); replacements.Add("%TREE%", CreateHtmlTree("contentsTree", "contentTree")); replacements.Add("%TOPICS%", GenerateWebIndex()); replacements.Add("%FIRSTPAGEURL%", Document.FirstNodeWithContent.Href); replacements.Add("%FIRSTPAGECONTENT%", Document.FirstSplittedContent); replacements.Add("%WEBDESCRIPTION%", Decorator.MetaDescriptionTag); replacements.Add("%KEYWORDS%", Decorator.MetaKeywordsTag); replacements.Add("%HEADER%", header); replacements.Add("%FOOTER%", footer); replacements.Add("%HEADINCLUDE%", Decorator.HeadIncludeHtmlCode); // Load translation files. string translationFile = Path.Combine(System.Windows.Forms.Application.StartupPath, "webTranslations"); translationFile = Path.Combine(translationFile, Project.WebLanguage + ".txt"); try { replacements.AddReplacementsFromFile(translationFile); } catch (Exception ex) { UI.Log("Error opening web translations file" + translationFile + ": " + ex.Message, ChmLogLevel.ERROR); UI.Log(ex); } return(replacements); }