Skip to content

Commit

Permalink
Removing chapter specific tags
Browse files Browse the repository at this point in the history
  • Loading branch information
jayair committed Aug 30, 2023
1 parent 0968288 commit c8cc74b
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 30 deletions.
8 changes: 0 additions & 8 deletions _chapters/handling-secrets-in-sst.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,3 @@ function: {
This will add `STRIPE_SECRET_KEY` as a secret in the stack. And allow our API to access the secret.

Now we are ready to add an API to handle billing.

{%note%}
Test note
{%endnote%}

{% info %} Test Info {% endinfo%}

{%caution %} Test Caution {%endcaution%}
13 changes: 11 additions & 2 deletions etc/ebook/build-epub.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def discourse_link comments_id

# Github code link at end of chapters
def github_code_link code_link, chapter_name
demo_github_repo = $config['sst_demo_repo']
backend_github_repo = $config['backend_github_repo']
frontend_github_repo = $config['frontend_github_repo']
frontend_fb_login_github_repo = $config['frontend_fb_login_github_repo']
Expand All @@ -36,6 +37,10 @@ def github_code_link code_link, chapter_name
link_text = "Backend Source: #{chapter_name}"
link = "#{backend_github_repo}/tree/#{chapter_name}"

elsif (code_link === 'sst-full')
link_text = "Notes App Source"
link = "#{demo_github_repo}"

elsif (code_link === 'frontend')
link_text = "Frontend Source: #{chapter_name}"
link = "#{frontend_github_repo}/tree/#{chapter_name}"
Expand Down Expand Up @@ -164,9 +169,13 @@ def build_chapter chapter_data
chapter << discourse_link(chapter_front_matter['comments_id'])

# Replace chapter specific content
if (chapter_name === 'wrapping-up')
chapter = chapter.gsub(/<a.*>Star our GitHub repo<\/a>/, "")
end
if (chapter_name === 'staying-up-to-date')
chapter = chapter.gsub(/<a.*>Subscribe<\/a>/, "")
end
if (chapter_name === 'wrapping-up-the-best-practices')
# Remove the survey http link button. The survey link already exist in the paragraph
# before it, it is redundant.
chapter = chapter.gsub(/<a.*>Fill out our survey<\/a>/, "")
end

Expand Down
52 changes: 32 additions & 20 deletions etc/ebook/build-pdf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def discourse_link comments_id

# Github code link at end of chapters
def github_code_link code_link, chapter_name
demo_github_repo = $config['sst_demo_repo']
backend_github_repo = $config['backend_github_repo']
frontend_github_repo = $config['frontend_github_repo']
frontend_fb_login_github_repo = $config['frontend_fb_login_github_repo']
Expand All @@ -36,6 +37,10 @@ def github_code_link code_link, chapter_name
link_text = "Backend Source: #{chapter_name}"
link = "#{backend_github_repo}/tree/#{chapter_name}"

elsif (code_link === 'sst-full')
link_text = "Notes App Source"
link = "#{demo_github_repo}"

elsif (code_link === 'frontend')
link_text = "Frontend Source: #{chapter_name}"
link = "#{frontend_github_repo}/tree/#{chapter_name}"
Expand Down Expand Up @@ -167,9 +172,16 @@ def build_chapter chapter_data
.gsub('➜', '\faLongArrowAltRight')

# Replace chapter specific content
if (chapter_name === 'wrapping-up')
chapter = chapter.gsub(/<a.*>Star our GitHub repo<\/a>/, "")
end
if (chapter_name === 'staying-up-to-date')
chapter = chapter.gsub(/<a.*>Subscribe<\/a>/, "")
end
if (chapter_name === 'translations')
chapter = chapter.gsub(/---[\s\S]*?---/, "")
end
if (chapter_name === 'wrapping-up-the-best-practices')
# Remove the survey http link button. The survey link already exist in the paragraph
# before it, it is redundant.
chapter = chapter.gsub(/<a.*>Fill out our survey<\/a>/, "")
end

Expand Down Expand Up @@ -197,24 +209,24 @@ def merge_chapters
chapter_list = YAML.load_file('../../_data/chapterlist.yml')
chapter_list.each do |section_key, section|

# Add section header in table of content
if (section_key === 'intro')
file << "\\addtocontents{toc}{~\\par}\n"
file << "\\addtocontents{toc}{~\\par}\n"
file << "\\addtocontents{toc}{\\centerline{\\textbf{The Basics}}\\par}\n"
elsif (section_key === 'best-practices-intro')
file << "\\addtocontents{toc}{~\\par}\n"
file << "\\addtocontents{toc}{~\\par}\n"
file << "\\addtocontents{toc}{\\centerline{\\textbf{Best Practices}}\\par}\n"
elsif (section_key === 'setup-serverless')
file << "\\addtocontents{toc}{~\\par}\n"
file << "\\addtocontents{toc}{~\\par}\n"
file << "\\addtocontents{toc}{\\centerline{\\textbf{Serverless Framework}}\\par}\n"
elsif (section_key === 'extra-backend')
file << "\\addtocontents{toc}{~\\par}\n"
file << "\\addtocontents{toc}{~\\par}\n"
file << "\\addtocontents{toc}{\\centerline{\\textbf{Extra Credit}}\\par}\n"
end
# # Add section header in table of content
# if (section_key === 'intro')
# file << "\\addtocontents{toc}{~\\par}\n"
# file << "\\addtocontents{toc}{~\\par}\n"
# file << "\\addtocontents{toc}{\\centerline{\\textbf{The Basics}}\\par}\n"
# elsif (section_key === 'best-practices-intro')
# file << "\\addtocontents{toc}{~\\par}\n"
# file << "\\addtocontents{toc}{~\\par}\n"
# file << "\\addtocontents{toc}{\\centerline{\\textbf{Best Practices}}\\par}\n"
# elsif (section_key === 'setup-serverless')
# file << "\\addtocontents{toc}{~\\par}\n"
# file << "\\addtocontents{toc}{~\\par}\n"
# file << "\\addtocontents{toc}{\\centerline{\\textbf{Serverless Framework}}\\par}\n"
# elsif (section_key === 'extra-backend')
# file << "\\addtocontents{toc}{~\\par}\n"
# file << "\\addtocontents{toc}{~\\par}\n"
# file << "\\addtocontents{toc}{\\centerline{\\textbf{Extra Credit}}\\par}\n"
# end

file << "\\part{" << section['title'] << "}\n\n"

Expand Down

0 comments on commit c8cc74b

Please sign in to comment.