init
This commit is contained in:
commit
d013ece0f3
363 changed files with 20823 additions and 0 deletions
36
scripts/add_update_frontmatter.sh
Executable file
36
scripts/add_update_frontmatter.sh
Executable file
|
@ -0,0 +1,36 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Current date for the 'updated' field
|
||||
current_date=$(date +%F)
|
||||
|
||||
# Recursive search for all markdown files in the content folder
|
||||
find ../content -type f -name "*.md" | while read file; do
|
||||
# Check if the file has frontmatter enclosed in +++
|
||||
if [ "$(head -n 1 "$file")" = "+++" ]; then
|
||||
# Check if the 'date' field exists in the frontmatter
|
||||
if grep -q '^date\s*=' "$file"; then
|
||||
# Check if the 'updated' field is already present
|
||||
if grep -q '^updated\s*=' "$file"; then
|
||||
echo "✘ Skipped: 'updated' field already present in $file"
|
||||
else
|
||||
# Use awk to insert the 'updated' field after the 'date' field
|
||||
awk -v date="$current_date" '
|
||||
BEGIN { inserted=0 }
|
||||
/^date\s*=/ && inserted == 0 {
|
||||
print $0
|
||||
print "updated = " date
|
||||
inserted = 1
|
||||
next
|
||||
}
|
||||
{ print }
|
||||
' "$file" > "$file.tmp" && mv "$file.tmp" "$file"
|
||||
|
||||
echo "✔ Inserted 'updated' after date in $file"
|
||||
fi
|
||||
else
|
||||
echo "✘ No date field found in the frontmatter of $file"
|
||||
fi
|
||||
else
|
||||
echo "✘ No frontmatter found in $file"
|
||||
fi
|
||||
done
|
22
scripts/create_german_stubs.sh
Executable file
22
scripts/create_german_stubs.sh
Executable file
|
@ -0,0 +1,22 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
CONTENT_DIR="../content"
|
||||
|
||||
find "$CONTENT_DIR" -type f \( -name 'index.md' -o -name '_index.md' \) | while read -r file; do
|
||||
base="${file%.md}" # Remove .md
|
||||
new_file="${base}.de.md" # Append .de.md
|
||||
|
||||
if [ ! -f "$new_file" ]; then
|
||||
echo "Creating $new_file"
|
||||
cp "$file" "$new_file"
|
||||
|
||||
# macOS-compatible sed (empty backup extension)
|
||||
sed -i '' 's/^title = "\(.*\)"/title = "Übersetzung: \1"/' "$new_file"
|
||||
else
|
||||
echo "Skipping $new_file (already exists)"
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
echo "German stub creation complete."
|
21
scripts/organize.sh
Executable file
21
scripts/organize.sh
Executable file
|
@ -0,0 +1,21 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Regex pattern for ISO date format filenames like 2019-06-01-something.md
|
||||
pattern='^[0-9]{4}-[0-9]{2}-[0-9]{2}-.+\.md$'
|
||||
|
||||
echo "Processing markdown files in $(pwd)"
|
||||
echo
|
||||
|
||||
for file in *.md; do
|
||||
# Skip if no matching files (glob doesn't find anything)
|
||||
[ -e "$file" ] || continue
|
||||
|
||||
if [[ "$file" =~ $pattern ]]; then
|
||||
basename="${file%.md}"
|
||||
mkdir -p "$basename"
|
||||
mv "$file" "$basename/index.md"
|
||||
echo "✔ Processed: $file → $basename/index.md"
|
||||
else
|
||||
echo "✘ Skipped (pattern mismatch): $file"
|
||||
fi
|
||||
done
|
11
scripts/youtube_rewrite.sh
Executable file
11
scripts/youtube_rewrite.sh
Executable file
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Set the path to the content folder
|
||||
CONTENT_DIR="../content"
|
||||
|
||||
# Loop through all markdown files in the content folder
|
||||
find "$CONTENT_DIR" -type f -name "*.md" | while read -r file; do
|
||||
# Use sed to replace the old format with the new format while preserving the YouTube ID
|
||||
sed -i '' -E 's|{% include video id="([a-zA-Z0-9_-]+)" provider="youtube" %}|{{ youtube(id="\1") }}|g' "$file"
|
||||
echo "Processed: $file"
|
||||
done
|
Loading…
Add table
Add a link
Reference in a new issue