Пример #1
0
        protected void ReformatData(PublicationInformation projInfo)
        {
            var outFile = new DictionaryForMIDsStreamWriter(projInfo);

            outFile.Open();
            var className = projInfo.IsLexiconSectionExist ? "definition" : "headref";
            var input     = Input(projInfo);
            var sensePath = projInfo.IsLexiconSectionExist ? "//*[@class = 'entry']//*[@id]" : "//*[@class = 'headref']/parent::*";

            if (input.Fw83())
            {
                sensePath = "//*[@entryguid]";
            }
            foreach (XmlNode sense in input.SelectNodes(sensePath))
            {
                if (!DictionaryForMIDsRec.HasChildClass(sense, className))
                {
                    continue;
                }
                var rec = new DictionaryForMIDsRec {
                    CssClass = CssClass, Styles = ContentStyles
                };
                rec.AddHeadword(sense);
                rec.AddBeforeSense(sense);
                rec.AddSense(sense);
                rec.AddAfterSense(sense);
                rec.AddReversal(sense, className);
                outFile.WriteLine(rec.Rec);
            }
            outFile.Close();
        }
Пример #2
0
 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);
 }
 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);
 }
 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 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));
 }
Пример #6
0
 protected void ReformatData(PublicationInformation projInfo)
 {
     var outFile = new DictionaryForMIDsStreamWriter(projInfo);
     outFile.Open();
     var className = projInfo.IsLexiconSectionExist ? "definition" : "headref";
     var input = Input(projInfo);
     var sensePath = projInfo.IsLexiconSectionExist ? "//*[@class = 'entry']//*[@id]" : "//*[@class = 'headref']/parent::*";
     foreach (XmlNode sense in input.SelectNodes(sensePath))
     {
         var rec = new DictionaryForMIDsRec { CssClass = CssClass, Styles = ContentStyles };
         rec.AddHeadword(sense);
         rec.AddBeforeSense(sense);
         rec.AddSense(sense);
         rec.AddAfterSense(sense);
         rec.AddReversal(sense, className);
         outFile.WriteLine(rec.Rec);
     }
     outFile.Close();
 }
Пример #7
0
 public void AddBeforeSenseTest()
 {
     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.AddBeforeSense(sense);
     Assert.AreEqual(@"{{\[sample \] ", rec.Rec);
 }
Пример #8
0
 public void AddReversalTest()
 {
     PublicationInformation projInfo = new PublicationInformation();
     projInfo.DefaultXhtmlFileWithPath = _testFiles.Input("sena3-imba.xhtml");
     var input = new DictionaryForMIDsInput(projInfo);
     var sense = input.SelectNodes("//*[@class = 'entry']/xhtml:div")[0];
     var rec = new DictionaryForMIDsRec();
     rec.AddReversal(sense, "definition");
     Assert.AreEqual("\tcantar", rec.Rec);
 }