Skip to content
Closed
Show file tree
Hide file tree
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
24 changes: 24 additions & 0 deletions config/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,27 @@
csproj_path: 'GetIntoTeachingApi/GetIntoTeachingApi.csproj'
docsets:
- path: 'docs'
- name: "Teacher pay calculator"
repo_name: "DFE-Digital/teacher-pay-calculator"
language: 'ruby'
docsets: []
- name: "Refer a teacher for serious misconduct"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is already on 120 with a slightly different name. I think the existing entry is correct.

repo_name: "DFE-Digital/refer-serious-misconduct"
language: 'ruby'
docsets:
- path: 'docs'
- name: "Check the Children's barred list"
repo_name: "DFE-Digital/check-childrens-barred-list"
language: 'ruby'
docsets:
- path: 'docs'
- name: "Access your teaching qualifications"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is on 114.

repo_name: "DFE-Digital/access-your-teaching-qualifications"
language: 'ruby'
docsets:
- path: 'docs'
- name: "Get a teacher relocation payment"
repo_name: "DFE-Digital/get-a-teacher-relocation-payment"
language: 'ruby'
docsets:
- path: 'docs'
10 changes: 7 additions & 3 deletions lib/teacher_services_tech_docs/github/markdown_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,19 @@ def to_html(repo_name: "", branch: "")

HTML::Pipeline
.new(filters)
.to_html(@contents.to_s.force_encoding("UTF-8"), context)
.to_html(contents, context)
end

def contents
@contents.to_s.force_encoding("UTF-8")
end

def title
markdown_title = @contents.split("\n")[0].to_s.match(/#(.+)/)
markdown_title = contents.split("\n")[0].to_s.match(/#(.+)/)

return filename unless markdown_title

markdown_title[1].strip
markdown_title[1].gsub(/[[:space:]]/, " ").strip
end

def filename
Expand Down
2 changes: 1 addition & 1 deletion source/templates/external_doc_template.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
---

<h1 id='lasjd'><%= service_name %> - <%= title %></h1>
<h1 id='title'><%= service_name %> <%= title %></h1>

<%= external_doc_contents %>
16 changes: 16 additions & 0 deletions spec/github/markdown_file_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,22 @@
it { is_expected.to eq("<p>These curly quotes “make commonmarker throw an exception”</p>") }
end

context "with non-breaking spaces in the title" do
context "as \\xC2\\xA0" do
let(:contents) { "#\xC2\xA0title" }
subject(:title) { markdown_file.title }

it { is_expected.to eq("title") }
end

context "as \\u00A0" do
let(:contents) { "#\u00A0title" }
subject(:title) { markdown_file.title }

it { is_expected.to eq("title") }
end
end

context "when passed a repo name and branch" do
let(:path) { "markdown.md" }
let(:contents) do
Expand Down