Example #1
0
		public void MakePLiftForBiatah2()
		{
			using (WeSayWordsProject p = new WeSayWordsProject())
			{
				p.LoadFromProjectDirectoryPath(@"E:\Users\John\Documents\WeSay\biatah");

				using (
						LexEntryRepository lexEntryRepository =
								new LexEntryRepository(p.PathToRepository))
				{
					PLiftMaker maker = new PLiftMaker();
					string path = maker.MakePLiftTempFile(lexEntryRepository, p.DefaultPrintingTemplate);
					Console.WriteLine(path);
				}
			}
		}
Example #2
0
        public void EntryMakeItToPLift()
        {
            var xmlOfEntries = @" <entry id='foo1'>
										<lexical-unit><form lang='qaa-x-qaa'><text>hello</text></form></lexical-unit>
								 </entry>"                                ;

            using (var p = new WeSay.Project.Tests.ProjectDirectorySetupForTesting(xmlOfEntries))
            {
                PLiftMaker maker = new PLiftMaker();
                using (var project = p.CreateLoadedProject())
                {
                    using (var repository = project.GetLexEntryRepository())
                    {
                        string outputPath = Path.Combine(project.PathToExportDirectory, project.Name + ".xhtml");
                        maker.MakePLiftTempFile(outputPath, repository, project.DefaultPrintingTemplate, LiftWriter.ByteOrderStyle.BOM);
                        AssertThatXmlIn.File(outputPath).
                        HasAtLeastOneMatchForXpath("//field[@type='headword']/form[@lang='qaa-x-qaa']/text[text()='hello']");
                    }
                }
            }
        }
Example #3
0
 protected string CreatePLift(ProjectInfo projectInfo,
                              bool includeXmlDirective,
                              bool linkToUserCss)
 {
     LexEntryRepository lexEntryRepository =
         projectInfo.ServiceProvider.GetService(typeof(LexEntryRepository)) as LexEntryRepository;
     {
         //In Oct 2008, LP didn't understand "plift" yet.
         var pliftPath = Path.Combine(projectInfo.PathToExportDirectory, projectInfo.Name + "-plift.lift");
         using (var dlg = new LameProgressDialog("Exporting to PLift..."))
         {
             dlg.Show();
             var maker = new PLiftMaker()
             {
                 Options = PLiftExporter.DefaultOptions | PLiftExporter.Options.ExportPartOfSpeechAsGrammaticalInfoElement
             };
             maker.MakePLiftTempFile(pliftPath, lexEntryRepository,
                                     projectInfo.ServiceProvider.GetService(typeof(ViewTemplate)) as
                                     ViewTemplate,
                                     LiftWriter.ByteOrderStyle.BOM);
         }
         return(pliftPath);
     }
 }
Example #4
0
        public void MakePLiftTempFile_ExportPartOfSpeechAsGrammaticalInfoElementSpecified_GrammaticalInfoOutputAsElement()
        {
            var xmlOfEntries = @" <entry id='foo1'>
										<sense><grammatical-info value='noun'></grammatical-info></sense>
								 </entry>"                                ;

            using (var p = new WeSay.Project.Tests.ProjectDirectorySetupForTesting(xmlOfEntries))
            {
                PLiftMaker maker = new PLiftMaker()
                {
                    Options = PLiftExporter.DefaultOptions | PLiftExporter.Options.ExportPartOfSpeechAsGrammaticalInfoElement
                };;
                using (var project = p.CreateLoadedProject())
                {
                    using (var repository = project.GetLexEntryRepository())
                    {
                        string outputPath = Path.Combine(project.PathToExportDirectory, project.Name + ".plift");
                        maker.MakePLiftTempFile(outputPath, repository, project.DefaultPrintingTemplate, LiftWriter.ByteOrderStyle.BOM);
                        AssertThatXmlIn.File(outputPath).
                        HasAtLeastOneMatchForXpath("//sense/grammatical-info[@value='noun']");
                    }
                }
            }
        }