Browse Source

Let's get this shit started

master
Tolstoevsky 4 months ago
parent
commit
90dd27238b
6 changed files with 142 additions and 5 deletions
  1. +4
    -0
      .smolsh/hdr1
  2. +6
    -0
      .smolsh/hdr2
  3. +58
    -0
      .smolsh/main.css
  4. +26
    -5
      README.md
  5. +21
    -0
      init.sh
  6. +27
    -0
      smol.sh

+ 4
- 0
.smolsh/hdr1 View File

@@ -0,0 +1,4 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>


+ 6
- 0
.smolsh/hdr2 View File

@@ -0,0 +1,6 @@
<link rel="stylesheet" href="static/main.css"/>
<link rel="alternate" href="feed.atom" type="application/atom+xml"/>
<meta charset="utf-8"/>
</head>
<body>


+ 58
- 0
.smolsh/main.css View File

@@ -0,0 +1,58 @@
body {
font-family: "DejaVu Sans", sans; }

main, article {
padding: 2ch; }

th, td {
padding: .5ch; }

article, p, img, h1, h2, h3, h4, h5 {
max-width: 80ch; }

pre {
display: block;
overflow: auto;
padding-left: 1ch; }

header > h1 {
font-weight: bold;
text-transform: capitalize; }

header a, header a:hover {
text-decoration: none;
font-family: monospace; }

a:hover {
text-decoration: underline; }

pre {
border-left-width: 1mm solid; }

th, td {
border-top-color: #333; }

tr:hover {
background-color: #222; }

body {
background-color: #1a1a26; }

body, header a, header a:visited {
color: #f2f2f2; }

pre {
border-left-color: #f2f2f233; }

a {
color: PaleTurquoise; }

article {
background-color: rgba(100, 100, 100, 0.1);
border: 1px solid rgba(100, 100, 100, 0.2); }

.abstract, .meta {
color: #909090; }

.pipe {
opacity: .3; }

+ 26
- 5
README.md View File

@@ -1,7 +1,28 @@
# smolsh

This is bash-driven static website generator.
It is simpl!
It is mnmlistic!
It is smol!
This is bash-driven static website generator.
It is simpl!
It is mnmlistic!
It is smol!

version pre-alfa 0.0.0.1

---

## Requirements:

- Linux shell
- md2html

## Usage

- clone this repo
- run init.sh
- enter blog name
- post using smol.sh
- publish your 'html' directory


---
Product of Govnokod Software.
Licenseed under WTFPL.

+ 21
- 0
init.sh View File

@@ -0,0 +1,21 @@
#!/bin/bash
cat .smolsh/hdr1 > .smolsh/header.txt
echo "Let's get it started. Enter your website name (e.g. \"Joe's blog\" or so):"
read site_name
echo " <title>$site_name</title>" >> .smolsh/header.txt
cat .smolsh/hdr2 >> .smolsh/header.txt
mkdir md
mkdir html
mkdir html/static
cat .smolsh/main.css html/static/main.css
chmod -x init.sh
chmod +x smol.sh
cat .smolsh/header.txt > html/index.html
echo "# $site_name" > md/index.md
echo >> md/index.md
echo "## Publications:" >> md/index.md
md2html md/index.md > html/index.html
echo "Now use smol.sh to start posting"
echo "Just type ./smol.sh <postname> and we\'ll begin"
echo "Yep. And postname may not contain spaces"


+ 27
- 0
smol.sh View File

@@ -0,0 +1,27 @@
#!/bin/bash
echo "/// Now write your post here " > /tmp/psto
echo "/// use Markdown syntax" >> /tmp/psto
echo "/// as soon you've done - save the file and quit editor." >> /tmp/psto
echo "/// Lines started with /// will be ignored." >> /tmp/psto
$EDITOR /tmp/psto
grep -v "///" /tmp/psto > ./md/$1.md
md2html ./md/$1.md > /tmp/html.txt
cat .smolsh/header.txt | cat - /tmp/html.txt > html/$1.html
echo " </body>" >> html/$1.html
echo "</html>" >> html/$1.html
short=$(head -c 128 md/$1.md)
curdate=$(date +%Y-%m-%d_%H:%M)
echo "### [$1 ($curdate)]($1.html)" > /tmp/insert.txt
echo "$short [...]($1.html)" >> /tmp/insert.txt
echo "" >> /tmp/insert.txt
echo "---" >> /tmp/insert.txt
echo "" >> /tmp/insert.txt
cp md/index.md /tmp/
i=$(cat /tmp/insert.txt)
awk -v ins="$i" '{print} /## Publications/{print ins}' /tmp/index.md > md/index.md
md2html md/index.md > /tmp/index.html
cat .smolsh/header.txt | cat - /tmp/index.html > html/index.html
echo " </body>" >> html/index.html
echo "</html>" >> html/index.html



Loading…
Cancel
Save