Changeset 1106
- Timestamp:
- 2008-07-18 09:56:05 (6 months ago)
- Files:
-
- trunk/app/helpers/application_helper.rb (modified) (1 diff)
- trunk/lib/parser/lib/rules/zena.rb (modified) (1 diff)
- trunk/test/helpers/zena_parser/basic.yml (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/app/helpers/application_helper.rb
r1098 r1106 846 846 title = "<span id='v_title#{obj.zip}'>#{title}</span>" 847 847 848 if opts[:link] && opts[:link] != 'false' 849 link_opts = {} 850 if opts[:link] == 'true' 851 # nothing special for the link format 852 elsif opts[:link] =~ /(\w+\.|)data$/ 853 link_opts[:mode] = $1[0..-2] if $1 != '' 854 if obj.kind_of?(Document) 855 link_opts[:format] = obj.c_ext 848 if (link = opts[:link]) && opts[:link] != 'false' 849 if link =~ /\Ahttp/ 850 "<a href='#{link}'>#{title}</a>" 851 else 852 link_opts = {} 853 if opts[:link] == 'true' 854 # nothing special for the link format 855 elsif opts[:link] =~ /(\w+\.|)data$/ 856 link_opts[:mode] = $1[0..-2] if $1 != '' 857 if obj.kind_of?(Document) 858 link_opts[:format] = obj.c_ext 859 else 860 link_opts[:format] = 'html' 861 end 862 elsif opts[:link] =~ /(\w+)\.(\w+)/ 863 link_opts[:mode] = $1 864 link_opts[:format] = $2 856 865 else 857 link_opts[: format] = 'html'866 link_opts[:mode] = opts[:link] 858 867 end 859 elsif opts[:link] =~ /(\w+)\.(\w+)/ 860 link_opts[:mode] = $1 861 link_opts[:format] = $2 862 else 863 link_opts[:mode] = opts[:link] 864 end 865 "<a href='#{zen_path(obj, link_opts)}'>#{title}</a>" 868 "<a href='#{zen_path(obj, link_opts)}'>#{title}</a>" 869 end 866 870 else 867 871 title trunk/lib/parser/lib/rules/zena.rb
r1103 r1106 626 626 end 627 627 title_params = {} 628 [:link, :check_lang].each do |sym| 629 title_params[sym] = @params[sym] if @params.include?(sym) 630 end 631 res = "<%= show_title(:node=>#{node}#{params_to_erb(title_params)}" 628 629 title_params[:check_lang] = @params[:check_lang] if @params.include?(:check_lang) 630 631 if @params[:link] 632 value, static = parse_attributes_in_value(@params[:link], :erb => false) 633 link_param = ", :link=>\"#{value}\"" 634 else 635 link_param = '' 636 end 637 638 res = "<%= show_title(:node=>#{node}#{link_param}#{params_to_erb(title_params)}" 632 639 if @params.include?(:attr) 633 640 res << ", :text=>#{node_attribute(@params[:attr])}" trunk/test/helpers/zena_parser/basic.yml
r1099 r1106 51 51 src: "<r:title/> AND NOW <r:title check_lang='false'/>" 52 52 res: "<span id='v_title21'>Clean Water project<span class='wrong_lang'>[en]</span></span> AND NOW <span id='v_title21'>Clean Water project</span>" 53 54 show_title_link_http: 55 src: "<r:title link='http://example.com'/>" 56 res: "<a href='http://example.com'><span id='v_title22'>status title</span></a>" 57 58 show_title_link_attribute: 59 src: "<r:title link='http://[name].com'/>" 60 res: "<a href='http://status.com'><span id='v_title22'>status title</span></a>" 53 61 54 62 show_format:
