Use identifiers for headings in ePub module pages

Fixes FOO-4102
flag=none

Test Plan:
- Have a course with published modules containing pages
- Enable epub export feature flag
- Export the course to ePub, see that you can link to module pages now

Change-Id: If872e1f39005189136e16cc5e04f8a018798ef66
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/345617
Reviewed-by: Charley Kline <ckline@instructure.com>
Reviewed-by: August Thornton <august@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Jason Perry <jason.perry@instructure.com>
Product-Review: Jason Perry <jason.perry@instructure.com>
This commit is contained in:
Jason Perry 2024-04-18 13:41:31 -04:00
parent b4bc4a31a1
commit 47633af85d
2 changed files with 9 additions and 0 deletions

View File

@ -84,6 +84,7 @@ module CC::Exporter::Epub::Converters
else
get_node_val(item_node, "identifierref")
end
item[:identifier] = item[:linked_resource_id]
item[:text] = page_content[get_node_val(item_node, "identifierref")] if item.value?("WikiPage")
item[:for_syllabus] = item.value?("Assignment") || item.value?("Quizzes::Quiz")
item[:href] = "#{mod[:identifier]}.xhtml##{item[:linked_resource_id]}"

View File

@ -44,5 +44,13 @@ describe "ModuleEpubConverter" do
page = module_b[:items].find { |i| i[:title] == "Wiki Page 2" }
expect(page[:text]).to match("The dangers of fighting on the wing of moving airplanes")
end
it "page identifiers are present" do
test_instance.unzip_archive
module_b = test_instance.convert_modules.find { |m| m[:title] == "Module B" }
page = module_b[:items].find { |i| i[:title] == "Wiki Page 2" }
expect(page[:identifier]).to eq("wiki-page-2")
end
end
end