Re: Plain text file on web server, questions please...



On Sun, 17 Jun 2007 15:52:27 +0200 (CEST), Ohmster wrote:

Since I do not want to have two copies of the FAQ (More chance for
errors and also more work to maintain.), is there any way in Linux to
automate making an HTML wrapper to throw around this text document,
strictly for online viewing that would add the HTML tags to the online
version such as <body></body>, and especially the link tags like this:

<A href="http://www.foobar.com/foobarFAQ.txt";>FAQ</A>

I have been using Linux for over ten years but some of the really in
depth stuff I really am not familiar with (Just ask me what "awk" is, I
will probably tell you that it is a sound that birds make. <g>) Is there
a utility that would do this or can it be done with a shell script
perhaps? All links in the text document would begin with http:// and
that is something identifiable to search for if one were to try and
script it.

Just for fun, create fyi.txt, head.html and tail.html files.

head.html has
<HTML>
<BODY BGCOLOR="#99CCCC" LINK="#0000FF" VLINK="#FF0000"
ALINK="#FF0000" TEXT="#000000">

<pre>

tail.html has

</pre>
</BODY>
</HTML>


faq.txt has

Today's tip
For extra points, read http://tldp.org/LDP/abs/html/index.html


Now run the command
cat head.html faq.txt tail.html > aa.html

To test, put aa.html in your browser and see if it works.

Could cron be used to copy the document over prior to adding the HTML
tags right before posting and then when posting again, do the same
thing, this way that if anything changed in the FAQ, it would also be
changed in the online version as well?

Well, your script just does the commands you would do by hand. You
have to figure out how to compute any variables.

I have a humor/fyi email list kinda like you do.
Instead of version I used date.

_date=$(date +%Y-%m-%d)
cat head.html joke.txt tail.html > joke_${_date}.html
cat head.html fyi.txt tail.html > fyi_${_date}.html

Those create joke_2007-06-17.html and fyi_2007-06-17.html

You can store a variable in a file. Script fetches it, bump it, save it,
use it.
#********* start of snippet **************
# read, bump,save version

source /somewhere/version
_ver=$(( $_ver + 1))
echo _ver=$_ver > /somewhere/version

cat head.html faq.txt tail.html > aa_$_ver.html
#********* end of snippet **************



For extra points, read http://tldp.org/LDP/abs/html/index.html
.



Relevant Pages

  • Re: Plain text file on web server, questions please...
    ... I like to keep a single copy of this FAQ and then ... week and the FAQ is online all the time. ... it has no HTML tags in it to designate URL links and one ... a utility that would do this or can it be done with a shell script ...
    (alt.os.linux)
  • Re: FAQ Topic - What online resources are available?
    ... FAQ Topic - What online resources are available? ... Javascript FAQ site, please check first:- ... JScript reference and main Microsoft script site:- ...
    (comp.lang.javascript)
  • Re: Plain text file on web server, questions please...
    ... I like to keep a single copy of this FAQ and then ... week and the FAQ is online all the time. ... it has no HTML tags in it to designate URL links and one ... a utility that would do this or can it be done with a shell script ...
    (alt.os.linux)
  • Re: Dynamic loading of javascript files into web pages
    ... I saw a video online. ... Why wasn't it in the FAQ? ... Moving the script to the bottom helps, ... it ought to mention that his application design advice is considerably harmful. ...
    (comp.lang.javascript)
  • CMUCL "-script" hack now available
    ... CMUCL won't start up correctly.] ... $ cat script_header.cmucl ... If you want a script which just sets up an environment ... Welcome to the customized test REPL ...
    (comp.lang.lisp)