From cb00917af69bfd6fbe79dcf094956b6af33669e5 Mon Sep 17 00:00:00 2001 From: Noah Campbell Date: Tue, 3 Sep 2013 20:52:50 -0700 Subject: Expand the ShowPlan functionality --- target/file.go | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'target') 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 } -- cgit v1.2.3