Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding markdown and html output format #7

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

derFunk
Copy link

@derFunk derFunk commented Sep 21, 2018

Besides adding the new formats I added the TODOContainer struct, which is capturing the path in which the TODOs have been found, in order to use that information in the outputs.

Copy link
Owner

@asticode asticode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like the idea behind this PR.

However I'd rather see some changes made and some tests added for both html and md formats.

Cheers

@@ -22,8 +23,11 @@ var (
todoIdentifiers = []string{"TODO", "FIXME"}
)

// TODOs represents a set of todos
type TODOs []*TODO
// TODOContainer represents a set of todos
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really like the idea of creating this wrapper here.
I'd rather keep the old TODOs struct and if you need the root path in one of the Write func, you inject it as one of the method argument.

var c = csv.NewWriter(w)

// Write the headings for the document
if err = c.Write([]string{"Filename", "Line", "Assignee", "Message"}); err != nil {
if err = c.Write([]string{"Path", "Filename", "Line", "Assignee", "Message"}); err != nil {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we don't add TODOContainer, remove this column

@@ -68,6 +68,14 @@ func main() {
if err = todos.WriteJSON(writer); err != nil {
log.Fatal(err)
}
case "md":
if err = todos.WriteMarkdown(writer); err != nil {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inject *output here

log.Fatal(err)
}
case "html":
if err = todos.WriteHTML(writer); err != nil {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inject *output here

tocBuffer.WriteString("\n</ul>\n")
contentBuffer.WriteString("\n</ul>\n")

_, err = io.WriteString(w, fmt.Sprintf("<html><head><title>Todos for %s</title><link rel=\"stylesheet\" type=\"text/css\" href=\"todos.css\" /></head><body>%s<hr>%s</body></html>",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is the todo.css ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants