/// <summary> /// returns the project name from the path /// </summary> /// <param name="projInfo">data on project</param> /// <returns>Project Name</returns> protected string GetProjectName(IPublicationInformation projInfo) { var scrDir = Path.GetDirectoryName(projInfo.DefaultXhtmlFileWithPath); var projDir = Path.GetDirectoryName(scrDir); return(Path.GetFileName(projDir)); }
public void GetProjectNameTest() { ExportGoBible target = new ExportGoBible(); // TODO: Initialize to an appropriate value IPublicationInformation projInfo = null; // TODO: Initialize to an appropriate value string expected = string.Empty; // TODO: Initialize to an appropriate value string actual; actual = target.GetProjectName(projInfo); Assert.AreEqual(expected, actual); Assert.Inconclusive("Verify the correctness of this test method."); }
public void GetProjectNameTest() { const string fileName = "1pe.xhtml"; string inputFullName = _testFiles.Input(fileName); IPublicationInformation projInfo = mocks.NewMock <IPublicationInformation>(); Expect.Exactly(1).On(projInfo).GetProperty("DefaultXhtmlFileWithPath").Will(Return.Value(inputFullName)); var result = GetProjectName(projInfo); Assert.AreEqual("TestFiles", result); mocks.VerifyAllExpectationsHaveBeenMet(); }
/// <summary> /// returns the project name from the path /// </summary> /// <param name="projInfo">data on project</param> /// <returns>Project Name</returns> protected string GetProjectName(IPublicationInformation projInfo) { var scrDir = Path.GetDirectoryName(projInfo.DefaultXhtmlFileWithPath); var projDir = Path.GetDirectoryName(scrDir); return Path.GetFileName(projDir); }
/// <summary> /// Inserts links in the CSS file to the fonts used by the writing systems: /// - If the fonts are embedded, adds a @font-face declaration referencing the .ttf file /// that's found in the archive /// - Sets the font-family for the body:lang selector to the referenced font /// </summary> /// <param name="cssFile"></param> /// <param name="projInfo">Project information - used to find path to reversal file.</param> public void ReferenceFonts(string cssFile, IPublicationInformation projInfo) { if (!File.Exists(cssFile)) return; // read in the CSS file string mainTextDirection = "ltr"; var reader = new StreamReader(cssFile); string content = reader.ReadToEnd(); reader.Close(); var sb = new StringBuilder(); // write a timestamp for field troubleshooting WriteProductNameAndTimeStamp(sb); // If we're embedding the fonts, build the @font-face elements)))) if (_parent.EmbedFonts) { foreach (var embeddedFont in _embeddedFonts.Values) { if (embeddedFont.Filename == null) { WriteMissingFontMessage(sb, embeddedFont); continue; } WriteFontDeclarationBlock(sb, embeddedFont); // if we're also embedding the font variants (bold, italic), reference them now if (_parent.IncludeFontVariants) { // Italic version if (embeddedFont.HasItalic) { WriteItalicVariantDeclarationBlock(sb, embeddedFont); } // Bold version if (embeddedFont.HasBold) { WriteBoldVariantDeclarationBlock(sb, embeddedFont); } } } } // add :lang pseudo-elements for each language and set them to the proper font bool firstLang = true; foreach (var language in _langFontDictionary) { var languageKey = language.Key; var languageName = language.Value; EmbeddedFont embeddedFont; // If this is the first language in the loop (i.e., the main language), // set the font for the body element if (firstLang) { mainTextDirection = Common.GetTextDirection(languageKey); embeddedFont = WriteMainLanguageDeclarationBlock(mainTextDirection, sb, languageName); if (_parent.IncludeFontVariants) { // Italic version if (embeddedFont != null) if (embeddedFont.HasItalic) { embeddedFont = WriteItalicLanguageFondDeclarationBlock(sb, languageName); } // Bold version if (embeddedFont != null) if (embeddedFont.HasBold) { WriteBoldLanguageFontDeclarationBlock(sb, languageName); } } var revFile = Common.PathCombine(Path.GetDirectoryName(projInfo.DefaultXhtmlFileWithPath), "FlexRev.xhtml"); if (File.Exists(revFile)) { string reverseSenseNumberFont = GetLanguageForReversalNumber(revFile, languageKey); WriteReversalFontDeclaration(sb, languageName, languageKey, reverseSenseNumberFont); } // finished processing - clear the flag firstLang = false; } // set the font for the *:lang(xxx) pseudo-element embeddedFont = WriteGenericLanguageDeclarationBlock(sb, languageKey, languageName); if (_parent.IncludeFontVariants) { // italic version if (embeddedFont != null) if (embeddedFont.HasItalic) { embeddedFont = WriteItalicClassesDeclarationBlock(sb, languageKey, languageName); } // bold version if (embeddedFont != null) if (embeddedFont.HasBold) { WriteBoldClassesDeclarationBlock(sb, languageKey, languageName); } } } sb.AppendLine("/* end auto-generated font info */"); sb.AppendLine(); RemovesImportStatementIfItExists(content, sb); WriteUpdatedCssFile(cssFile, sb); AddDirectionAndPaddingForScripture(cssFile, mainTextDirection, sb); }
protected void CreateRamp(IPublicationInformation projInfo) { var ramp = new Ramp(); ramp.Create(projInfo.DefaultXhtmlFileWithPath, ".mybible,.nt,.ont", projInfo.ProjectInputType); }