Exemplo n.º 1
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Set up appropriate mappings for the TEV and TOB data files.
		/// </summary>
		/// <param name="settings">The settings object to be set up</param>
		/// ------------------------------------------------------------------------------------
		static public void SetUpMappings(IScrImportSet settings)
		{
			// Map styles without end markers
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\b", null, "Stanza Break"));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\c", null, ScrStyleNames.ChapterNumber));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\inp", null, "Block Quote Paragraph"));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\ip", null, "Intro Paragraph"));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\is", null, "Intro Section Head"));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\ip_", null, "Background Paragraph"));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\is_", null, "UnknownTEStyle"));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\imt", null, "Intro Title Main"));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\ist", null, "Intro Title Secondary"));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\iot", null, "Intro Section Head"));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\io1", null, "Intro List Item1"));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\io2", null, "Intro List Item2"));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\li1", null, "List Item1"));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\li2", null, "List Item2"));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\li3", null, "List Item3"));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\p", null, "Paragraph"));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\m", null, "Paragraph Continuation"));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\mr", null, "Section Range Paragraph"));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\ms", null, "Section Head Major"));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\mt", null, "Title Main"));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\mt", null, "Title Main"));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\mt1", null, "Title Main"));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\q", null, "Line1"));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\q2", null, "Line2"));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\q3", null, "Line3"));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\qc", null, "Doxology"));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\r", null, "Parallel Passage Reference"));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\s", null, ScrStyleNames.SectionHead));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\s2", null, "Section Head Minor"));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\v", null, ScrStyleNames.VerseNumber));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\vt", null, "Default Paragraph Characters"));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\h", null, false, MappingTargetType.TitleShort, MarkerDomain.Default, null, null));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\fig", null, false, MappingTargetType.Figure, MarkerDomain.Default, null, null));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\cap", null, false, MappingTargetType.FigureCaption, MarkerDomain.Default, null, null));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\cat", null, false, MappingTargetType.FigureFilename, MarkerDomain.Default, null, null));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\figcap", null, false, MappingTargetType.FigureCaption, MarkerDomain.Default, null, null));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\figcat", null, false, MappingTargetType.FigureFilename, MarkerDomain.Default, null, null));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\figcopy", null, false, MappingTargetType.FigureCopyright, MarkerDomain.Default, null, null));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\figdesc", null, false, MappingTargetType.FigureDescription, MarkerDomain.Default, null, null));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\figdesc_es", null, false, MappingTargetType.FigureDescription, MarkerDomain.Default, null, "es"));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\figlaypos", null, false, MappingTargetType.FigureLayoutPosition, MarkerDomain.Default, null, null));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\figrefrng", null, false, MappingTargetType.FigureRefRange, MarkerDomain.Default, null, null));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\figscale", null, false, MappingTargetType.FigureScale, MarkerDomain.Default, null, null));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\vern", MarkerDomain.Note, "Default Paragraph Characters", "qaa-x-kal", null));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\rt", MarkerDomain.Note, "Default Paragraph Characters", "en", null));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\de", MarkerDomain.Default, "Emphasis", "de", null));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\em", @"\em*", "Emphasis"));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\mt2", null, "Title Secondary"));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\mt2_", null, "Book Title Secondary")); // Not a real style
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\st", null, "Title Secondary"));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\st2", null, "Title Tertiary"));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\st3", null, "Title Tertiary"));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\quot", null, "Quoted Text"));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\h_", null, "Header & Footer"));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\bogus", null, true, MappingTargetType.TEStyle, MarkerDomain.Default, null, null));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\fr", MarkerDomain.Footnote, ScrStyleNames.FootnoteTargetRef, null, null));
			// TE-7718 - Added ending marker for \ft so that test data could include it - the ending marker
			// is added by Paratext if user sets selected text to the "ft" style.
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\ft", @"\ft*", MarkerDomain.Footnote, "Default Paragraph Characters", null, null));

			if (settings.HasNonInterleavedNotes)
			{
				settings.SetMapping(MappingSet.Notes, new ImportMappingInfo(@"\c", null, ScrStyleNames.ChapterNumber));
				settings.SetMapping(MappingSet.Notes, new ImportMappingInfo(@"\v", null, ScrStyleNames.VerseNumber));
				settings.SetMapping(MappingSet.Notes, new ImportMappingInfo(@"\rem", MarkerDomain.Default, ScrStyleNames.Remark, "en", null));
				settings.SetMapping(MappingSet.Notes, new ImportMappingInfo(@"\crem", MarkerDomain.Default, ScrStyleNames.Remark, "en", s_consultantNoteDefn));
				// need one character style for testing problem reported in TE-5071
				settings.SetMapping(MappingSet.Notes, new ImportMappingInfo(@"\em", @"\em*", "Emphasis"));
			}

			// Map styles with end markers; Note that although we use some of these markers in import tests
			// which purport to be "Other" SF, these tests really simulate segments as they would be mapped
			// coming from P6, since TE's UI for "Other" currently doesn't allow the user to indicate end
			// markers for normal backslash markers, only for in-line markers (which don't typically start
			// with a backslash in Shoebox/Toolbox data).

			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\bk", @"\bk*", ScrStyleNames.BookTitleInText));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\kw", @"\kw*", "Key Word"));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\uw", @"\uw*", false,
				MappingTargetType.TEStyle, MarkerDomain.Default, "Untranslated Word", "qaa-x-kal"));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\gls", @"\gls*", "Gloss"));

			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\rem", MarkerDomain.Note,
				ScrStyleNames.Remark, "en", null));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\crem", MarkerDomain.Note,
				ScrStyleNames.Remark, "en", s_consultantNoteDefn));

			if (settings.ImportTypeEnum == TypeOfImport.Other)
			{
				settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\f", null, false, MappingTargetType.TEStyle,
					MarkerDomain.Footnote, ScrStyleNames.NormalFootnoteParagraph, null, null));
				settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\x", null, false, MappingTargetType.TEStyle,
					MarkerDomain.Footnote, ScrStyleNames.CrossRefFootnoteParagraph, null, null));
				settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\fte", null,
					"Default Paragraph Characters")); // Footnote end
				settings.SetMapping(MappingSet.Main, new ImportMappingInfo("|fm ", "|fm*", MarkerDomain.Footnote,
					ScrStyleNames.FootnoteMarker, null, null));
				settings.SetMapping(MappingSet.Main, new ImportMappingInfo("|ft ", "|ft*", MarkerDomain.Footnote,
					"Default Paragraph Characters", null, null));
				settings.SetMapping(MappingSet.Main, new ImportMappingInfo("|fr ", "|fr*", MarkerDomain.Footnote,
					ScrStyleNames.FootnoteTargetRef, null, null));
				settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\fq", null, MarkerDomain.Footnote,
					"Quoted Text", null, null));
			}
			else
			{
				settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\f", @"\f*", false, MappingTargetType.TEStyle,
					MarkerDomain.Footnote, ScrStyleNames.NormalFootnoteParagraph, null, null));
				settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\x", @"\x*", false, MappingTargetType.TEStyle,
					MarkerDomain.Footnote, ScrStyleNames.CrossRefFootnoteParagraph, null, null));
				settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\fq", @"\fq*", MarkerDomain.Footnote,
					"Quoted Text", null, null));
			}

			// Map styles for Back-Translation domain
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\btip", MarkerDomain.BackTrans, "Intro Paragraph", "en", null));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\btvt", MarkerDomain.BackTrans, "Default Paragraph Characters", "en", null));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\btv", MarkerDomain.BackTrans, "Verse Number", "en", null));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\btvt_default", MarkerDomain.BackTrans, "Default Paragraph Characters", null, null));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\btvt_de", MarkerDomain.BackTrans, "Default Paragraph Characters", "de", null));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\btvt_es", MarkerDomain.BackTrans, "Default Paragraph Characters", "es", null));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\btvt_default", MarkerDomain.BackTrans, "Default Paragraph Characters", null, null));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\btis", MarkerDomain.BackTrans, "Intro Section Head", "en", null));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\btp", MarkerDomain.BackTrans, "Paragraph", "en", null));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\btmt", MarkerDomain.BackTrans, "Title Main", "en", null));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\btst", MarkerDomain.BackTrans, "Title Secondary", "en", null));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\btq", MarkerDomain.BackTrans, "Line1", "en", null));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\btq2", MarkerDomain.BackTrans, "Line2", "en", null));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\btr", MarkerDomain.BackTrans, "Parallel Passage Reference", "en", null));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\bts", MarkerDomain.BackTrans, "Section Head", "en", null));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\bts2", MarkerDomain.BackTrans, "Section Head Minor", "en", null));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\btvw", MarkerDomain.BackTrans, "Untranslated Word", "qaa-x-kal", null));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\btft", MarkerDomain.Footnote | MarkerDomain.BackTrans,
				"Default Paragraph Characters", null, null));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\btf", MarkerDomain.Footnote | MarkerDomain.BackTrans,
				ScrStyleNames.NormalFootnoteParagraph, null, null));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\btfig", null, false,
				MappingTargetType.Figure, MarkerDomain.BackTrans, null, null)); // Figure is treated just like FigureCaption in the BT domain
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\btcap", null, false,
				MappingTargetType.FigureCaption, MarkerDomain.BackTrans, null, null));
			settings.SetMapping(MappingSet.Main, new ImportMappingInfo(@"\btfigcopy", null, false,
				MappingTargetType.FigureCopyright, MarkerDomain.BackTrans, null, null));
		}