OSDN Git Service

Plugin::NewslashHelpers: add the_path() helper
authorhylom <hylom@users.sourceforge.jp>
Fri, 8 Mar 2019 09:44:22 +0000 (18:44 +0900)
committerhylom <hylom@users.sourceforge.jp>
Fri, 8 Mar 2019 09:44:22 +0000 (18:44 +0900)
src/newslash_web/lib/Newslash/Plugin/NewslashHelpers.pm

index 601cf45..9d8c694 100644 (file)
@@ -42,6 +42,7 @@ sub register {
 
     for my $k (qw[boxes format_timestamp page_type content_type site_config
                   declare insert_code
+                  the_path
                   tidy_html clean_html escape_html format_htmltext escape_plaintext strip_by_mode
                 ]) {
         $app->helper($k => $self->can("_$k"))
@@ -142,6 +143,17 @@ sub _strip_by_mode {
     return Newslash::Util::TextFormatter::strip_by_mode($html, $post_type, $allowed);
 }
 
+=head2 the_path()
+
+  returns current path
+
+=cut
+
+sub _the_path {
+    my ($c, $html, $post_type) = @_;
+    return $c->req->url->to_abs->path;
+}
+
 ######################################################################
 #