diff options
author | Noah Campbell <noahcampbell@gmail.com> | 2013-09-04 07:52:50 +0400 |
---|---|---|
committer | Noah Campbell <noahcampbell@gmail.com> | 2013-09-04 07:52:50 +0400 |
commit | cb00917af69bfd6fbe79dcf094956b6af33669e5 (patch) | |
tree | 1dd187caf10c08cc8a7635a24e83e4e576e0ce34 /target | |
parent | 4004687fb2da9228203fec39b914ba534c934966 (diff) |
Expand the ShowPlan functionality
Diffstat (limited to 'target')
-rw-r--r-- | target/file.go | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/target/file.go b/target/file.go index 8e3423168..2df708fcf 100644 --- a/target/file.go +++ b/target/file.go @@ -16,6 +16,11 @@ type Translator interface { Translate(string) (string, error) } +type Output interface { + Publisher + Translator +} + type Filesystem struct { UglyUrls bool DefaultExtension string @@ -52,18 +57,24 @@ func (fs *Filesystem) Translate(src string) (dest string, err error) { if src == "/" { return "index.html", nil } - if fs.UglyUrls { - return src, nil - } dir, file := path.Split(src) ext := fs.extension(path.Ext(file)) name := filename(file) + if fs.UglyUrls { + return path.Join(dir, fmt.Sprintf("%s%s", name, ext)), nil + } + return path.Join(dir, name, fmt.Sprintf("index%s", ext)), nil } func (fs *Filesystem) extension(ext string) string { + switch ext { + case ".md", ".rst": // TODO make this list configurable. page.go has the list of markup types. + return ".html" + } + if ext != "" { return ext } |