~tdarb/shinobi-script

12f70163383f790ebe71c5e4b5facca5227c0f49 — Bradley Taunt 2 years ago 9cd980e patch-2
Update configuration variables and include advance setting text wrap instructions in README
2 files changed, 56 insertions(+), 4 deletions(-)

M README
M script.sh
M README => README +39 -0
@@ 15,6 15,45 @@ In your terminal simply run `make serve` then navigate to `localhost:8000`.
You will also be able to inspect and test the generated `feed.xml` file.


ADVANCED SETTING: WRAPPING PLAIN TEXT
-------------------------------------

If you would prefer to have your posts set to wrap at a certain character
length (72 is set by default) then follow the process below:

1. Create a new folder in your root directory named "_posts"
2. Move any existing posts to this directory (and create all new articles
here as well moving forward)
3. Open your `script.sh` for editing
4. Uncomment the `RW_DIR` variable in the "Configuration" section
5. Uncomment the following two lines in the `script.sh` file:

```shell
for i in $(find $RW_DIR -type f); do cp $i $POST_DIR ; done
for i in $(find $POST_DIR -type f); do fold -s -w 72 $i > $i.temp; mv $i.temp $i ; done
```

6. Replace the following sections of code (lines 36 and 42):

  Change:
  <link>$DOMAIN/$file</link>
  To:
  <link>$DOMAIN/$POST_DIR$(basename ${file})</link>

  Change:
  <guid>$DOMAIN/$file</guid>
  To:
  <guid>$DOMAIN/$POST_DIR$(basename ${file})</guid>

That's it! The reason for making this process somewhat more _complex_ than
simply formatting the posts themselves has to do with RSS Feed Readers.
We want to avoid ugly and misplaced line breaks in Reader apps. We also
want to keep the user in full control of how they can consume their feeds.

If this looks a little too confusing for you, don't worry! This is completely
optional and is disabled by default.


TESTED RSS READERS (WIP)
------------------------


M script.sh => script.sh +17 -4
@@ 1,18 1,31 @@
#!/bin/sh

# Configuration
DOMAIN="YOUR-DOMAIN"
TITLE="YOUR-TITLE"
DESCRIPTION="YOUR-DESCRIPTION"
COPYRIGHT="YOUR-COPYRIGHT-INFO"
# RW_DIR="_posts/"
POST_DIR="posts/"
TTL="60"
AUTHOR="YOUR-EMAIL (YOUR-NAME)"
TIME=$(date +"%T %Z")

# Advanced Setting: Automatically wrap plain text files at 72 character limit
# Detailed documentation: https://git.sr.ht/~tdarb/shinobi-script
#
# for i in $(find $RW_DIR -type f); do cp $i $POST_DIR ; done
# for i in $(find $POST_DIR -type f); do fold -s -w 72 $i > $i.temp; mv $i.temp $i ; done

echo "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>
<?xml-stylesheet href=\"rss.xsl\" type=\"text/xsl\"?>
<rss version=\"2.0\">
  <channel>
    <title>YOUR-BLOG-TITLE</title>
    <title>$TITLE</title>
    <link>$DOMAIN</link>
    <description>YOUR-BLOG-DESCRIPTION</description>
    <copyright>YOUR-COPYRIGHT-INFO</copyright>
    <ttl>60</ttl>";
    <description>$DESCRIPTION</description>
    <copyright>$COPYRIGHT</copyright>
    <ttl>$TTL</ttl>";

for file in $POST_DIR*; do