public void find_some_comments()
        {
            TopicBuilder.FindComments(@"
a
b
<!--Title: foo-->
c
d
<!--Url: bar-->
e
f
").Each(x => Debug.WriteLine(x));
        }
Пример #2
0
        public void Execute()
        {
            var contents = TopicToken.FileSystem.ReadStringFromFile(_file);
            var comments = TopicBuilder.FindComments(contents);

            var existingTitle = comments.FirstOrDefault(x => x.StartsWith("Title"));

            if (existingTitle == null)
            {
                contents = "<!-- Title: {0} -->".ToFormat(_title) + Environment.NewLine + contents;
            }
            else
            {
                contents = contents.Replace(existingTitle, "Title: " + _title);
            }

            TopicToken.FileSystem.WriteStringToFile(_file, contents);
        }