enable targeting another site dir
This commit is contained in:
parent
367cf27324
commit
2972869e0b
14
README.md
14
README.md
@ -1,7 +1,7 @@
|
|||||||
## Go by Example
|
## Go by Example
|
||||||
|
|
||||||
Source for the [Go by Example](https://gobyexample.com)
|
Content and toolchain source for the
|
||||||
site.
|
[Go by Example](https://gobyexample.com) site.
|
||||||
|
|
||||||
|
|
||||||
### Overview
|
### Overview
|
||||||
@ -39,6 +39,16 @@ Generation requires the [`pygmentize`](http://pygments.org/)
|
|||||||
binary for syntax highlighting.
|
binary for syntax highlighting.
|
||||||
|
|
||||||
|
|
||||||
|
### Serving
|
||||||
|
|
||||||
|
The site is served by the [gobyexample-server](https://github.com/mmcgrana/gobyexample-server)
|
||||||
|
tool. To export to this tool:
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ SITEDIR = ../gobyexample-server/public tool/build
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
### License
|
### License
|
||||||
|
|
||||||
This work is licensed under a [Creative Commons Attribution 3.0 Unported License](http://creativecommons.org/licenses/by/3.0/).
|
This work is licensed under a [Creative Commons Attribution 3.0 Unported License](http://creativecommons.org/licenses/by/3.0/).
|
||||||
|
@ -101,6 +101,13 @@ func whichLexer(path string) string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func whichSiteDir() {
|
||||||
|
dir := os.Getenv("SITEDIR")
|
||||||
|
if dir != "" {
|
||||||
|
siteDir = dir
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func debug(msg string) {
|
func debug(msg string) {
|
||||||
if os.Getenv("DEBUG") == "1" {
|
if os.Getenv("DEBUG") == "1" {
|
||||||
fmt.Fprintln(os.Stderr, msg)
|
fmt.Fprintln(os.Stderr, msg)
|
||||||
@ -228,6 +235,7 @@ func renderChapters(chapters []*Chapter) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
whichSiteDir()
|
||||||
ensureDir(siteDir)
|
ensureDir(siteDir)
|
||||||
copyFile("template/site.css", siteDir+"/site.css")
|
copyFile("template/site.css", siteDir+"/site.css")
|
||||||
chapters := parseChapters()
|
chapters := parseChapters()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user