@@ -3,6 +3,7 @@ package post
3
3
import (
4
4
"bytes"
5
5
"fmt"
6
+ "os"
6
7
"path"
7
8
"regexp"
8
9
"strconv"
@@ -18,6 +19,7 @@ var CmdPost = &base.Command{
18
19
UsageLine : "post" ,
19
20
Short : "build post files" ,
20
21
Long : "build all post files." ,
22
+ Hidden : true ,
21
23
}
22
24
23
25
func runPost (cmd * base.Command , args []string ) {
@@ -77,7 +79,11 @@ func runPost(cmd *base.Command, args []string) {
77
79
buf .WriteString ("\n ---\n " )
78
80
buf .WriteString (fmt .Sprintf ("\n ## [答案](https://github.com/openset/leetcode/tree/master/problems/%s)\n " , question .TitleSlug ))
79
81
filename := fmt .Sprintf (formatFilename , t .Format ("2006-01-02" ), question .TitleSlug )
80
- base .FilePutContents (path .Join ("post" , filename ), buf .Bytes ())
82
+ postType := "leetcode"
83
+ if inPosts [questionId ] {
84
+ postType = "_posts"
85
+ }
86
+ base .FilePutContents (path .Join (basePath , postType , filename ), buf .Bytes ())
81
87
}
82
88
}
83
89
postTags ()
@@ -91,7 +97,7 @@ func postTags() {
91
97
}
92
98
filename := fmt .Sprintf ("tag-%s.md" , tag .Slug )
93
99
data := []byte (fmt .Sprintf (tagTmpl , title , tag .Slug , tag .Name ))
94
- base .FilePutContents (path .Join ("page " , filename ), data )
100
+ base .FilePutContents (path .Join (basePath , "_pages " , filename ), data )
95
101
}
96
102
}
97
103
@@ -112,3 +118,37 @@ permalink: /tags/%s/
112
118
taxonomy: %s
113
119
---
114
120
`
121
+
122
+ var homeDir , _ = os .UserHomeDir ()
123
+
124
+ var basePath = path .Join (homeDir , "openset" , "openset" )
125
+
126
+ var inPosts = map [int ]bool {
127
+ 1 : true ,
128
+ 2 : true ,
129
+ 3 : true ,
130
+ 4 : true ,
131
+ 7 : true ,
132
+ 8 : true ,
133
+ 9 : true ,
134
+ 12 : true ,
135
+ 13 : true ,
136
+ 15 : true ,
137
+ 18 : true ,
138
+ 20 : true ,
139
+ 58 : true ,
140
+ 101 : true ,
141
+ 168 : true ,
142
+ 171 : true ,
143
+ 172 : true ,
144
+ 190 : true ,
145
+ 191 : true ,
146
+ 198 : true ,
147
+ 233 : true ,
148
+ 746 : true ,
149
+ 793 : true ,
150
+ 849 : true ,
151
+ 941 : true ,
152
+ 984 : true ,
153
+ 1000 : true ,
154
+ }
0 commit comments