mirror of
http://git.davidovski.xyz/shblg.git
synced 2024-08-15 00:43:48 +00:00
create example site where every page is executed to generate itself
This commit is contained in:
parent
af75a700c5
commit
52e9c3aeea
7 changed files with 132 additions and 7 deletions
45
example/entries/entries.sh
Executable file
45
example/entries/entries.sh
Executable file
|
@ -0,0 +1,45 @@
|
|||
#!/bin/sh
|
||||
|
||||
# add a special header to all entries
|
||||
cat << EOF
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>$1</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>my blog</h1>
|
||||
EOF
|
||||
|
||||
# make this page be the index if it is called with no arguments
|
||||
[ -z "$1" ] && {
|
||||
cat << EOF
|
||||
<h2>blog entries</h2>
|
||||
<ul>
|
||||
EOF
|
||||
# list all the files in the directory
|
||||
for file in *.md; do
|
||||
printf "<li><a href=\"%s\">%s</a></li>" "${file%.*}.html" "$file"
|
||||
done
|
||||
|
||||
cat << EOF
|
||||
</ul>
|
||||
EOF
|
||||
|
||||
} || {
|
||||
# convert the markdown page to html text
|
||||
md2html $1
|
||||
|
||||
# add a back button
|
||||
cat << EOF
|
||||
<span><a href="entries.html">go back to list</a></span>
|
||||
EOF
|
||||
}
|
||||
|
||||
# and a footer
|
||||
cat << EOF
|
||||
</body>
|
||||
</html>
|
||||
EOF
|
||||
|
13
example/entries/entry1.md
Executable file
13
example/entries/entry1.md
Executable file
|
@ -0,0 +1,13 @@
|
|||
#!./entries.sh
|
||||
|
||||
# first blog entry
|
||||
|
||||
hello welcome to my test blog. here i will be talking about blah
|
||||
|
||||
## something else
|
||||
|
||||
i probably have something else to say here
|
||||
|
||||
## conclusion
|
||||
|
||||
this is the conclusion, thank you
|
9
example/entries/entry2.md
Executable file
9
example/entries/entry2.md
Executable file
|
@ -0,0 +1,9 @@
|
|||
#!./entries.sh
|
||||
|
||||
# day 2
|
||||
|
||||
this is a second entry to my blog
|
||||
|
||||
i learned how to make text **bold** and *italic*
|
||||
|
||||
wow isnt that ***cool???***
|
63
example/index.md
Executable file
63
example/index.md
Executable file
|
@ -0,0 +1,63 @@
|
|||
#!/usr/bin/env md2html
|
||||
|
||||
# This is a test md file hello
|
||||
|
||||
This is *italics* this is **bold** this is ***both*** wow (this is in brackets ssh) and [this is in square brackets not a anchor lol]
|
||||
|
||||
click [here](http) for stuff and [over here](http12 "my title") for more
|
||||
|
||||
and [click here](http://this_has_stuffinside) too
|
||||
|
||||

|
||||
|
||||
this is a paragraph
|
||||
with many lines
|
||||
that are joined together
|
||||
|
||||
> this is a quote hi
|
||||
|
||||
ok that was a quote
|
||||
|
||||
> this quote has a list inside it
|
||||
> - this is a list in a quote
|
||||
> - it was quoted
|
||||
>
|
||||
> and also there is another quote;
|
||||
>> Hi i am a quote
|
||||
|
||||
|
||||
haha
|
||||
|
||||
- this is a list
|
||||
- of items
|
||||
- please dont
|
||||
- break
|
||||
|
||||
ok
|
||||
|
||||
int main() {
|
||||
printf("hello %s\n", "world");
|
||||
}
|
||||
|
||||
int func(int* a) {
|
||||
return a;
|
||||
}
|
||||
|
||||
- list
|
||||
- sublist
|
||||
- subsublist
|
||||
- subsubsublist
|
||||
|
||||
|
||||
* star list
|
||||
* this is a star
|
||||
|
||||
+ plus now wow
|
||||
+ plus wow so cool
|
||||
|
||||
1. hello
|
||||
2. world
|
||||
3. lOL
|
||||
|
||||
|
||||
> ok that worked?
|
Loading…
Add table
Add a link
Reference in a new issue