Skip to content

Commit

Permalink
Fetch Turbo documentation from GitHub
Browse files Browse the repository at this point in the history
We probably want do this in a build-step at a later point
  • Loading branch information
marcoroth committed Oct 23, 2023
1 parent bee0f07 commit 597275d
Show file tree
Hide file tree
Showing 15 changed files with 31 additions and 28 deletions.
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ title: Introduction
---

<%= render Page::ContainerComponent.new(page: current_page) do |page| %>
<div class="prose prose-invert max-w-full">
<%== render_markdown(File.read(Rails.root.join("app/content/pages/documentation/turbo/turbo-site/_source/handbook/01_introduction.md")).split("---").last) %>
<div class="prose prose-invert max-w-full mt-6">
<%== turbo_documentation_page("handbook/01_introduction.md") %>

<%= render partial: "turbo_site_navigation", locals: { current_page: current_page, model: TurboHandbookModel } %>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ title: Drive
---

<%= render Page::ContainerComponent.new(page: current_page) do |page| %>
<div class="prose prose-invert max-w-full">
<%== render_markdown(File.read(Rails.root.join("app/content/pages/documentation/turbo/turbo-site/_source/handbook/02_drive.md")).split("---").last) %>
<div class="prose prose-invert max-w-full mt-6">
<%== turbo_documentation_page("handbook/02_drive.md") %>

<%= render partial: "turbo_site_navigation", locals: { current_page: current_page, model: TurboHandbookModel } %>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ title: Frames
---

<%= render Page::ContainerComponent.new(page: current_page) do |page| %>
<div class="prose prose-invert max-w-full">
<%== render_markdown(File.read(Rails.root.join("app/content/pages/documentation/turbo/turbo-site/_source/handbook/03_frames.md")).split("---").last) %>
<div class="prose prose-invert max-w-full mt-6">
<%== turbo_documentation_page("handbook/03_frames.md") %>

<%= render partial: "turbo_site_navigation", locals: { current_page: current_page, model: TurboHandbookModel } %>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ title: Streams
---

<%= render Page::ContainerComponent.new(page: current_page) do |page| %>
<div class="prose prose-invert max-w-full">
<%== render_markdown(File.read(Rails.root.join("app/content/pages/documentation/turbo/turbo-site/_source/handbook/04_streams.md")).split("---").last) %>
<div class="prose prose-invert max-w-full mt-6">
<%== turbo_documentation_page("handbook/04_streams.md") %>

<%= render partial: "turbo_site_navigation", locals: { current_page: current_page, model: TurboHandbookModel } %>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ title: Native
---

<%= render Page::ContainerComponent.new(page: current_page) do |page| %>
<div class="prose prose-invert max-w-full">
<%== render_markdown(File.read(Rails.root.join("app/content/pages/documentation/turbo/turbo-site/_source/handbook/05_native.md")).split("---").last) %>
<div class="prose prose-invert max-w-full mt-6">
<%== turbo_documentation_page("handbook/05_native.md") %>

<%= render partial: "turbo_site_navigation", locals: { current_page: current_page, model: TurboHandbookModel } %>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ title: Building
---

<%= render Page::ContainerComponent.new(page: current_page) do |page| %>
<div class="prose prose-invert max-w-full">
<%== render_markdown(File.read(Rails.root.join("app/content/pages/documentation/turbo/turbo-site/_source/handbook/06_building.md")).split("---").last) %>
<div class="prose prose-invert max-w-full mt-6">
<%== turbo_documentation_page("handbook/06_building.md") %>

<%= render partial: "turbo_site_navigation", locals: { current_page: current_page, model: TurboHandbookModel } %>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ title: Installing
---

<%= render Page::ContainerComponent.new(page: current_page) do |page| %>
<div class="prose prose-invert max-w-full">
<%== render_markdown(File.read(Rails.root.join("app/content/pages/documentation/turbo/turbo-site/_source/handbook/07_installing.md")).split("---").last) %>
<div class="prose prose-invert max-w-full mt-6">
<%== turbo_documentation_page("handbook/07_installing.md") %>

<%= render partial: "turbo_site_navigation", locals: { current_page: current_page, model: TurboHandbookModel } %>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ title: Drive
---

<%= render Page::ContainerComponent.new(page: current_page) do |page| %>
<div class="prose prose-invert max-w-full">
<%== render_markdown(File.read(Rails.root.join("app/content/pages/documentation/turbo/turbo-site/_source/reference/drive.md")).split("---").last) %>
<div class="prose prose-invert max-w-full mt-6">
<%== turbo_documentation_page("reference/drive.md") %>

<%= render partial: "turbo_site_navigation", locals: { current_page: current_page, model: TurboReferenceModel } %>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ title: Frames
---

<%= render Page::ContainerComponent.new(page: current_page) do |page| %>
<div class="prose prose-invert max-w-full">
<%== render_markdown(File.read(Rails.root.join("app/content/pages/documentation/turbo/turbo-site/_source/reference/frames.md")).split("---").last) %>
<div class="prose prose-invert max-w-full mt-6">
<%== turbo_documentation_page("reference/frames.md") %>

<%= render partial: "turbo_site_navigation", locals: { current_page: current_page, model: TurboReferenceModel } %>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ title: Streams
---

<%= render Page::ContainerComponent.new(page: current_page) do |page| %>
<div class="prose prose-invert max-w-full">
<%== render_markdown(File.read(Rails.root.join("app/content/pages/documentation/turbo/turbo-site/_source/reference/streams.md")).split("---").last) %>
<div class="prose prose-invert max-w-full mt-6">
<%== turbo_documentation_page("reference/streams.md") %>

<%= render partial: "turbo_site_navigation", locals: { current_page: current_page, model: TurboReferenceModel } %>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ title: Events
---

<%= render Page::ContainerComponent.new(page: current_page) do |page| %>
<div class="prose prose-invert max-w-full">
<%== render_markdown(File.read(Rails.root.join("app/content/pages/documentation/turbo/turbo-site/_source/reference/events.md")).split("---").last) %>
<div class="prose prose-invert max-w-full mt-6">
<%== turbo_documentation_page("reference/events.md") %>

<%= render partial: "turbo_site_navigation", locals: { current_page: current_page, model: TurboReferenceModel } %>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ title: Attributes
---

<%= render Page::ContainerComponent.new(page: current_page) do |page| %>
<div class="prose prose-invert max-w-full">
<%== render_markdown(File.read(Rails.root.join("app/content/pages/documentation/turbo/turbo-site/_source/reference/attributes.md")).split("---").last) %>
<div class="prose prose-invert max-w-full mt-6">
<%== turbo_documentation_page("reference/attributes.md") %>

<%= render partial: "turbo_site_navigation", locals: { current_page: current_page, model: TurboReferenceModel } %>
</div>
Expand Down
1 change: 0 additions & 1 deletion app/content/pages/documentation/turbo/turbo-site
Submodule turbo-site deleted from c37812
7 changes: 7 additions & 0 deletions app/helpers/turbo_documentation_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# frozen_string_literal: true

module TurboDocumentationHelper
def turbo_documentation_page(page)
render_markdown(Net::HTTP.get(URI("https://raw.githubusercontent.com/hotwired/turbo-site/main/_source/#{page}")).split("---").last.force_encoding("utf-8"))
end
end

0 comments on commit 597275d

Please sign in to comment.