Esempio n. 1
0
			public static VerseResponse ToVerseWithoutHtml (string verse, RootObject root)
			{
				var text = root.ResponseData.Search.Result.Passages [0].Text;
				var copyright = root.ResponseData.Search.Result.Passages [0].Copyright;

				var document = new HtmlDocument ();
				document.LoadHtml (text);

				var tags = new [] { "h1", "h2", "h3", "h4", "h5", "h6" };
				List<string> toRemove = tags.ToList ();
				var list = document.DocumentNode.Descendants ()
					.Where (n => toRemove.Contains (n.Name.ToLower ()))
					.ToList ();

				foreach (var item in list) {
					item.Remove ();
				}

				text = document.DocumentNode.InnerText;

				document.LoadHtml (copyright);
				copyright = document.DocumentNode.InnerText;

				return new VerseResponse { Reference = verse, Text = text, Copyright = copyright };
			}
Esempio n. 2
0
			public static VerseResponse ToVerse (string verse, RootObject root)
			{
				var reference = verse;
				var text = root.ResponseData.Search.Result.Passages [0].Text;
				var copyright = root.ResponseData.Search.Result.Passages [0].Copyright;

				return new VerseResponse { Reference = reference, Text = text, Copyright = copyright };
			}
Esempio n. 3
0
			public static string ToVerseText (RootObject root)
			{
				return root.ResponseData.Search.Result.Passages [0].Text;
			}
Esempio n. 4
0
			public static string ToVerseTextWithoutHtmlOrDigits (RootObject root)
			{
				var text = ToVerseTextWithoutHtml (root);

				return Regex.Replace(text, @"\d", "");
			}
Esempio n. 5
0
			public static string ToVerseTextWithoutHtml (RootObject root)
			{
				var text = root.ResponseData.Search.Result.Passages [0].Text;
				var document = new HtmlDocument();
				document.LoadHtml (text);

				var tags = new [] { "h1", "h2", "h3", "h4", "h5", "h6" };
				List<string> toRemove = tags.ToList ();
				var list = document.DocumentNode.Descendants ()
					.Where (n => toRemove.Contains (n.Name.ToLower ()))
					.ToList ();

				foreach (var item in list) {
					item.Remove ();
				}

				return document.DocumentNode.InnerText.Replace ("\n", " ").Replace ("\r", " ");
			}
Esempio n. 6
0
			public static string ToCopyrightText (RootObject root)
			{
				var verse = ToVerseWithoutHtml ("Genesis 1:1", root);

				return verse.Copyright;
			}