Skip to content

Commit

Permalink
Tweaking ebook scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
jayair committed Aug 30, 2023
1 parent 109a110 commit e6ab0d0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 24 deletions.
3 changes: 0 additions & 3 deletions etc/ebook/build-epub.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,6 @@ def build_chapter chapter_data
# Replace images path
chapter = chapter.gsub(/\/assets\//, '../../assets/')

# Remove unsupported font characters
chapter = chapter.gsub('➜', '>')

# Remove target blank
chapter = chapter.gsub('{:target="_blank"}', '')

Expand Down
40 changes: 19 additions & 21 deletions etc/ebook/build-pdf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,6 @@ def build_chapter chapter_data
# Replace images path
chapter = chapter.gsub(/\/assets\//, '../../assets/')

# Remove unsupported font characters
chapter = chapter.gsub('➜', '>')

# Remove target blank
chapter = chapter.gsub('{:target="_blank"}', '')

Expand Down Expand Up @@ -155,6 +152,7 @@ def build_chapter chapter_data
chapter = chapter
.gsub('→', '\faLongArrowAltRight')
.gsub('⇒', '\faLongArrowAltRight')
.gsub('➜', '\faLongArrowAltRight')

# Replace chapter specific content
if (chapter_name === 'wrapping-up-the-best-practices')
Expand Down Expand Up @@ -187,24 +185,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 e6ab0d0

Please sign in to comment.