From 864e2f59ac4e4aadf8c5a4bf97e35facaaea6883 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 26 Jul 2020 01:59:30 +0000 Subject: allow multiple rdoc_url and cgit_url values Might as well, since domain name ownership is a shaky thing and ICANN may try to screw the world over once again. --- lib/olddoc/history.rb | 2 +- lib/olddoc/news_atom.rb | 4 ++-- lib/olddoc/prepare.rb | 4 ++-- lib/oldweb.rb | 20 ++++++++++---------- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/olddoc/history.rb b/lib/olddoc/history.rb index dcdf0fe..800446e 100644 --- a/lib/olddoc/history.rb +++ b/lib/olddoc/history.rb @@ -9,7 +9,7 @@ module Olddoc::History # :nodoc: # returns a cgit URI for a given +tag_name+ def tag_uri(tag_name) - uri = @cgit_uri.dup + uri = @cgit_uri[0].dup uri.path += "/tag/" uri.query = "id=#{tag_name}" uri diff --git a/lib/olddoc/news_atom.rb b/lib/olddoc/news_atom.rb index ed01197..39f9bb8 100644 --- a/lib/olddoc/news_atom.rb +++ b/lib/olddoc/news_atom.rb @@ -32,9 +32,9 @@ module Olddoc::NewsAtom # :nodoc: def news_atom_xml project_name, short_desc, _ = readme_metadata new_tags = tags[0,10] - atom_uri = @rdoc_uri.dup + atom_uri = @rdoc_uri[0].dup atom_uri.path += "NEWS.atom.xml" - news_uri = @rdoc_uri.dup + news_uri = @rdoc_uri[0].dup news_uri.path += "NEWS.html" dst = '' diff --git a/lib/olddoc/prepare.rb b/lib/olddoc/prepare.rb index f902fff..f0e6329 100644 --- a/lib/olddoc/prepare.rb +++ b/lib/olddoc/prepare.rb @@ -12,8 +12,8 @@ class Olddoc::Prepare # :nodoc: cgit_url = opts['cgit_url'] rdoc_url && cgit_url or abort "rdoc_url and cgit_url required in .olddoc.yml for `prepare'" - @rdoc_uri = URI.parse(rdoc_url) - @cgit_uri = URI.parse(cgit_url) + @rdoc_uri = Array(rdoc_url).map { |u| URI.parse(u) } + @cgit_uri = Array(cgit_url).map { |u| URI.parse(u) } @name, @short_desc = readme_metadata end diff --git a/lib/oldweb.rb b/lib/oldweb.rb index 74b4db1..3b2b2f2 100644 --- a/lib/oldweb.rb +++ b/lib/oldweb.rb @@ -73,23 +73,23 @@ class Oldweb noindex = @old_cfg['noindex'] and noindex.each { |k| ni[k] = true } @old_cfg['noindex'] = ni - cgit_url = @old_cfg['cgit_url'] + cgit_url = Array(@old_cfg['cgit_url']) source = @old_cfg['source_code'] ||= [] if source.empty? - if cgit_url - source << "git clone #{cgit_url}" - end + source << "git clone #{cgit_url[0]}" if cgit_url[0] git_url = @old_cfg['git_url'] - if git_url && git_url != cgit_url + if git_url && git_url != cgit_url[0] source << "git clone #{git_url}" end end - if cgit_url - cgit_url += '/tree/%s' # path name - tag = @git_tag and cgit_url << "id=#{CGI.escape(tag)}" - cgit_url << '#n%d' # lineno - @old_vcs_url = cgit_url + if cgit_url[0] + cgit_url.each do |u| + u += '/tree/%s' # path name + tag = @git_tag and u << "id=#{CGI.escape(tag)}" + u << '#n%d' # lineno + end + @old_vcs_url = cgit_url[0] end @oldweb_style = nil # used by dark216 end -- cgit v1.2.3-24-ge0c7