Load wiki link data at startup and shorten some file names
This commit is contained in:
parent
d6755356e0
commit
546250f60b
4 changed files with 7 additions and 7 deletions
|
@ -35,12 +35,11 @@ module BrowseHelper
|
|||
private
|
||||
|
||||
def wiki_link(type, lookup)
|
||||
wiki_data = YAML.load_file("#{RAILS_ROOT}/config/wiki-tag-and-key-description.yml")
|
||||
locale = I18n.locale.to_s
|
||||
|
||||
if page = wiki_data[locale][type][lookup] rescue nil
|
||||
if page = WIKI_PAGES[locale][type][lookup] rescue nil
|
||||
url = "http://wiki.openstreetmap.org/wiki/#{page}?uselang=#{locale}"
|
||||
elsif page = wiki_data["en"][type][lookup] rescue nil
|
||||
elsif page = WIKI_PAGES["en"][type][lookup] rescue nil
|
||||
url = "http://wiki.openstreetmap.org/wiki/#{page}?uselang=#{locale}"
|
||||
end
|
||||
|
||||
|
|
1
config/initializers/wiki_pages.rb
Normal file
1
config/initializers/wiki_pages.rb
Normal file
|
@ -0,0 +1 @@
|
|||
WIKI_PAGES = YAML.load_file("#{RAILS_ROOT}/config/wiki_pages.yml")
|
|
@ -1,4 +1,4 @@
|
|||
# THIS FILE IS AUTOGENERATED WITH THE script/misc/update-key-and-tag-description-pages-from-wiki
|
||||
# THIS FILE IS AUTOGENERATED WITH THE script/misc/update-wiki-pages
|
||||
# PROGRAM DO NOT MANUALLY EDIT IT
|
||||
|
||||
---
|
|
@ -19,11 +19,11 @@ use Test::More 'no_plan';
|
|||
|
||||
=head1 NAME
|
||||
|
||||
update-key-and-tag-description-pages-from-wiki - Screen-scrape the wiki for key/value wiki description pages
|
||||
update-wiki-pages - Screen-scrape the wiki for key/value wiki description pages
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
perl script/misc/update-key-and-tag-description-pages-from-wiki config/wiki-tag-and-key-description.yml
|
||||
perl script/misc/update-wiki-pages config/wiki_pages.yml
|
||||
|
||||
=head1 BUGS
|
||||
|
||||
|
@ -77,7 +77,7 @@ ok(1, "Got a total of $count{$_} ${_}s") for qw[ key value ];
|
|||
|
||||
# Dump to .yml file
|
||||
open my $out, ">", $ARGV[0] or die "Can't open file '$ARGV[0]' supplied on the command line";
|
||||
say $out "# THIS FILE IS AUTOGENERATED WITH THE script/misc/update-key-and-tag-description-pages-from-wiki";
|
||||
say $out "# THIS FILE IS AUTOGENERATED WITH THE script/misc/update-wiki-pages";
|
||||
say $out "# PROGRAM DO NOT MANUALLY EDIT IT";
|
||||
say $out "";
|
||||
say $out Dump(\%feature);
|
Loading…
Add table
Add a link
Reference in a new issue