Skip to content

Commit

Permalink
work flow to convert ipynb to qmd
Browse files Browse the repository at this point in the history
  • Loading branch information
weijie-chen committed Aug 14, 2024
1 parent 037b182 commit 41b65c5
Show file tree
Hide file tree
Showing 4 changed files with 118 additions and 54 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/convert-to-qmd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Convert Notebooks and Update Book

on:
push:
paths:
- 'notebooks/**.ipynb'

jobs:
convert-and-copy:
runs-on: ubuntu-latest

steps:
- name: Checkout the Linear_Algebra_with_Python repository
uses: actions/[email protected]

- name: Install Quarto
run: |
wget https://github.com/quarto-dev/quarto-cli/releases/download/v1.5.56/quarto-1.5.56-linux-amd64.tar.gz
tar -xvzf quarto-1.5.56-linux-amd64.tar.gz
sudo cp -r quarto-1.5.56/* /usr/local/
- name: Convert Notebooks to QMD
run: |
mkdir -p converted_chapters
for notebook in notebooks/*.ipynb; do
quarto convert "$notebook" --to qmd -o "converted_chapters/$(basename "$notebook" .ipynb).qmd"
done
- name: Checkout the weijie-chen.github.io repository
uses: actions/[email protected]
with:
repository: weijie-chen/weijie-chen.github.io
path: book_repo

- name: Copy Converted QMD Files to Book Repository
run: |
mkdir -p book_repo/linear-algebra-with-python-book/chapters
cp converted_chapters/*.qmd book_repo/linear-algebra-with-python-book/chapters/
- name: Update Table of Contents in index.html
run: |
toc=""
for chapter in book_repo/linear-algebra-with-python-book/chapters/*.qmd; do
chapter_name=$(basename "$chapter" .qmd)
toc="$toc<li>$chapter_name</li>\n"
done
sed -i '/<section class="table-of-contents">/,/<\/section>/{//!d}' book_repo/linear-algebra-with-python-book/index.html
sed -i "/<section class=\"table-of-contents\">/a $toc" book_repo/linear-algebra-with-python-book/index.html
- name: Commit and Push Changes
run: |
cd book_repo
git config user.name "GitHub Actions"
git config user.email "[email protected]"
git add linear-algebra-with-python-book/chapters/*
git add linear-algebra-with-python-book/index.html
git commit -m "Updated chapters and Table of Contents"
git push
68 changes: 34 additions & 34 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -131,42 +131,42 @@ <h1 style="margin-top: -40px;">
<hr>

<main>
<article>

<!-- <div class="language-link">
<a href="es.html">- Español -</a>
</div> -->

<p> <i>Linear Algebra with Python</i> is designed to
provide a comprehensive
refresher on the essential concepts of linear
algebra, tailored for professionals and students in
fields such as statistics, econometrics,
quantitative analysis, and data science. Whether
you're a seasoned expert or someone looking to
solidify your foundational knowledge, this guide
offers an in-depth exploration of critical topics in
linear algebra, enriched with Python-based
computation and visualization.</p>

<p>Throughout this book, we will delve into key concepts
that are pivotal for advanced quantitative skill
sets, including linear combinations, vector spaces,
linear transformations, eigenvalues and
eigenvectors, diagonalization, singular value
decomposition, and more. Each concept is carefully
explained and demonstrated with Python, making
abstract ideas more concrete and applicable to
real-world scenarios.</p>

<p>Ready to get started? Skip ahead to the <a
href="content/table_of_contents.html">Table of
Contents.</a>
</p>
<article>

<!-- <div class="language-link">
<a href="es.html">- Español -</a>
</div> -->

<p> <i>Linear Algebra with Python</i> is designed to
provide a comprehensive
refresher on the essential concepts of linear
algebra, tailored for professionals and students in
fields such as statistics, econometrics,
quantitative analysis, and data science. Whether
you're a seasoned expert or someone looking to
solidify your foundational knowledge, this guide
offers an in-depth exploration of critical topics in
linear algebra, enriched with Python-based
computation and visualization.</p>

<p>Throughout this book, we will delve into key concepts
that are pivotal for advanced quantitative skill
sets, including linear combinations, vector spaces,
linear transformations, eigenvalues and
eigenvectors, diagonalization, singular value
decomposition, and more. Each concept is carefully
explained and demonstrated with Python, making
abstract ideas more concrete and applicable to
real-world scenarios.</p>

<p>Ready to get started? Skip ahead to the <a
href="content/table_of_contents.html">Table of
Contents.</a>
</p>

<hr>
<hr>

<h2 style="text-align: center;">WHAT IT IS ABOUT</h2>
<h2 style="text-align: center;">WHAT IT IS ABOUT</h2>

<div
style=" text-wrap: wrap; display: flex; justify-content: center;">
Expand Down
12 changes: 5 additions & 7 deletions linear-algebra-with-python-book/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ body {
cursor: pointer;
}

/* Article styling */
/* introduction */
.introduction {
display: flex;
flex-direction: column;
Expand All @@ -99,9 +99,7 @@ body {
color: var(--text-color);
background-color: var(--second-bg-color);
border-radius: 10px;
}

/* Smooth transition for fixed elements */
#book-cover {
transition: top 0.5s ease-in-out;
}
margin: 20px auto 0 auto; /* Center the section horizontally */
max-width: 900px; /* Limit the width of the section */
line-height: 1.6;
}
34 changes: 21 additions & 13 deletions linear-algebra-with-python-book/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,9 @@ <h2>Weijie Chen</h2>
</section>

<section class="introduction">

<!-- <div class="language-link">
<a href="es.html">- Español -</a>
</div> -->

<h2>INTRODUCTION</h2>
<br>
<br>
<p> <i>Linear Algebra with Python</i> is designed to
provide a comprehensive
refresher on the essential concepts of linear
Expand All @@ -45,7 +43,7 @@ <h2>Weijie Chen</h2>
offers an in-depth exploration of critical topics in
linear algebra, enriched with Python-based
computation and visualization.</p>

<br>
<p>Throughout this book, we will delve into key concepts
that are pivotal for advanced quantitative skill
sets, including linear combinations, vector spaces,
Expand All @@ -56,14 +54,24 @@ <h2>Weijie Chen</h2>
abstract ideas more concrete and applicable to
real-world scenarios.</p>

<p>Ready to get started? Skip ahead to the <a
href="content/table_of_contents.html">Table of
Contents.</a>
</p>

<hr>
</section>
<h2 style="text-align: center;">WHAT IT IS ABOUT</h2>
</section>
<section class="table-of-contents">
<h2>TABLE OF CONTENTS</h2>
<br>
<br>
<!-- <ul>
<li>Chapter 1: Introduction to Linear Algebra</li>
<li>Chapter 2: Linear Combinations and Span</li>
<li>Chapter 3: Vector Spaces</li>
<li>Chapter 4: Linear Transformations</li>
<li>Chapter 5: Eigenvalues and Eigenvectors</li>
<li>Chapter 6: Diagonalization</li>
<li>Chapter 7: Singular Value Decomposition</li>
<li>Chapter 8: Applications of Linear Algebra</li>
</ul> -->
<hr>
</section>



Expand Down

0 comments on commit 41b65c5

Please sign in to comment.