-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This adds the documentation for the publishing-api docs. The list of pages to import is hard coded. I've considered using the GitHub API to fetch everything in the `/doc` directory. The downside to that is that if pages are renamed, we'll inadvertently break the pages here. Having a local list here allows us to set up redirects.
- Loading branch information
Showing
11 changed files
with
99 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module NavigationHelpers | ||
def active_page?(page_path) | ||
current_page.path.start_with?(page_path) || current_page.data.parent == page_path | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
class PublishingApiDocs | ||
PAGES = { | ||
"api" => "API docs", | ||
"dependency-resolution" => "Dependency resolution", | ||
"link-expansion" => "Link expansion", | ||
"model" => "Model", | ||
"publishing-application-examples" => "Examples", | ||
"rabbitmq" => "Message queue", | ||
} | ||
|
||
def self.pages | ||
PAGES.map { |k, v| Page.new(k, v) } | ||
end | ||
|
||
class Page | ||
attr_reader :filename, :title | ||
|
||
def initialize(filename, title) | ||
@filename = filename | ||
@title = title | ||
end | ||
|
||
def source_url | ||
"https://github.com/alphagov/publishing-api/blob/master/doc/#{filename}.md" | ||
end | ||
|
||
def edit_url | ||
"https://github.com/alphagov/publishing-api/edit/master/doc/#{filename}.md" | ||
end | ||
|
||
def raw_source | ||
"https://raw.githubusercontent.com/alphagov/publishing-api/master/doc/#{filename}.md" | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
layout: api_layout | ||
title: Publishing API | ||
navigation_weight: 15 | ||
--- | ||
|
||
The [Publishing API][repo] is the central | ||
application for publishing to GOV.UK. | ||
|
||
The docs here are imported from the [docs directory][docs-directory] | ||
in the [publishing-api repo][repo]. | ||
|
||
[docs-directory]: https://github.com/alphagov/publishing-api/tree/master/doc | ||
[repo]: https://github.com/alphagov/publishing-api |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<h1 class="page-title"><%= current_page.data.title %></h1> | ||
<h1 class="page-title"><%= locals.key?(:page_title) ? page_title : current_page.data.title %></h1> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<div class="edit-links"> | ||
Something wrong? Something to add? | ||
<%= link_to "View source on GitHub", current_page.data.source_url %> or | ||
<%= link_to "edit directly on GitHub", current_page.data.edit_url %>. | ||
<%= link_to "View source on GitHub", page.source_url %> or | ||
<%= link_to "edit directly on GitHub", page.edit_url %>. | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
layout: api_layout | ||
parent: apis/publishing-api.html | ||
--- | ||
|
||
<%= ExternalDoc.fetch(page.raw_source) %> |