Skip to content
This repository was archived by the owner on Jan 20, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/simple/postone.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Post One Title

This is the body of Post One.
This is the body of Post One.
14 changes: 14 additions & 0 deletions generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,17 @@
set -ex

# YOUR CODE HERE

mkdir -p "$2"

for post in $1/*
do

html="$(basename "$post" .txt).html"

titleField="$(head -n 1 "$post")"
bodyText="$(tail -n 1 "$post")"

echo "$post" | sed -e 's/{{body}}/'"$bodyText"'/' -e 's/{{title}}/'"$titleField"'/' template.html >> "$2/$html"

done
3 changes: 3 additions & 0 deletions test_folder/postone.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Post One Title

This is the body of Post One.
Binary file added tests/helpers.pyc
Binary file not shown.