mirror of
https://github.com/danog/gojekyll.git
synced 2024-11-27 03:24:40 +01:00
23 lines
544 B
Go
23 lines
544 B
Go
package commands
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
|
|
"github.com/osteele/gojekyll/site"
|
|
)
|
|
|
|
var render = app.Command("render", "Render a file or URL path to standard output")
|
|
var renderPath = render.Arg("PATH", "Path or URL").String()
|
|
|
|
func renderCommand(site *site.Site) error {
|
|
p, err := pageFromPathOrRoute(site, *renderPath)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
logger.path("Render:", filepath.Join(site.SourceDir(), p.SourcePath()))
|
|
logger.label("URL:", p.Permalink())
|
|
logger.label("Content:", "")
|
|
return site.WriteDocument(os.Stdout, p)
|
|
}
|