Exemplo n.º 1
0
        private void ExportTE()
        {
            m_xhtml.WriteXhtmlHeading(m_fileName, m_sDescription, "scrBody");
            ExportScripture();
            m_xhtml.WriteXhtmlEnding();
            m_writer.Close();

            string sXsltFile = Path.Combine(DirectoryFinder.GetFWCodeSubDirectory("Translation Editor"),
                                            "XhtmlExport.xsl");
            string sTempFile1 = m_fileName + "-1";

            if (File.Exists(sTempFile1))
            {
                File.Delete(sTempFile1);
            }
            File.Move(m_fileName, sTempFile1);
            XslCompiledTransform xsl = new XslCompiledTransform();

            xsl.Load(sXsltFile);
            xsl.Transform(sTempFile1, m_fileName);
//#if DEBUG
//            string sSave = m_fileName + "-Phase1";
//            File.Delete(sSave);
//            File.Copy(sTempFile1, sSave);
//#endif
            File.Delete(sTempFile1);

            string sTempFile2 = m_fileName + "-2";

            if (File.Exists(sTempFile2))
            {
                File.Delete(sTempFile2);
            }
            File.Move(m_fileName, sTempFile2);
            m_xhtml.FinalizeXhtml(m_fileName, sTempFile2);
//#if DEBUG
//            sSave = m_fileName + "-Phase2";
//            File.Delete(sSave);
//            File.Copy(sTempFile2, sSave);
//#endif
            File.Delete(sTempFile2);
            m_xhtml.WriteCssFile(Path.ChangeExtension(m_fileName, ".css"), m_styleSheet,
                                 XhtmlHelper.CssType.Scripture, m_pub);
        }
Exemplo n.º 2
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Initialize the object with some useful information, and write the initial
 /// element start tag to the output.
 /// </summary>
 /// <param name="cache">The cache.</param>
 /// <param name="w">The w.</param>
 /// <param name="sDataType">Type of the s data.</param>
 /// <param name="sFormat">The s format.</param>
 /// <param name="sOutPath">The s out path.</param>
 /// ------------------------------------------------------------------------------------
 public void Initialize(FdoCache cache, TextWriter w, string sDataType, string sFormat,
                        string sOutPath)
 {
     m_writer      = w;
     m_strm        = new TextWriterStream(w);
     m_cache       = cache;
     m_sFormat     = sFormat.ToLowerInvariant();
     m_fUseRFC4646 = m_sFormat == "xhtml" || m_sFormat == "lift";
     m_xhtml       = new XhtmlHelper(w, cache);
     if (m_sFormat == "xhtml")
     {
         m_xhtml.WriteXhtmlHeading(sOutPath, null, "dicBody");
     }
     else
     {
         w.WriteLine("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
         w.WriteLine("<{0}>", sDataType);
     }
 }