Skip to content

Commit

Permalink
Testing removing tags
Browse files Browse the repository at this point in the history
  • Loading branch information
jayair committed Aug 30, 2023
1 parent 6d2deed commit 1143fda
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
8 changes: 8 additions & 0 deletions _chapters/handling-secrets-in-sst.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,11 @@ 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%}
12 changes: 12 additions & 0 deletions etc/ebook/build-epub.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,21 @@ def build_chapter chapter_data
# Remove class in table
chapter = chapter.gsub('{: .cost-table }', '')

# Remove image widths
chapter = chapter.gsub('\{:\s*width\s*=\s*"\d+"\s*\}', '')

# Remove {% raw %} and {% endraw %} tags
chapter = chapter.gsub(/{% (raw|endraw) %}/, '')

# Replace admonition start tags
chapter = chapter.gsub(/{%\s*(note)\s*%\}\s*/, 'Note: ')
chapter = chapter.gsub(/{%\s*(info)\s*%\}\s*/, 'Info: ')
chapter = chapter.gsub(/{%\s*(caution)\s*%\}\s*/, 'Caution: ')
# Remove admonition end tags
chapter = chapter.gsub(/\s*{%\s*(endnote)\s*%\}/, '')
chapter = chapter.gsub(/\s*{%\s*(endinfo)\s*%\}/, '')
chapter = chapter.gsub(/\s*{%\s*(endcaution)\s*%\}/, '')

# Replace site variables
$config.each do |variable|
chapter = chapter.gsub(/{{ site.#{variable[0].to_s} }}/, variable[1].to_s)
Expand Down
12 changes: 12 additions & 0 deletions etc/ebook/build-pdf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,21 @@ def build_chapter chapter_data
# Remove class in table
chapter = chapter.gsub('{: .cost-table }', '')

# Remove image widths
chapter = chapter.gsub('\{:\s*width\s*=\s*"\d+"\s*\}', '')

# Remove {% raw %} and {% endraw %} tags
chapter = chapter.gsub(/{% (raw|endraw) %}/, '')

# Replace admonition start tags
chapter = chapter.gsub(/{%\s*(note)\s*%\}\s*/, 'Note: ')
chapter = chapter.gsub(/{%\s*(info)\s*%\}\s*/, 'Info: ')
chapter = chapter.gsub(/{%\s*(caution)\s*%\}\s*/, 'Caution: ')
# Remove admonition end tags
chapter = chapter.gsub(/\s*{%\s*(endnote)\s*%\}/, '')
chapter = chapter.gsub(/\s*{%\s*(endinfo)\s*%\}/, '')
chapter = chapter.gsub(/\s*{%\s*(endcaution)\s*%\}/, '')

# Replace site variables
$config.each do |variable|
chapter = chapter.gsub(/{{ site.#{variable[0].to_s} }}/, variable[1].to_s)
Expand Down

0 comments on commit 1143fda

Please sign in to comment.