<commit_before>#!/bin/bash

# Generate inline css
echo "<style>" > src/static/css/layout.css.html
cat src/static/css/layout.css >> src/static/css/layout.css.html
echo "</style>" >> src/static/css/layout.css.html

# Convert all .md files from pages/ into .html files
# 1. Insert inline source code directly into the article
# 2. Get location for the future converted .html file
# 3. Convert the .md file to .tmp.html file
#    Create the .html, containing header + .tmp.html + footer
# 4. Get and insert the title
# 5. Insert inline css
# 6. Transform the title into a link
# 7. Insert summary
# 8. Move the .html to its actual location in src/
find pages -iname "*.md" -type f -exec sh -c \
  'cp ${0} copy.md && \

   while grep -q "\[INSERT\]" copy.md; do
		line_number=`grep -n -m 1 "\[INSERT\]" copy.md | cut -d: -f 1` &&
		((line_number++)) &&

		filename=`sed "$line_number q;d" copy.md` &&
		extension="${filename##*.}" &&

      lenght=`cat $(dirname ${0})/$filename | wc -l` &&
      if [ $lenght -gt 20 ]; then
         sed -i "$line_number s/.*/\\\`\\\`\\\`\n<\/div>/" copy.md &&
         ((line_number--)) &&
         sed -i "$line_number s/.*/<a href=\"javascript:toggle_visibility('\''$filename'\'');\">$filename<\/a><div id=\"$filename\" style=\"display: none;\">\n\\\`\\\`\\\`$extension/" copy.md &&
         ((line_number++))
      else
         sed -i "$line_number s/.*/\\\`\\\`\\\`/" copy.md &&
         ((line_number--)) &&
         sed -i "$line_number s/.*/\\\`\\\`\\\`$extension/" copy.md<commit_msg>Fixed a bug caused on my laptop by the conversion script<commit_after>#!/bin/bash

# Generate inline css
echo "<style>" > src/static/css/layout.css.html
cat src/static/css/layout.css >> src/static/css/layout.css.html
echo "</style>" >> src/static/css/layout.css.html

# Convert all .md files from pages/ into .html files
# 1. Insert inline source code directly into the article
# 2. Get location for the future converted .html file
# 3. Convert the .md file to .tmp.html file
#    Create the .html, containing header + .tmp.html + footer
# 4. Get and insert the title
# 5. Insert inline css
# 6. Transform the title into a link
# 7. Insert summary
# 8. Move the .html to its actual location in src/
find pages -iname "*.md" -type f -exec sh -c \
  'cp ${0} copy.md && \

   while grep -q "\[INSERT\]" copy.md; do
		line_number=`grep -n -m 1 "\[INSERT\]" copy.md | cut -d: -f 1` &&
		line_number=$((line_number + 1)) &&

		filename=`sed "$line_number q;d" copy.md` &&
		extension="${filename##*.}" &&

      lenght=`cat $(dirname ${0})/$filename | wc -l` &&
      if [ $lenght -gt 20 ]; then
         sed -i "$line_number s/.*/\\\`\\\`\\\`\n<\/div>/" copy.md &&
         line_number=$((line_number - 1)) &&
         sed -i "$line_number s/.*/<a href=\"javascript:toggle_visibility('\''$filename'\'');\">$filename<\/a><div id=\"$filename\" style=\"display: none;\">\n\\\`\\\`\\\`$extension/" copy.md &&
         line_number=$((line_number + 1))
      else
         sed -i "$line_number s/.*/\\\`\\\`\\\`/" copy.md &&
         line_number=$((line_number - 1)) &&
         sed -i "$line_number s/.*/\\\`\\\`\\\`$extension/" copy.md
{'fraction_non_alphanumeric': 0.2119961916851793, 'fraction_numerical': 0.010155506188511583, 'mean_word_length': 2.553551296505073, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1298700', 'n_tokens_mistral': 1137, 'n_tokens_neox': 1064, 'n_words': 327}