/// <summary> /// Generates the manifest and metadata information file used by the .epub reader /// (content.opf). For more information, refer to <see cref="http://www.idpf.org/doc_library/epub/OPF_2.0.1_draft.htm#Section2.0"/> /// </summary> /// <param name="projInfo">Project information</param> /// <param name="contentFolder">Content folder (.../OEBPS)</param> /// <param name="bookId">Unique identifier for the book we're generating.</param> public void CreateOpf(PublicationInformation projInfo, string contentFolder, Guid bookId) { XmlWriter opf = XmlWriter.Create(Common.PathCombine(contentFolder, "content.opf")); opf.WriteStartDocument(); // package name opf.WriteStartElement("package", "http://www.idpf.org/2007/opf"); opf.WriteAttributeString("version", "2.0"); opf.WriteAttributeString("unique-identifier", "BookId"); // metadata - items defined by the Dublin Core Metadata Initiative: Metadata(projInfo, bookId, opf); StartManifest(opf); if (_parent.EmbedFonts) { ManifestFontEmbed(opf); } string[] files = Directory.GetFiles(contentFolder); ManifestContent(opf, files, "epub2"); Spine(opf, files); Guide(projInfo, opf, files, "epub2"); opf.WriteEndElement(); // package opf.WriteEndDocument(); opf.Close(); }
protected void SetUpAll() { Common.Testing = true; Common.ProgInstall = PathPart.Bin(Environment.CurrentDirectory, @"/../../DistFiles"); Common.SupportFolder = ""; Common.ProgBase = Common.ProgInstall; _isLinux = Common.IsUnixOS(); _projInfo = new PublicationInformation(); string testPath = PathPart.Bin(Environment.CurrentDirectory, "/XeLatex/TestFiles"); _inputPath = Common.PathCombine(testPath, "input"); _outputPath = Common.PathCombine(testPath, "output"); if (_isLinux) { _expectedPath = Common.PathCombine(testPath, "LinuxExpected"); } else { _expectedPath = Common.PathCombine(testPath, "Expected"); } if (Directory.Exists(_outputPath)) Directory.Delete(_outputPath, true); Directory.CreateDirectory(_outputPath); _projInfo.ProjectPath = testPath; _classInlineStyle = new Dictionary<string, List<string>>(); string pathwayDirectory = PathwayPath.GetPathwayDir(); string styleSettingFile = Common.PathCombine(pathwayDirectory, "StyleSettings.xml"); ValidateXMLVersion(styleSettingFile); Common.ProgInstall = pathwayDirectory; Param.LoadSettings(); Param.SetValue(Param.InputType, "Scripture"); Param.LoadSettings(); }
public static bool Launch(string type, PublicationInformation publicationInformation) { string xhtmlFile = publicationInformation.DefaultXhtmlFileWithPath; CreateVerbose(publicationInformation); var localType = type.Replace(@"\", "/").ToLower(); try { foreach (IExportProcess process in _backend) { if (process.ExportType.ToLower() == "openoffice/libreoffice") localType = OpenOfficeClassifier(publicationInformation, localType); // Cross checking for OpenOffice if (process.ExportType.ToLower() == localType.ToLower()) return process.Export(publicationInformation); } } catch(Exception ex) { throw new Exception(ex.Message); } finally { publicationInformation.DefaultXhtmlFileWithPath = xhtmlFile; ShowVerbose(publicationInformation); } return false; }
private string SourceTargetFile(PublicationInformation projInfo) { string sourceFile = ""; sourceFile = projInfo.DefaultXhtmlFileWithPath.Replace(".xhtml", "_1.xhtml"); File.Copy(projInfo.DefaultXhtmlFileWithPath, sourceFile, true); return sourceFile; }
protected void SetUp() { Common.Testing = true; //_styleName = new Styles(); //_util = new Utility(); _projInfo = new PublicationInformation(); _errorFile = Common.PathCombine(Path.GetTempPath(), "temp.odt"); _progressBar = new ProgressBar(); string testPath = PathPart.Bin(Environment.CurrentDirectory, "/OpenOfficeConvert/TestFiles"); _inputPath = Common.PathCombine(testPath, "input"); _outputPath = Common.PathCombine(testPath, "output"); _expectedPath = Common.PathCombine(testPath, "expected"); //if (Directory.Exists(_outputPath)) //{ // Directory.Delete(_outputPath, true); //} Common.DeleteDirectory(_outputPath); Directory.CreateDirectory(_outputPath); FolderTree.Copy(FileInput("Pictures"), FileOutput("Pictures")); _projInfo.ProgressBar = _progressBar; _projInfo.OutputExtension = "odt"; _projInfo.ProjectInputType = "Dictionary"; _projInfo.IsFrontMatterEnabled = false; _projInfo.FinalOutput = "odt"; Common.SupportFolder = ""; Common.ProgInstall = PathPart.Bin(Environment.CurrentDirectory, "/../../DistFIles"); Common.ProgBase = PathPart.Bin(Environment.CurrentDirectory, "/../../DistFiles"); // for masterDocument _styleFile = "styles.xml"; _contentFile = "content.xml"; _isLinux = Common.IsUnixOS(); }
protected void SetUpAll() { Common.Testing = true; Common.ProgInstall = PathPart.Bin(Environment.CurrentDirectory, @"/../../DistFiles"); Common.SupportFolder = ""; Common.ProgBase = Common.ProgInstall; _projInfo = new PublicationInformation(); _testFolderPath = PathPart.Bin(Environment.CurrentDirectory, "/OpenOfficeConvert/TestFiles"); _inputPath = Common.PathCombine(_testFolderPath, "input"); _outputPath = Common.PathCombine(_testFolderPath, "output"); _expectedPath = Common.PathCombine(_testFolderPath, "expected"); if (Directory.Exists(_outputPath)) Directory.Delete(_outputPath, true); Directory.CreateDirectory(_outputPath); _projInfo.ProjectPath = _testFolderPath; _projInfo.OutputExtension = "odt"; string pathwayDirectory = PathwayPath.GetPathwayDir(); string styleSettingFile = Common.PathCombine(pathwayDirectory, "StyleSettings.xml"); ValidateXMLVersion(styleSettingFile); Common.ProgInstall = pathwayDirectory; Param.LoadSettings(); Param.SetValue(Param.InputType, "Scripture"); Param.LoadSettings(); }
private void InitializeData(PublicationInformation projInfo, Dictionary<string, Dictionary<string, string>> idAllClass, Dictionary<string, ArrayList> classFamily, ArrayList cssClassOrder) { _outputExtension = projInfo.OutputExtension; _allStyle = new Stack<string>(); _allParagraph = new Stack<string>(); _allCharacter = new Stack<string>(); _childStyle = new Dictionary<string, string>(); IdAllClass = new Dictionary<string, Dictionary<string, string>>(); ParentClass = new Dictionary<string, string>(); _newProperty = new Dictionary<string, Dictionary<string, string>>(); _displayBlock = new Dictionary<string, string>(); _cssClassOrder = cssClassOrder; _sourcePicturePath = Path.GetDirectoryName(projInfo.DefaultXhtmlFileWithPath); _projectPath = projInfo.TempOutputFolder; IdAllClass = idAllClass; _classFamily = classFamily; _isNewParagraph = false; _characterName = "None"; }
/// <summary> /// Entry point for epub 3 converter /// </summary> /// <param name="projInfo">values passed including epub2 exported files and changed to epub3 support</param> /// <returns>true if succeeds</returns> public bool Export(PublicationInformation projInfo) { bool epub3Export = false; string oebpsPath = Common.PathCombine(Epub3Directory, "OEBPS"); string cssFile = Common.PathCombine(oebpsPath, "book.css"); var preProcessor = new PreExportProcess(); preProcessor.ReplaceStringInFile(cssFile, "{direction:ltr}", "{direction:ltr;}"); preProcessor.ReplaceStringInFile(cssFile, "direction:", "dir:"); //preProcessor.RemoveStringInCss(cssFile, "direction:"); var xhmltohtml5Space = Loadxhmltohtml5Xslt(projInfo.ProjectInputType.ToLower()); Convertxhtmltohtml5(oebpsPath, xhmltohtml5Space); ModifyContainerXML(); ModifyContentOPF(projInfo, oebpsPath); ModifyTocContent(oebpsPath); ModifyCoverpage(oebpsPath); epub3Export = true; return epub3Export; }
public void InsertMacroVariable(PublicationInformation projInfo, IDictionary<string, Dictionary<string, string>> cssClass) { var textContent = new StringBuilder(); ArrayList insertVariable = new ArrayList(); if (projInfo.ProjectInputType == null) projInfo.ProjectInputType = "Dictionary"; //TODO _cssClass = cssClass; //Create and copy file to temp folder supportFileFolder = Common.PathCombine(Common.GetPSApplicationPath(), "InDesignFiles" + Path.DirectorySeparatorChar + projInfo.ProjectInputType); projInfo.TempOutputFolder = Common.PathCombine(Path.GetTempPath(), "InDesignFiles" + Path.DirectorySeparatorChar + projInfo.ProjectInputType); CopyFolderWithFiles(supportFileFolder, projInfo.TempOutputFolder); //Same macro is used for dictionary and scripture var scriptsFolder = Common.PathCombine(Common.GetPSApplicationPath(), "InDesignFiles/Dictionary/Scripts"); CopyFolderWithFiles(scriptsFolder, Common.PathCombine(projInfo.TempOutputFolder, "scripts")); strMacroPath = Common.PathCombine(projInfo.TempOutputFolder, "Scripts/Startup Scripts/PlaceFrames.jsx"); ReadFile(false, textContent); insertVariable.Add(GetColumnRule()); insertVariable.Add(GetBorderRule()); insertVariable.Add(GetMarginValue()); insertVariable.Add(GetCropMarks()); insertVariable.Add(GetIndexTab(projInfo.ProjectInputType)); WriteFile(textContent, insertVariable); CopySupportFolder(projInfo); //Copy pictures to IndesignFiles folder (inside Stories folder) var pictureFolder = Common.PathCombine(projInfo.DictionaryPath, "Pictures"); if (File.Exists(pictureFolder)) CopyFolderWithFiles(pictureFolder, Common.PathCombine(projInfo.TempOutputFolder, "Pictures")); }
public void RemoveAfterBefore(PublicationInformation projInfo, Dictionary<string, Dictionary<string, string>> idAllClass, Dictionary<string, ArrayList> classFamily, ArrayList cssClassOrder) { InitializeData(projInfo, idAllClass, classFamily, cssClassOrder); string sourceFile = SourceTargetFile(projInfo); OpenXhtmlFile(sourceFile); //reader CreateFile(projInfo); //writer InsertBeforeAfter(); }
private string SourceTargetFile(PublicationInformation projInfo) { string sourceFile = ""; sourceFile = projInfo.DefaultXhtmlFileWithPath.Replace(".xhtml", "_1.xhtml"); File.Copy(projInfo.DefaultXhtmlFileWithPath, sourceFile, true); return(sourceFile); }
protected static XmlDocument LoadXmlDocument(PublicationInformation projInfo) { var xml = new XmlDocument {XmlResolver = FileStreamXmlResolver.GetNullResolver()}; var streamReader = new StreamReader(projInfo.DefaultXhtmlFileWithPath); xml.Load(streamReader); streamReader.Close(); return xml; }
public string[] InitializeLangArray(PublicationInformation projInfo) { _langFontDictionary = new Dictionary<string, string>(); _embeddedFonts = new Dictionary<string, EmbeddedFont>(); BuildLanguagesList(projInfo.DefaultXhtmlFileWithPath); var langArray = new string[_langFontDictionary.Keys.Count]; _langFontDictionary.Keys.CopyTo(langArray, 0); return langArray; }
public void RemoveAfterBefore(PublicationInformation projInfo, Dictionary <string, Dictionary <string, string> > idAllClass, Dictionary <string, ArrayList> classFamily, ArrayList cssClassOrder) { InitializeData(projInfo, idAllClass, classFamily, cssClassOrder); string sourceFile = SourceTargetFile(projInfo); OpenXhtmlFile(sourceFile); //reader CreateFile(projInfo); //writer InsertBeforeAfter(); }
private static void ShowVerbose(PublicationInformation publicationInformation) { if (verboseClass.ErrorCount > 0) { verboseClass.Close(); string errFileName = Path.GetFileNameWithoutExtension(publicationInformation.DefaultXhtmlFileWithPath) + "_err.html"; Common.OpenOutput(errFileName); } }
public DictionaryForMidsProperties(PublicationInformation projInfo, DictionaryForMIDsStyle contentStyles) { var myPath = Path.GetDirectoryName(projInfo.DefaultXhtmlFileWithPath); Debug.Assert(myPath != null); _styles = contentStyles; Sw = new StreamWriter(Common.PathCombine(myPath, "DictionaryForMIDs.properties")); DictionaryAbbreviation = "SIL"; Language1NumberOfContentDeclarations = _styles.NumStyles; }
public void AddHeadwordWithPicturePresentTest() { PublicationInformation projInfo = new PublicationInformation(); projInfo.DefaultXhtmlFileWithPath = _testFiles.Input("hornbill.xhtml"); var input = new DictionaryForMIDsInput(projInfo); var sense = input.SelectNodes("//*[@class = 'entry']//*[@id]")[0]; var rec = new DictionaryForMIDsRec(); rec.AddHeadword(sense); Assert.AreEqual("dagol ", rec.Rec); }
private static void CreateVerbose(PublicationInformation publicationInformation) { verboseClass = VerboseClass.GetInstance(); verboseClass.ErrorCount = 0; // reset to zero for every launch if (!File.Exists(publicationInformation.DefaultCssFileWithPath)) { verboseClass.ErrorFileName = Path.GetFileNameWithoutExtension(publicationInformation.DefaultXhtmlFileWithPath) + "_err.html"; verboseClass.WriteError("", "", publicationInformation.DefaultCssFileWithPath + " Css file is missing", ""); } }
public void GoBibleRearrangeVerseAlphaNumericTest() { string filename = "GoBibleRearrangeVerseAlphaNumeric.xhtml"; string input = GetFileNameWithPath(filename); PublicationInformation projInfo = new PublicationInformation(); projInfo.DefaultXhtmlFileWithPath = input; preExportProcess = new PreExportProcess(projInfo); string expected = GetFileNameWithExpectedPath(filename); string output = preExportProcess.GoBibleRearrangeVerseNumbers(projInfo.DefaultXhtmlFileWithPath); XmlAssert.AreEqual(expected, output, ""); }
protected void SetUp() { _doc = Common.DeclareXMLDocument(false); _target = new PublicationInformation(); actualDocument = Common.DeclareXMLDocument(false); LoadInputDocument("Dictionary1.de"); var outputPath = Common.PathCombine(GetTestPath(), "Output"); if (Directory.Exists(outputPath)) Directory.Delete(outputPath, true); Directory.CreateDirectory(outputPath); Common.Testing = true; }
/// ------------------------------------------------------------------------------------------- /// <summary> /// Generate Meta.xml /// /// <list> /// </list> /// </summary> /// <param name="projInfo">projInfo</param> /// <returns>None </returns> /// ------------------------------------------------------------------------------------------- public void CreateMeta(PublicationInformation projInfo) { try { _metaDataDic = Common.GetMetaData(_projectInputType, string.Empty); CreateFile(projInfo.TempOutputFolder); CloseFile(); } catch (Exception) { throw; } }
public Dictionary<string, ArrayList> CreateStory(PublicationInformation projInfo, Dictionary<string, Dictionary<string, string>> idAllClass, Dictionary<string, ArrayList> classFamily, ArrayList cssClassOrder) { _projInfo = projInfo; Common.PathCombine(projInfo.DictionaryPath, "Pictures"); InitializeData(Common.PathCombine(projInfo.TempOutputFolder, "Stories"), idAllClass, classFamily, cssClassOrder); ProcessCounterProperty(); OpenXhtmlFile(projInfo.DefaultXhtmlFileWithPath); ProcessXHTML(projInfo.DefaultXhtmlFileWithPath); UpdateRelativeInStylesXML(); CloseFile(); SetColumnValue(); return _styleName; }
private static string OpenOfficeClassifier(PublicationInformation publicationInformation, string type) { if (type.ToLower().IndexOf("libreoffice") >= 0) { publicationInformation.FinalOutput = "odt"; if (type.ToLower().IndexOf("pdf") >= 0) { publicationInformation.FinalOutput = "pdf"; } type = "openoffice/libreoffice"; } return(type); }
public void AddStyleTagTest() { PublicationInformation projInfo = new PublicationInformation(); projInfo.DefaultXhtmlFileWithPath = _testFiles.Input("sena3-imba.xhtml"); projInfo.DefaultCssFileWithPath = _testFiles.Input("sena3-imba.css"); var cssTree = new CssTree(); CssClass = cssTree.CreateCssProperty(projInfo.DefaultCssFileWithPath, true); var ContentStyles = new DictionaryForMIDsStyle(); var rec = new DictionaryForMIDsRec {CssClass = CssClass, Styles = ContentStyles}; var input = new DictionaryForMIDsInput(projInfo); var node = input.SelectNodes("//*[@class = 'partofspeech']//text()")[0]; rec.AddStyleTag(node); Assert.AreEqual(2, ContentStyles.NumStyles); }
public void AddAfterTest() { PublicationInformation projInfo = new PublicationInformation(); projInfo.DefaultXhtmlFileWithPath = _testFiles.Input("sena3-ipa.xhtml"); projInfo.DefaultCssFileWithPath = _testFiles.Input("sena3-ipa.css"); var cssTree = new CssTree(); CssClass = cssTree.CreateCssProperty(projInfo.DefaultCssFileWithPath, true); var ContentStyles = new DictionaryForMIDsStyle(); var rec = new DictionaryForMIDsRec { CssClass = CssClass, Styles = ContentStyles }; var input = new DictionaryForMIDsInput(projInfo); var node = input.SelectNodes("//*[@class = 'xsensenumber']")[0]; rec.AddAfter(node); Assert.AreEqual(") ", rec.Rec); }
protected void SetUpAll() { Common.Testing = true; _projInfo = new PublicationInformation(); _testFolderPath = PathPart.Bin(Environment.CurrentDirectory, "/PdfConvert/TestFiles"); _inputPath = Common.PathCombine(_testFolderPath, "input"); _outputPath = Common.PathCombine(_testFolderPath, "output"); _expectedPath = Common.PathCombine(_testFolderPath, "Expected"); const bool recursive = true; if (Directory.Exists(_outputPath)) Directory.Delete(_outputPath, recursive); Directory.CreateDirectory(_outputPath); _projInfo.ProjectPath = _testFolderPath; Common.SupportFolder = ""; }
public void AddStyleTagLangTest() { PublicationInformation projInfo = new PublicationInformation(); projInfo.DefaultXhtmlFileWithPath = _testFiles.Input("wasp.xhtml"); projInfo.DefaultCssFileWithPath = _testFiles.Input("wasp.css"); var cssTree = new CssTree(); CssClass = cssTree.CreateCssProperty(projInfo.DefaultCssFileWithPath, true); var ContentStyles = new DictionaryForMIDsStyle(); var rec = new DictionaryForMIDsRec { CssClass = CssClass, Styles = ContentStyles }; var input = new DictionaryForMIDsInput(projInfo); var node = input.SelectNodes("(//*[@class='xitem'])/*")[1]; rec.AddStyleTag(node); Assert.AreEqual(2, ContentStyles.NumStyles); Assert.AreEqual("153,51,102", rec.Styles.FontColor(2)); }
/// <summary> /// Convert XHTML to ODT /// </summary> public bool Export(PublicationInformation projInfo) { string xeLatexFullFile; StreamWriter xeLatexFile; XeLaTexStyles xeLaTexStyles; _xhtmlXelatexXslProcess.Load(XmlReader.Create(Common.UsersXsl("AddBidi.xsl"))); _isUnixOs = Common.IsUnixOS(); _langFontDictionary = new Dictionary<string, string>(); _langFontCodeandName = new Dictionary<string, string>(); string mainXhtmlFileWithPath = projInfo.DefaultXhtmlFileWithPath; projInfo.OutputExtension = "pdf"; var preProcessor = new PreExportProcess(projInfo); ExportPreprocessForXelatex(projInfo, preProcessor); var organization = SettingFrontmatter(); BuildLanguagesList(projInfo.DefaultXhtmlFileWithPath); string fileName = Path.GetFileNameWithoutExtension(projInfo.DefaultXhtmlFileWithPath); AssignExportFile(projInfo, preProcessor); ModifyXeLaTexStyles modifyXeLaTexStyles = new ModifyXeLaTexStyles(); modifyXeLaTexStyles.LangFontDictionary = _langFontCodeandName; Dictionary<string, Dictionary<string, string>> newProperty; var cssClass = WrittingTexFile(projInfo, fileName, out xeLatexFullFile, out xeLatexFile, out xeLaTexStyles, out newProperty); string include = xeLaTexStyles.PageStyle.ToString(); InitilizeXelatexStyle(modifyXeLaTexStyles); if (ExportCopyright(projInfo, mainXhtmlFileWithPath)) { _copyrightTexCreated = true; modifyXeLaTexStyles.CopyrightTexCreated = true; modifyXeLaTexStyles.CopyrightTexFilename = Path.GetFileName(_copyrightTexFileName); } ExportReversalProcess(projInfo, modifyXeLaTexStyles); ProcessWrittingStyles(projInfo, modifyXeLaTexStyles, newProperty, xeLatexFile, cssClass, xeLatexFullFile, include); Dictionary<string, string> imgPath = new Dictionary<string, string>(); if (newProperty.ContainsKey("ImagePath")) { imgPath = newProperty["ImagePath"]; } UpdateXeLaTexFontCacheIfNecessary(); CallXeLaTex(projInfo, xeLatexFullFile, true, imgPath); ProcessRampFile(projInfo, xeLatexFullFile, organization); return true; }
public void ImagePreprocessTest() { string filename = "ImagePreProcess.xhtml"; string input = GetFileNameWithPath(filename); PublicationInformation projInfo = new PublicationInformation(); string expected = GetFileNameWithExpectedPath(filename); string output = GetFileNameWithOutputPath(filename); CopyToOutput(input, output); projInfo.DefaultXhtmlFileWithPath = output; projInfo.ProjectInputType = "Scripture"; preExportProcess = new PreExportProcess(projInfo); output = preExportProcess.ImagePreprocess(false); XmlAssert.AreEqual(expected, output, ""); }
public Dictionary<string, List<string>> CreateXeTexStyles(PublicationInformation projInfo, StreamWriter xetexFile, Dictionary<string, Dictionary<string, string>> cssProperty) { try { _includePackageList = new List<string>(); _inlineText = new List<string>(); _xetexFile = xetexFile; _cssProperty = cssProperty; _projInfo = projInfo; LoadPageStyleFormat(); CreatePageStyle(); CreateStyle(); } catch (Exception ex) { Console.Write(ex.Message); } return _classInlineStyle; }
protected void SetUp() { _doc = new XmlDocument(); _target = new PublicationInformation(); actualDocument = Common.DeclareXMLDocument(false); LoadInputDocument("Dictionary1.de"); _allUserPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); Common.SupportFolder = ""; _outputBasePath = Common.PathCombine(GetTestPath(), "Output"); _inputBasePath = Common.PathCombine(GetTestPath(), "InputFiles"); _expectBasePath = Common.PathCombine(GetTestPath(), "Expected"); //string currentFolder = PathPart.Bin(Environment.CurrentDirectory, "/CssDialog/TestFiles"); //_inputBasePath = Common.PathCombine(currentFolder, "Input"); //_expectBasePath = Common.PathCombine(currentFolder, "Expected"); //_expectBasePath = Common.PathCombine(currentFolder, "Output"); if (Directory.Exists(_outputBasePath)) Directory.Delete(_outputBasePath, true); Directory.CreateDirectory(_outputBasePath); Common.ProgInstall = PathPart.Bin(Environment.CurrentDirectory, @"/../../DistFiles"); Common.Testing = true; }
private void InitializeData(PublicationInformation projInfo, Dictionary <string, Dictionary <string, string> > idAllClass, Dictionary <string, ArrayList> classFamily, ArrayList cssClassOrder) { _allStyle = new Stack <string>(); _allParagraph = new Stack <string>(); _allCharacter = new Stack <string>(); _childStyle = new Dictionary <string, string>(); IdAllClass = new Dictionary <string, Dictionary <string, string> >(); ParentClass = new Dictionary <string, string>(); _newProperty = new Dictionary <string, Dictionary <string, string> >(); _displayBlock = new Dictionary <string, string>(); _cssClassOrder = cssClassOrder; _projectPath = projInfo.TempOutputFolder; IdAllClass = idAllClass; _classFamily = classFamily; _isNewParagraph = false; _characterName = "None"; }
protected void SetUp() { Common.ProgInstall = PathPart.Bin(Environment.CurrentDirectory, @"/../../DistFiles"); Common.SupportFolder = ""; Common.ProgBase = Common.ProgInstall; Common.Testing = true; _projInfo = new PublicationInformation(); string testPath = PathPart.Bin(Environment.CurrentDirectory, "/GoBibleConvert/TestFiles"); _inputPath = Common.PathCombine(testPath, "input"); _outputPath = Common.PathCombine(testPath, "output"); _expectedPath = Common.PathCombine(testPath, "expected"); string pathwayDirectory = PathwayPath.GetPathwayDir(); string styleSettingFile = Common.PathCombine(pathwayDirectory, "StyleSettings.xml"); Common.Testing = true; ValidateXMLVersion(styleSettingFile); InputType = "Scripture"; Common.ProgInstall = pathwayDirectory; Param.LoadSettings(); Param.SetValue(Param.InputType, InputType); Param.LoadSettings(); }
public PreExportProcess(PublicationInformation projInfo) { _xhtmlFileNameWithPath = projInfo.DefaultXhtmlFileWithPath; _baseXhtmlFileNameWithPath = projInfo.DefaultXhtmlFileWithPath; _cssFileNameWithPath = projInfo.DefaultCssFileWithPath; _xhtmlRevFileNameWithPath = string.Empty; _projInfo = projInfo; if (Param.Value.Count > 0 && Common.Testing == false) _projInfo.ProjectInputType = Param.Value[Param.InputType]; // EDB 11/29/2011: removed method to fix invalid xhtml: // - There was only 1 block of code in there to fix a bug that had been fixed in 7.0.4 // - This code gets called A LOT from different exports; the PSExport.Export class is probably // a better place to put this kind of code cleanup, as it only gets called once, before the // backends are launched. //FixInvalidXhtml(); if (AppDomain.CurrentDomain.FriendlyName.ToLower() == "paratext.exe") { HandleTildeSymbolReplace(projInfo.DefaultXhtmlFileWithPath); } }
public Dictionary<string, Dictionary<string, string>> CreateStyles(PublicationInformation projInfo, Dictionary<string, Dictionary<string, string>> cssProperty, string outputFileName) { try { string outputFile = Path.GetFileNameWithoutExtension(projInfo.DefaultXhtmlFileWithPath); string strStylePath = Common.PathCombine(projInfo.TempOutputFolder, outputFileName); _isFromExe = Common.CheckExecutionPath(); _projInfo = projInfo; _cssProperty = cssProperty; HandleSubEntryIndent(); HandleMexioStyleSheet(); if (Param.HyphenEnable) { IsHyphenEnabled = true; } //EnableHyphenation(); GetGuidewordLength(cssProperty); GetHeaderRule(); InitializeObject(outputFile); // Creates new Objects LoadAllProperty(); // Loads all properties LoadSpellCheck(); FixedLineHeightStatus(); GetDefaultFontSize(); CreateODTStyles(strStylePath); CreateCssStyle(); CreatePageStyle(); AddTagStyle(); // Add missing tags in styles.xml (h1,h2,..) CloseODTStyles(); // Close Styles.xml for odt } catch (Exception ex) { Console.Write(ex.Message); } return _LOAllClass; }
public static bool Launch(string type, PublicationInformation publicationInformation) { string xhtmlFile = publicationInformation.DefaultXhtmlFileWithPath; CreateVerbose(publicationInformation); var localType = type.Replace(@"\", "/").ToLower(); try { //Code to call PathwayExport Commandline Utility -commented for now string mainXhtmlFile = Path.GetFileNameWithoutExtension(publicationInformation.DefaultXhtmlFileWithPath); if (mainXhtmlFile.ToLower() == "flexrev") { publicationInformation.IsReversalExist = false; } StringBuilder sb = new StringBuilder(); sb.Append("\""); sb.Append(publicationInformation.DefaultXhtmlFileWithPath); sb.Append(",\" "); sb.Append("\""); sb.Append(publicationInformation.DefaultCssFileWithPath); if (publicationInformation.IsReversalExist) { sb.Append(",\" "); sb.Append("\""); sb.Append(Path.Combine(Path.GetDirectoryName(publicationInformation.DefaultXhtmlFileWithPath), "FlexRev.xhtml")); sb.Append(",\" "); sb.Append("\""); sb.Append(publicationInformation.DefaultRevCssFileWithPath); sb.Append("\""); } else { sb.Append("\""); } Common.SaveInputType(publicationInformation.ProjectInputType); string dbName = Common.IsUnixOS() ? Param.DatabaseName.Replace(" ", "\\ ").Replace("'", "\\'") : Param.DatabaseName; string argument = string.Format("--target \"{0}\" --directory \"{1}\" --files {2} --nunit {3} --database \"{4}\"", type.Replace(@"\", "/").ToLower(), publicationInformation.DictionaryPath, sb.ToString(), Common.Testing.ToString(), dbName); string pathwayExportFile = Path.Combine(Common.GetApplicationPath(), "PathwayExport.exe"); if (!File.Exists(pathwayExportFile)) { pathwayExportFile = Path.Combine(Common.GetApplicationPath(), "Export", "PathwayExport.exe"); } var cmd = Common.IsUnixOS()? "/usr/bin/PathwayExport": pathwayExportFile; if (HasPathwayExportBatchRegistryValueForCurrentUserRegistry()) { var batchFullName = Path.Combine(publicationInformation.DictionaryPath, "PathwayExport.bat"); using (var sw = new StreamWriter(batchFullName)) { sw.WriteLine("\"" + cmd + "\" " + argument); sw.Close(); } MessageBox.Show(@"Batch command written to " + batchFullName + @" since PathwayExportBatch variable present"); if (Common.IsUnixOS()) { SubProcess.Run("", "nautilus", Common.HandleSpaceinLinuxPath(publicationInformation.DictionaryPath), false); } else { SubProcess.Run(publicationInformation.DictionaryPath, "explorer.exe", publicationInformation.DictionaryPath, false); } } else { SubProcess.WindowStyle = ProcessWindowStyle.Minimized; SubProcess.Run(publicationInformation.DictionaryPath, cmd, argument, true); } } catch (Exception ex) { throw new Exception(ex.Message); } finally { publicationInformation.DefaultXhtmlFileWithPath = xhtmlFile; ShowVerbose(publicationInformation); } return(true); }
private void GetRefFormat(PublicationInformation projInfo, Dictionary<string, Dictionary<string, string>> idAllClass) { if (projInfo.ProjectInputType.ToLower() == "scripture") { _refFormat = Common.GetReferenceFormat(idAllClass, _refFormat); } }
private void CreateFile(PublicationInformation projInfo) { _writer = new XmlTextWriter(projInfo.DefaultXhtmlFileWithPath, null); }