Generate nice ansi themed BBS news from a simple textfile
None required. Simply run newsmag.pl or newsmag.pl -h for help.
usage: newsmag.pl [options] --filehdr=newshdr.ans Header template --fileftr=newsftr.ans Footer template --fileentry=entryhdr.ans Entries template --infile=news.txt Input text-file --outfile=news.ans Output ansi-file --encoding=CP437 Output file encoding --num=0 Only display <num> entries (0=all) -p | --print Print output to STDOUT -q | --quiet Be quiet (overrides -p) -h | --help Print this help --longhelp Print more detailed help
By default, newsmag searches for the input text-file and all templates at the directory, you're in while running the script, but you can provide alternative paths and filenames for everything. Check newsmag.pl -h for a list of all available options and their default values.
Parameter: --infile= \
You write news in this file using this very simple format:
<DATE> <SUBJECT> <CONTENT> <MORE CONTENT> <...> @NEXT@ <DATE> <SUBJECT> <CONTENT>
Order doesn't matter, NewsMag always sorts the input by date, newest first.
NewsMag comes with some template examples, you are free to use. But you can also create your own using the examples and/or this description:
parameter: --filehdr= \
This file holds your header template to be displayed above all the news. It has no special variables (yet)..
parameter: --fileftr= \
This file holds your footer template to be displayed beneath all the news. It can hold one special variable: @COPYRIGHT@ - Will be replaced by a short copyright notice. If omitted the notice will be auto-appended below the footer.
parameter: --fileentry= \
This file holds your entry-template used to display each news entry. It must hold three special variables:
|@DATE@||Will be replaced by the first line of your entries at news.txt|
|@SUBJECT@||Will be replaced by the second line of your entries at news.txt|
|@CONTENT@||Will be replaced by all the lines between the second and the next one containing the tag "@NEXT@" (See section "INPUT FILE") Also takes all characters to the left and repeats them on subsequent lines.|
You can pad these variables to fit into your template files by appending <length><direction>@.
|@DATE@16L@||This will pad the date to 16 characters by adding whitespace to the left.|
|@SUBJECT@32R@||This will pad the subject to 32 characters by adding whitespace to the right.|
Content lines are wrapped to 75 characters by default. Also, all characters to the left of the @CONTENT@ tag in your template.ans are repeated on subsequent lines.
You can change the line width by adding <width>@ to the variable.
|@SUBJECT@70@||This will wrap lines at 70 characters.|
If any of these template files are omitted or not found, NewsMag will use very simple, hardcoded defaults.
parameter: --outfile= \
Using all these different input files, NewsMag creates one huge ansi-file containing all news entries from your news.txt. You can limit the news to be displayed with the option --num=<num>
Some BBS systems automaticaly display files called "news.ans" at the login process if they have changed since the users last visit. some other systems have to be configured that way.
For MysticBBS, I've attached a small .mps script you can include into your "prelogin" menu with the name of your news.ans inside the text directory of your MysticBBS theme:
Now, users will see the news.ans inside the "text-directory" of your BBS (default: /mystic/text) everytime they log in and the file has changed since their last login.
At the moment, the attached .mps is simply the onlyonce.mps, which comes with MysticBBS, but with a "Pause Prompt" at the end. Probably, I'll enhance it later..
Copyright (C) 2018 Philipp Giebel stimpy <ÄT> kuehlbox.wtf
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.