protected void SetUp() { _InsertMacro = new InInsertMacro(); _cssTree = new CssTree(); _testFolderPath = PathPart.Bin(Environment.CurrentDirectory, "/InDesignConvert/TestFiles"); }
/// <summary> /// Convert XHTML to ODT /// </summary> public bool Export(PublicationInformation projInfo) { PreExportProcess preProcessor = new PreExportProcess(projInfo); preProcessor.GetTempFolderPath(); preProcessor.InsertEmptyHeadwordForReversal(preProcessor.ProcessedXhtml); MergeProcessInXHTMLforMasterPage(preProcessor.ProcessedXhtml); preProcessor.PreserveSpace(); preProcessor.ImagePreprocess(true); preProcessor.ReplaceInvalidTagtoSpan("_AllComplexFormEntryBackRefs|LexEntryRef_PrimaryLexemes", "span"); preProcessor.InsertHiddenChapterNumber(); preProcessor.InsertHiddenVerseNumber(); preProcessor.GetDefinitionLanguage(); var exportTitle = GetExportTitle(); string fileName = exportTitle.ToString(); if (exportTitle.ToString() == string.Empty) { fileName = Path.GetFileNameWithoutExtension(projInfo.DefaultXhtmlFileWithPath); } projInfo.DefaultXhtmlFileWithPath = preProcessor.ProcessedXhtml; projInfo.DefaultCssFileWithPath = preProcessor.ProcessedCss; projInfo.ProjectPath = Path.GetDirectoryName(preProcessor.ProcessedXhtml); Dictionary <string, Dictionary <string, string> > cssClass = new Dictionary <string, Dictionary <string, string> >(); CssTree cssTree = new CssTree(); cssClass = cssTree.CreateCssProperty(projInfo.DefaultCssFileWithPath, true); cssClass = MergeProcessInCSSforMasterPage(projInfo.DefaultCssFileWithPath, cssClass); preProcessor.InsertEmptyXHomographNumber(cssClass); //To insert the variable for macro use InInsertMacro insertMacro = new InInsertMacro(); insertMacro.InsertMacroVariable(projInfo, cssClass); Dictionary <string, Dictionary <string, string> > idAllClass = new Dictionary <string, Dictionary <string, string> >(); InStyles inStyles = new InStyles(); idAllClass = inStyles.CreateIDStyles(Common.PathCombine(projInfo.TempOutputFolder, "Resources"), cssClass); InGraphic inGraphic = new InGraphic(); inGraphic.CreateIDGraphic(Common.PathCombine(projInfo.TempOutputFolder, "Resources"), cssClass, cssTree.cssBorderColor); InStory inStory = new InStory(); Dictionary <string, ArrayList> StyleName = inStory.CreateStory(projInfo, idAllClass, cssTree.SpecificityClass, cssTree.CssClassOrder); InMasterSpread inMasterSpread = new InMasterSpread(); ArrayList masterPageNames = inMasterSpread.CreateIDMasterSpread(Common.PathCombine(projInfo.TempOutputFolder, "MasterSpreads"), idAllClass, StyleName["TextVariables"]); InSpread inSpread = new InSpread(); inSpread.CreateIDSpread(Common.PathCombine(projInfo.TempOutputFolder, "Spreads"), idAllClass, StyleName["ColumnClass"]); InDesignMap inDesignMap = new InDesignMap(); inDesignMap.CreateIDDesignMap(projInfo.TempOutputFolder, StyleName["ColumnClass"].Count, masterPageNames, StyleName["TextVariables"], StyleName["CrossRef"], projInfo.ProjectInputType); InMetaData inMetaData = new InMetaData(); inMetaData.SetDateTimeinMetaDataXML(projInfo.TempOutputFolder); InPreferences inPreferences = new InPreferences(); inPreferences.CreateIDPreferences(Common.PathCombine(projInfo.TempOutputFolder, "Resources"), idAllClass); SubProcess.AfterProcess(projInfo.ProjectFileWithPath); fileName = Common.ReplaceSymbolToUnderline(fileName); string ldmlFullName = Common.PathCombine(projInfo.DictionaryPath, fileName + ".idml"); Compress(projInfo.TempOutputFolder, ldmlFullName); Common.CleanupExportFolder(ldmlFullName, ".tmp,.de", "layout.css", String.Empty); CreateRAMP(projInfo); Common.CleanupExportFolder(ldmlFullName, ".css,.xhtml,.xml", String.Empty, String.Empty); if (projInfo.IsOpenOutput) { Launch(ldmlFullName); } return(true); }
/// <summary> /// Convert XHTML to ODT /// </summary> public bool Export(PublicationInformation projInfo) { PreExportProcess preProcessor = new PreExportProcess(projInfo); preProcessor.GetTempFolderPath(); preProcessor.InsertEmptyHeadwordForReversal(preProcessor.ProcessedXhtml); MergeProcessInXHTMLforMasterPage(preProcessor.ProcessedXhtml); preProcessor.PreserveSpace(); preProcessor.ImagePreprocess(true); preProcessor.ReplaceInvalidTagtoSpan("_AllComplexFormEntryBackRefs|LexEntryRef_PrimaryLexemes", "span"); preProcessor.InsertHiddenChapterNumber(); preProcessor.InsertHiddenVerseNumber(); preProcessor.GetDefinitionLanguage(); var exportTitle = GetExportTitle(); string fileName = exportTitle.ToString(); if (exportTitle.ToString() == string.Empty) { fileName = Path.GetFileNameWithoutExtension(projInfo.DefaultXhtmlFileWithPath); } projInfo.DefaultXhtmlFileWithPath = preProcessor.ProcessedXhtml; projInfo.DefaultCssFileWithPath = preProcessor.ProcessedCss; projInfo.ProjectPath = Path.GetDirectoryName(preProcessor.ProcessedXhtml); Dictionary<string, Dictionary<string, string>> cssClass = new Dictionary<string, Dictionary<string, string>>(); CssTree cssTree = new CssTree(); cssClass = cssTree.CreateCssProperty(projInfo.DefaultCssFileWithPath, true); cssClass = MergeProcessInCSSforMasterPage(projInfo.DefaultCssFileWithPath, cssClass); preProcessor.InsertEmptyXHomographNumber(cssClass); //To insert the variable for macro use InInsertMacro insertMacro = new InInsertMacro(); insertMacro.InsertMacroVariable(projInfo, cssClass); Dictionary<string, Dictionary<string, string>> idAllClass = new Dictionary<string, Dictionary<string, string>>(); InStyles inStyles = new InStyles(); idAllClass = inStyles.CreateIDStyles(Common.PathCombine(projInfo.TempOutputFolder, "Resources"), cssClass); InGraphic inGraphic = new InGraphic(); inGraphic.CreateIDGraphic(Common.PathCombine(projInfo.TempOutputFolder, "Resources"), cssClass, cssTree.cssBorderColor); InStory inStory = new InStory(); Dictionary<string, ArrayList> StyleName = inStory.CreateStory(projInfo, idAllClass, cssTree.SpecificityClass, cssTree.CssClassOrder); InMasterSpread inMasterSpread = new InMasterSpread(); ArrayList masterPageNames = inMasterSpread.CreateIDMasterSpread(Common.PathCombine(projInfo.TempOutputFolder, "MasterSpreads"), idAllClass, StyleName["TextVariables"]); InSpread inSpread = new InSpread(); inSpread.CreateIDSpread(Common.PathCombine(projInfo.TempOutputFolder, "Spreads"), idAllClass, StyleName["ColumnClass"]); InDesignMap inDesignMap = new InDesignMap(); inDesignMap.CreateIDDesignMap(projInfo.TempOutputFolder, StyleName["ColumnClass"].Count, masterPageNames, StyleName["TextVariables"], StyleName["CrossRef"], projInfo.ProjectInputType); InMetaData inMetaData = new InMetaData(); inMetaData.SetDateTimeinMetaDataXML(projInfo.TempOutputFolder); InPreferences inPreferences = new InPreferences(); inPreferences.CreateIDPreferences(Common.PathCombine(projInfo.TempOutputFolder, "Resources"), idAllClass); SubProcess.AfterProcess(projInfo.ProjectFileWithPath); fileName = Common.ReplaceSymbolToUnderline(fileName); string ldmlFullName = Common.PathCombine(projInfo.DictionaryPath, fileName + ".idml"); Compress(projInfo.TempOutputFolder, ldmlFullName); Common.CleanupExportFolder(ldmlFullName, ".tmp,.de", "layout.css", String.Empty); CreateRAMP(projInfo); Common.CleanupExportFolder(ldmlFullName, ".css,.xhtml,.xml", String.Empty, String.Empty); if (projInfo.IsOpenOutput) Launch(ldmlFullName); return true; }