예제 #1
0
		public static ListBlock TryParse(CreoleReader reader)
		{
			if (reader.NextWord != "*" && reader.NextWord != "#")
				return null;

			var markup = reader.ReadLineUntil(l => (l.StartsWith("*") || l.StartsWith("#")) ? -1 : 0, trimLines: true);

			return new ListBlock(markup);
		}
예제 #2
0
		public static NoWikiBlock TryParse(CreoleReader reader)
		{
			if (reader.Peek(3) != "{{{")
				return null;
			
			var content = reader.ReadLineUntil(l => l.StartsWith("}}}") ? 3 : -1);
			if (content != null)
				return new NoWikiBlock(content.Substring(3, content.Length - 6));

			return null;	
		}
예제 #3
0
		public static IEnumerable<ParagraphBlock> Parse(string paragraphs)
		{
			var reader = new CreoleReader(paragraphs);

			while (!reader.EndOfMarkup)
			{
				var content = reader.ReadLineUntil(l => l.Trim().Length <= 0 ? l.Length : -1);

				if (content == null)
					content = reader.ReadToEnd();
				else
					reader.SkipLine();

				if (content.Trim().Length <= 0)
					continue;

				yield return new ParagraphBlock(content.Trim());
			}
		}