/// <summary> /// Write authors. /// </summary> /// <param name="writer">The writer.</param> /// <param name="block">The block.</param> /// <param name="commits">The commits.</param> private void WriteAuthors(StreamWriter writer, TextBlock block, Commit[] commits) { var token = "{author}"; // Work with the copy dummy. string line = block.Text; int idx; // Search for author tokens. while ((idx = line.IndexOf(token, StringComparison.CurrentCultureIgnoreCase)) > -1) { line = line.Replace(line.Substring(idx, token.Length), commits.First().Author); } writer.Write(line); writer.Flush(); // Dig through any inner blocks. foreach (var innerBlock in block.InnerBlocks) { if (innerBlock.Type == BlockType.Date) { this.WriteDates(writer, innerBlock, commits); } else if (innerBlock.Type == BlockType.Plain) { writer.Write(innerBlock.Text); } } }