Changesets can be listed by changeset number.
The Git repository is here.
Changeset 436
Add Perl script support to Radiant directory listing extension. Fix
an error throwing bug.
- Comitted by: rool
- Date: Friday August 30 03:21:18 2013 (over 11 years ago)
Affected files:
rool/rails/radiant/trunk/vendor/extensions/dir_list_tags/lib/dir_list_tags.rb:
prev. | current | |
include Radiant::Taggable | ||
desc %{ | ||
7 | Executes a Perl script at the given path and includes its <code>stdout</code> result in the page. Output whatever type of text is used by that page, or if wanting to output HTML into a page with a non-HTML filter, wrap the tag in <code><notextile>...</notextile></code> or equivalent for the filter in use. | |
8 | ||
9 | If the path you require includes spaces or other special characters, escape them with a backslash. | |
10 | ||
11 | <pre><code><r:perl_script_output location="/home/foo/perl_script.pl" /></code></pre> | |
12 | } | |
13 | tag "perl_script_output" do |tag| | |
14 | unless location = tag.attr['location'] | |
15 | raise TagError.new("`perl_script_output' tag must contain `location' attribute") | |
16 | end | |
17 | ||
18 | command = "`perl #{location}`" | |
19 | result = eval(command) | |
20 | ||
21 | if ($?.success?) | |
22 | result | |
23 | else | |
24 | raise TagError.new("Perl command failed with exit status #{$?.exitstatus}") | |
25 | end | |
26 | end | |
27 | ||
28 | desc %{ | |
Enumerates the contents of a directory within <code><li>...</li></code> containers. Environment variable SERVER_DOCUMENT_ROOT must be set and is used as the root path for directory enumeration. Even so, directory traversal is not prevented so only use this tag when content editors are trusted. | ||
You must wrap output in <code><notextile>...</notextile></code> or an equivalent if you're using a filtered page type since the tag's value is raw HTML. An outer container such as <code><ul></code> or <code><ol></code> must be placed around the tag as only the inner list items are returned. | ||
... | ... | |
docroot = ENV['SERVER_DOCUMENT_ROOT'] | ||
# See description text in "dir_list_tags_extension.rb" for details. | ||
22 | | |
44 | raise TagError.new("You must make environment variable SERVER_DOCUMENT_ROOT available to Radiant") if (docroot.nil?) | |
"<notextile>" + recursive_directory_list_in_li_tags(docroot, dir) + "</notextile>" | ||
end |