Ejemplo n.º 1
0
        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;
        }
Ejemplo n.º 2
0
 public void XelatexXhtmlFileDivLetterAddingLangAttributeTest()
 {
     string filename = "XelatexXhtmlFileDivLetterAddingLangAttribute.xhtml";
     string input = GetFileNameWithPath(filename);
     PublicationInformation projInfo = new PublicationInformation();
     projInfo.DefaultXhtmlFileWithPath = input;
     preExportProcess = new PreExportProcess(projInfo);
     string expected = GetFileNameWithExpectedPath(filename);
     string outputFile = GetFileNameWithOutputPath(filename);
     File.Copy(projInfo.DefaultXhtmlFileWithPath, outputFile, true);
     string output = preExportProcess.SetLangforLetter(outputFile);
     XmlAssert.AreEqual(expected, output, "");
 }
Ejemplo n.º 3
0
        private void ExportPreprocessForXelatex(PublicationInformation projInfo, PreExportProcess preProcessor)
        {
            if (_isUnixOs)
            {
                Common.RemoveDTDForLinuxProcess(projInfo.DefaultXhtmlFileWithPath, "xelatex");
            }
            preProcessor.SetLangforLetter(projInfo.DefaultXhtmlFileWithPath);
            preProcessor.XelatexImagePreprocess();

            if (_inputType.ToLower() == "dictionary" && projInfo.ProjectInputType.ToLower() == "dictionary")
            {
                Common.ApplyXslt(projInfo.DefaultXhtmlFileWithPath, _xhtmlXelatexXslProcess);
            }
        }