'
+fi
-ATTACH_IMAGE_TEMPLATE='
+
+if test -z "$ATTACH_IMAGE_TEMPLATE"; then
+ ATTACH_IMAGE_TEMPLATE='
'
+fi
-EMOJI_TEMPLATE=''
+
+if test -z "$EMOJI_TEMPLATE"; then
+ EMOJI_TEMPLATE=''
+fi
# Given a note’s JSON, render it as HTML.
@@ -345,7 +354,18 @@ usage() {
echo " $(basename "$0") [-h] [-IRc] [-bBt] USER_URL"
echo
echo "$(basename "$0") does exactly what it says on the tin: It formats"
- echo 'a fediverse post (and its replies) into simple-and-embeddable HTML.'
+ echo 'a fediverse post (and its replies) into text. By default, into'
+ echo 'simple-and-embeddable HTML.'
+ echo
+ echo ' -c only print the responses (children) of a post'
+ echo ' -h print this message and exit'
+ echo ' -I display posts in reverse-chronological order'
+ echo ' -l output at maximum the specified amount of posts'
+ echo ' -R do not recursively display posts’ responses'
+ echo
+ echo ' -b exclude reblogs/repeats from user feed'
+ echo ' -B exclude top-level replies from user feed'
+ echo ' -t filter posts from user feed by tag'
echo
echo 'It works with posts from any server that supports Mastodon’s API,'
echo 'including Pleroma, Akkoma, Glitch, etc.'
@@ -355,15 +375,26 @@ usage() {
echo 'if privacy or total archival, is a concern, to use wget(1)’s --mirror'
echo '(or something like it) to fetch even these foreign files.'
echo
- echo ' -c only print the responses (children) of a post'
- echo ' -h print this message and exit'
- echo ' -I display posts in reverse-chronological order'
- echo ' -l output at maximum the specified amount of posts'
- echo ' -R do not recursively display posts’ responses'
- echo
- echo ' -b exclude reblogs/repeats from user feed'
- echo ' -B exclude top-level replies from user feed'
- echo ' -t filter posts from user feed by tag'
+ echo '“Template” environment variables are used to generate the text'
+ echo 'output. A template is a string that contains shell-style variable'
+ echo "names (\$NAME) that $(basename "$0") will replace."
+ echo 'They are $POST_TEMPLATE, $ATTACH_TEMPLATE, and $EMOJI_TEMPLATE.'
+ echo
+ echo 'The variables that can be used in $POST_TEMPLATE are:'
+ echo ' $ACCOUNT_ID, $ACCOUNT_URL, $ACCOUNT_NAME, $ACCOUNT_AVATAR,'
+ echo ' $POST_URL, $POST_DATE, $POST_CONTENT, $POST_ATTACHMENTS,'
+ echo ' and $POST_RESPONSES.'
+ echo
+ echo 'The variables that can be used in $ATTACH_TEMPLATE are:'
+ echo ' $ATTACH_URL, $ATTACH_NAME, $ATTACH_TYPE, $ATTACH_DESC,'
+ echo ' and $ATTACH_PREVIEW.'
+ echo
+ echo 'The variables that can be used in $EMOJI_TEMPLATE are:'
+ echo ' $EMOJI_SHORTCODE and $EMOJI_URL.'
+ echo
+ echo 'See the first few lines of fedi2html for the default (example)'
+ echo 'template values; see the README for a more detailed description'
+ echo 'of these variables’ meanings.'
}