Make section header parsing more generic

This commit is contained in:
azakhi 2018-08-31 16:13:57 +03:00
parent 6be29dbd28
commit 341b1d1eb2
1 changed files with 2 additions and 1 deletions

View File

@ -1,6 +1,7 @@
using Filtration.ObjectModel; using Filtration.ObjectModel;
using GalaSoft.MvvmLight.CommandWpf; using GalaSoft.MvvmLight.CommandWpf;
using System; using System;
using System.Text.RegularExpressions;
namespace Filtration.ViewModels namespace Filtration.ViewModels
{ {
@ -61,7 +62,7 @@ namespace Filtration.ViewModels
{ {
string[] commentLines = ItemFilterCommentBlock.Comment.Split(new[] { Environment.NewLine }, StringSplitOptions.None); string[] commentLines = ItemFilterCommentBlock.Comment.Split(new[] { Environment.NewLine }, StringSplitOptions.None);
var titleOffset = 1; var titleOffset = 1;
if (commentLines.Length > 1 && (commentLines[0].TrimStart(' ').StartsWith(@"============") || commentLines[0].TrimStart(' ').StartsWith(@"------------"))) if (commentLines.Length > 1 && !Regex.Match(commentLines[0], "[a-zA-Z]+").Success)
{ {
titleOffset = 3; titleOffset = 3;
commentLines[0] = commentLines[1]; commentLines[0] = commentLines[1];