public bool ExportReversalIndex(PublicationInformation projInfo) { if (projInfo.IsReversalExist) { var revFile = Common.PathCombine(projInfo.ProjectPath, "FlexRev.xhtml"); if (!File.Exists(revFile)) { return false; } if (File.Exists(revFile)) { if (Common.UnixVersionCheck()) { Common.RemoveDTDForLinuxProcess(revFile, "xelatex"); } } projInfo.DefaultXhtmlFileWithPath = revFile; PreExportProcess preProcessor = new PreExportProcess(projInfo); preProcessor.SetLangforLetter(projInfo.DefaultXhtmlFileWithPath); CheckFontFamilyAvailable(projInfo.DefaultRevCssFileWithPath); Dictionary<string, Dictionary<string, string>> cssClass = new Dictionary<string, Dictionary<string, string>>(); CssTree cssTree = new CssTree(); cssTree.OutputType = Common.OutputType.XELATEX; cssClass = cssTree.CreateCssProperty(projInfo.DefaultRevCssFileWithPath, true); string fileNameXhtml = Path.GetFileNameWithoutExtension(revFile); string xeLatexRevesalIndexFile = Common.PathCombine(projInfo.ProjectPath, fileNameXhtml + ".tex"); _reversalIndexTexFileName = xeLatexRevesalIndexFile; StreamWriter xeLatexFile = new StreamWriter(xeLatexRevesalIndexFile); Dictionary<string, List<string>> classInlineStyle = new Dictionary<string, List<string>>(); XeLaTexStyles xeLaTexStyles = new XeLaTexStyles(); xeLaTexStyles.LangFontDictionary = _langFontCodeandName; classInlineStyle = xeLaTexStyles.CreateXeTexStyles(projInfo, xeLatexFile, cssClass); int pageWidth = Common.GetPictureWidth(cssClass, projInfo.ProjectInputType); XeLaTexContent xeLaTexContent = new XeLaTexContent(); xeLaTexContent.IsUnix = _isUnixOs; Dictionary<string, List<string>> classInlineText = xeLaTexStyles._classInlineText; Dictionary<string, Dictionary<string, string>> newProperty = xeLaTexContent.CreateContent(projInfo, cssClass, xeLatexFile, classInlineStyle, cssTree .SpecificityClass, cssTree .CssClassOrder, classInlineText, pageWidth); _xelatexDocumentOpenClosedRequired = true; //Don't change the place. CloseDocument(xeLatexFile, false, string.Empty); string include = xeLaTexStyles.PageStyle.ToString(); ModifyXeLaTexStyles modifyXeLaTexStyles = new ModifyXeLaTexStyles(); modifyXeLaTexStyles.XelatexDocumentOpenClosedRequired = true; modifyXeLaTexStyles.ProjectType = projInfo.ProjectInputType; bool createPageNumber = false; if (projInfo.DefaultXhtmlFileWithPath.IndexOf("PreserveFlexRev.xhtml") > 0) createPageNumber = true; modifyXeLaTexStyles.ModifyStylesXML(projInfo.ProjectPath, xeLatexFile, newProperty, cssClass, xeLatexRevesalIndexFile, include, _langFontCodeandName, createPageNumber); _xeLaTexPropertyFullFontStyleList = modifyXeLaTexStyles.XeLaTexPropertyFontStyleList; if (newProperty.ContainsKey("TableofContent") && newProperty["TableofContent"].Count > 0) { foreach (var tocSection in newProperty["TableofContent"]) { if (tocSection.Key.Contains("PageStock")) { _tocPropertyList.Add(tocSection.Key, tocSection.Value); } } } return true; } return false; }
private void ExportProcess(string file) { string input = FileInput(file + ".xhtml"); _projInfo.DefaultXhtmlFileWithPath = input; _langFontCodeandName = new Dictionary<string, string>(); GetXhtmlFileFontCodeandFontName(_projInfo.DefaultXhtmlFileWithPath); input = FileInput(file + ".css"); _projInfo.DefaultCssFileWithPath = input; _projInfo.TempOutputFolder = _outputPath; _projInfo.OutputExtension = ".tex"; Dictionary<string, Dictionary<string, string>> cssClass = new Dictionary<string, Dictionary<string, string>>(); CssTree cssTree = new CssTree(); cssTree.OutputType = Common.OutputType.XELATEX; cssClass = cssTree.CreateCssProperty(input, true); int pageWidth = Common.GetPictureWidth(cssClass, _projInfo.ProjectInputType); string xetexFullFile = Common.PathCombine(_outputPath, file + ".tex"); StreamWriter xetexFile = new StreamWriter(xetexFullFile); XeLaTexStyles styles = new XeLaTexStyles(); _classInlineStyle = styles.CreateXeTexStyles(_projInfo, xetexFile, cssClass); XeLaTexContent content = new XeLaTexContent(); Dictionary<string, List<string>> classInlineText = styles._classInlineText; Dictionary<string, Dictionary<string, string>> newProperty = content.CreateContent(_projInfo, cssClass, xetexFile, _classInlineStyle, cssTree.SpecificityClass, cssTree.CssClassOrder, classInlineText, pageWidth); CloseFile(xetexFile); ModifyXeLaTexStyles modifyXeTexStyles = new ModifyXeLaTexStyles(); modifyXeTexStyles.ModifyStylesXML(_projInfo.ProjectPath, xetexFile, newProperty, cssClass, xetexFullFile, string.Empty, _langFontCodeandName,true); }
private void ProcessWrittingStyles(PublicationInformation projInfo, ModifyXeLaTexStyles modifyXeLaTexStyles, Dictionary<string, Dictionary<string, string>> newProperty, StreamWriter xeLatexFile, Dictionary<string, Dictionary<string, string>> cssClass, string xeLatexFullFile, string include) { modifyXeLaTexStyles.XelatexDocumentOpenClosedRequired = false; _xelatexDocumentOpenClosedRequired = false; modifyXeLaTexStyles.ProjectType = projInfo.ProjectInputType; if (newProperty.ContainsKey("TableofContent") && newProperty["TableofContent"].Count > 0) { foreach (var tocSection in _tocPropertyList) { if (tocSection.Key.Contains("PageStock")) { newProperty["TableofContent"].Add(tocSection.Key, tocSection.Value); } } } modifyXeLaTexStyles.XeLaTexPropertyFontStyleList = _xeLaTexPropertyFullFontStyleList; modifyXeLaTexStyles.ModifyStylesXML(projInfo.ProjectPath, xeLatexFile, newProperty, cssClass, xeLatexFullFile, include, _langFontCodeandName, true); }