URI: 
       Providing the ability to save (write) a content's source file. - hugo - [fork] hugo port for 9front
  HTML git clone git@git.drkhsh.at/hugo.git
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
   DIR README
   DIR LICENSE
       ---
   DIR commit 859a78e1bda04bcaad11aa022d792d419e2ad769
   DIR parent 1302ef9f636911296c737f0844036c9d5d604936
  HTML Author: spf13 <steve.francia@gmail.com>
       Date:   Thu,  1 May 2014 13:21:37 -0400
       
       Providing the ability to save (write) a content's source file.
       
       Diffstat:
         M hugolib/page.go                     |      25 +++++++++++++++++++++++++
       
       1 file changed, 25 insertions(+), 0 deletions(-)
       ---
   DIR diff --git a/hugolib/page.go b/hugolib/page.go
       @@ -567,6 +567,27 @@ func (page *Page) SetSourceMetaData(in interface{}, mark rune) (err error) {
                return nil
        }
        
       +func (page *Page) SaveSourceAs(path string) {
       +        b := new(bytes.Buffer)
       +        b.Write(page.sourceFrontmatter)
       +        b.Write(page.sourceContent)
       +
       +        page.saveSource(b.Bytes(), path)
       +}
       +
       +func (page *Page) saveSource(by []byte, inpath string) (err error) {
       +        if !path.IsAbs(inpath) {
       +                inpath = helpers.AbsPathify(inpath)
       +        }
       +        jww.INFO.Println("creating", inpath)
       +        helpers.WriteToDisk(inpath, bytes.NewReader(by))
       +        return nil
       +}
       +
       +func (page *Page) SaveSource() {
       +        page.SaveSourceAs(page.FullFilePath())
       +}
       +
        func (p *Page) ProcessShortcodes(t Template) {
                p.rawContent = []byte(ShortcodesHandle(string(p.rawContent), p, t))
                p.Summary = template.HTML(ShortcodesHandle(string(p.Summary), p, t))
       @@ -669,6 +690,10 @@ func ReaderToBytes(lines io.Reader) []byte {
                return b.Bytes()
        }
        
       +func (p *Page) FullFilePath() string {
       +        return path.Join(p.Dir, p.FileName)
       +}
       +
        func (p *Page) TargetPath() (outfile string) {
        
                // Always use Url if it's specified