mirror of https://github.com/docker/docs.git
jekyll: automatic issue url generation for remote resources
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
parent
050078c5f8
commit
c2ee94c1b8
|
|
@ -4,6 +4,11 @@
|
||||||
{%- assign edit_url = page.edit_url -%}
|
{%- assign edit_url = page.edit_url -%}
|
||||||
{%- else -%}
|
{%- else -%}
|
||||||
{%- assign edit_url = "https://github.com/docker/docker.github.io/edit/master/" | append: page.path -%}
|
{%- assign edit_url = "https://github.com/docker/docker.github.io/edit/master/" | append: page.path -%}
|
||||||
|
{%- endif -%}
|
||||||
|
{%- if page.issue_url -%}
|
||||||
|
{%- assign issue_url = page.issue_url -%}
|
||||||
|
{%- else -%}
|
||||||
|
{%- assign issue_url = "https://github.com/docker/docker.github.io/issues/new?body=File: [" | append: page.path | append: "](https://docs.docker.com" | append: page.url | append: ")" -%}
|
||||||
{%- endif -%} -->
|
{%- endif -%} -->
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
{%- include head.html -%}
|
{%- include head.html -%}
|
||||||
|
|
@ -63,7 +68,9 @@
|
||||||
{%- if edit_url != "" -%}
|
{%- if edit_url != "" -%}
|
||||||
<li><a href="{{ edit_url }}"><i class="fa fa-pencil-square-o" aria-hidden="true"></i> Edit this page</a></li>
|
<li><a href="{{ edit_url }}"><i class="fa fa-pencil-square-o" aria-hidden="true"></i> Edit this page</a></li>
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
<li><a href="https://github.com/docker/docker.github.io/issues/new?body=File: [{{ page.path }}](https://docs.docker.com{{ page.url }})" class="nomunge"><i class="fa fa-check" aria-hidden="true"></i> Request docs changes</a></li>
|
{%- if issue_url != "" -%}
|
||||||
|
<li><a href="{{ issue_url }}" class="nomunge"><i class="fa fa-check" aria-hidden="true"></i> Request docs changes</a></li>
|
||||||
|
{%- endif -%}
|
||||||
<li>{%- include theme-switch.html -%}</li>
|
<li>{%- include theme-switch.html -%}</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -70,12 +70,17 @@ module Jekyll
|
||||||
ent.copy destent.path
|
ent.copy destent.path
|
||||||
|
|
||||||
next unless File.file?(ent.path) && File.extname(ent.path) == ".md"
|
next unless File.file?(ent.path) && File.extname(ent.path) == ".md"
|
||||||
# set edit url for markdown files in site config defaults
|
# set edit and issue url and remote info for markdown files in site config defaults
|
||||||
edit_url = "#{entry['repo']}/edit/#{entry['default_branch']}/#{file_clean}"
|
edit_url = "#{entry['repo']}/edit/#{entry['default_branch']}/#{file_clean}"
|
||||||
puts " edit_url: #{edit_url}"
|
issue_url = "#{entry['repo']}/issues/new?body=File: [#{file_clean}](https://docs.docker.com/#{destent.path.sub(/#{File.extname(destent.path)}$/, '')}/)"
|
||||||
|
puts " edit_url: #{edit_url}"
|
||||||
|
puts " issue_url: #{issue_url}"
|
||||||
site.config['defaults'] << {
|
site.config['defaults'] << {
|
||||||
"scope" => { "path" => destent.path },
|
"scope" => { "path" => destent.path },
|
||||||
"values" => { "edit_url" => edit_url },
|
"values" => {
|
||||||
|
"edit_url" => edit_url,
|
||||||
|
"issue_url" => issue_url
|
||||||
|
},
|
||||||
}
|
}
|
||||||
end, proc do |_| end)
|
end, proc do |_| end)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue