Ver Fonte

Allow symlinked templates, and note why we use improper ct on rss

George Baugh há 2 anos atrás
pai
commit
ecaf7fea3e

+ 1 - 0
lib/Trog/Renderer.pm

@@ -32,6 +32,7 @@ our %renderers = (
     blob  => \&Trog::Renderer::blob::render,
     xsl   => \&Trog::Renderer::text::render,
     xml   => \&Trog::Renderer::text::render,
+    rss   => \&Trog::Renderer::html::render,
     css   => \&Trog::Renderer::css::render,
 );
 

+ 2 - 1
lib/Trog/Renderer/Base.pm

@@ -27,7 +27,8 @@ sub render (%options) {
     die "Templated renders require a template to be passed" unless $options{template};
 
     my $template_dir = Trog::Themes::template_dir($options{template}, $options{contenttype}, $options{component});
-    die "Templated renders require an existing template to be passed, got $template_dir/$options{template}" unless -f "$template_dir/$options{template}";
+    my $t = "$template_dir/$options{template}";
+    die "Templated renders require an existing template to be passed, got $template_dir/$options{template}" unless -f $t || -s $t;
 
     #TODO make this work with posts all the time
     $options{child_processor} //= Text::Xslate->new( path => $template_dir );

+ 1 - 0
lib/Trog/Routes/HTML.pm

@@ -1333,6 +1333,7 @@ sub _rss ( $query, $subtitle, $posts ) {
             scheme => $query->{scheme},
         },
         headers     => { 'Content-Disposition' => 'inline; filename="rss.xml"' },
+        #XXX if you do the "proper" content-type of application/rss+xml, browsers download rather than display.
         contenttype => "text/xml",
         code        => 200,
     );

+ 1 - 0
lib/Trog/Vars.pm

@@ -15,6 +15,7 @@ our %content_types = (
     xml   => "text/xml",
     xsl   => "text/xsl",
     css   => "text/css",
+    rss   => "application/rss+xml"
 );
 
 our %byct = reverse %Trog::Vars::content_types;

+ 1 - 0
www/templates/raw.tx

@@ -0,0 +1 @@
+<: $body | mark_raw :>

+ 1 - 0
www/templates/rss/raw.tx

@@ -0,0 +1 @@
+../raw.tx

+ 0 - 1
www/templates/xml/raw.tx

@@ -1 +0,0 @@
-<: $body | mark_raw :>

+ 1 - 0
www/templates/xml/raw.tx

@@ -0,0 +1 @@
+../raw.tx