Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proper url_prefix when doc_base_url has multiple folders #300

Merged
merged 1 commit into from
Nov 3, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions lib/tasks/apipie.rake
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ namespace :apipie do
puts "#{Time.now} | Processing docs for #{lang}"
cache_dir = ENV["OUT"] || Apipie.configuration.cache_dir
subdir = Apipie.configuration.doc_base_url.sub(/\A\//,"")
subdir_levels = subdir.split('/').length
subdir_traversal_prefix = '../' * subdir_levels
file_base = File.join(cache_dir, Apipie.configuration.doc_base_url)

if generate_index
Expand All @@ -78,15 +80,15 @@ namespace :apipie do
end
Apipie.available_versions.each do |version|
file_base_version = File.join(file_base, version)
Apipie.url_prefix = "../#{subdir}"
Apipie.url_prefix = "#{subdir_traversal_prefix}#{subdir}"
doc = Apipie.to_json(version, nil, nil, lang)
doc[:docs][:link_extension] = (lang ? ".#{lang}.html" : ".html")

generate_index_page(file_base_version, doc, true, true, lang) if generate_index
if generate_resources
Apipie.url_prefix = "../../#{subdir}"
Apipie.url_prefix = "../#{subdir_traversal_prefix}#{subdir}"
generate_resource_pages(version, file_base_version, doc, true, lang)
Apipie.url_prefix = "../../../#{subdir}"
Apipie.url_prefix = "../../#{subdir_traversal_prefix}#{subdir}"
generate_method_pages(version, file_base_version, doc, true, lang)
end
end
Expand Down