Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Update: AuthInfo #204

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

Merged
awesee merged 1 commit into master from develop
Jan 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions internal/base/base.go
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,12 @@ func Exit() {
os.Exit(0)
}

const AuthInfo = `
<!--+----------------------------------------------------------------------+-->
<!--|@author Openset <openset.wang@gmail.com> |-->
<!--|@link https://github.com/openset |-->
<!--|@home https://github.com/openset/leetcode |-->
<!--+----------------------------------------------------------------------+-->
`
func AuthInfo(cmd string) string {
format := "<!--|This file generated by command(leetcode %s); DO NOT EDIT.%s|-->\n"
format += "<!--+----------------------------------------------------------------------+-->\n"
format += "<!--|@author Openset <openset.wang@gmail.com> |-->\n"
format += "<!--|@link https://github.com/openset |-->\n"
format += "<!--|@home https://github.com/openset/leetcode |-->\n"
format += "<!--+----------------------------------------------------------------------+-->\n"
return fmt.Sprintf(format, cmd, strings.Repeat(" ", 15-len(cmd)))
}
3 changes: 1 addition & 2 deletions internal/helper/helper.go
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ func runHelper(cmd *base.Command, args []string) {
cmd.Usage()
}
var buf bytes.Buffer
buf.WriteString("<!--|This file generated by command(leetcode helper); DO NOT EDIT. |-->")
buf.WriteString(base.AuthInfo)
buf.WriteString(base.AuthInfo("helper"))
buf.WriteString("\n# Helper\n\n")
buf.WriteString("```text\n")
out, err := exec.Command(base.CmdName).Output()
Expand Down
3 changes: 1 addition & 2 deletions internal/leetcode/question_data.go
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ func (question questionType) SaveContent() {

func (question questionType) getDescContent() []byte {
var buf bytes.Buffer
buf.WriteString("<!--|This file generated by command(leetcode description); DO NOT EDIT. |-->")
buf.WriteString(authInfo)
buf.WriteString(authInfo("description"))
buf.WriteString(fmt.Sprintf("\n## %s. %s%s\n\n", question.QuestionFrontendId, question.Title, question.Difficulty.Str()))
content := strings.Replace(question.Content, "\r", "", -1)
// remove style
Expand Down
3 changes: 1 addition & 2 deletions internal/leetcode/tag.go
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,7 @@ func (question ttQuestionType) TagsStr() string {
func (tag tagType) SaveContents() {
questions := GetTopicTag(tag.Slug).Data.TopicTag.Questions
var buf bytes.Buffer
buf.WriteString("<!--|This file generated by command(leetcode tag); DO NOT EDIT. |-->")
buf.WriteString(authInfo)
buf.WriteString(authInfo("tag"))
buf.WriteString(fmt.Sprintf("\n## %s\n\n", tag.ShowName()))
buf.WriteString("| # | 题名 | 标签 | 难度 |\n")
buf.WriteString("| :-: | - | - | :-: |\n")
Expand Down
5 changes: 1 addition & 4 deletions internal/readme/readme.go
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ func runReadme(cmd *base.Command, args []string) {
cmd.Usage()
}
var buf bytes.Buffer
buf.WriteString(fmt.Sprintf(format, buildCmd, strings.Repeat(" ", 15-len(buildCmd))))
buf.WriteString(base.AuthInfo)
buf.WriteString(base.AuthInfo(buildCmd))
buf.WriteString(defaultStr)
writeProblems(&buf)
base.FilePutContents(fileName, buf.Bytes())
Expand Down Expand Up @@ -75,8 +74,6 @@ var (
fileName = "README.md"
)

var format = "<!--|This file generated by command(leetcode %s); DO NOT EDIT.%s|-->"

var defaultStr = `
# [LeetCode](https://openset.github.io/leetcode)
LeetCode Problems' Solutions
Expand Down
3 changes: 1 addition & 2 deletions internal/tag/tag.go
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ func runTag(cmd *base.Command, args []string) {
cmd.Usage()
}
var buf bytes.Buffer
buf.WriteString("<!--|This file generated by command(leetcode tag); DO NOT EDIT. |-->")
buf.WriteString(base.AuthInfo)
buf.WriteString(base.AuthInfo("tag"))
buf.WriteString("\n## 话题分类\n\n")
buf.WriteString("| # | Title | 标题 | | # | Title | 标题 |\n")
buf.WriteString("| :-: | - | :-: | - | :-: | - | :-: |\n")
Expand Down

AltStyle によって変換されたページ (->オリジナル) /