How I Use/Used Linux to Create/Maintain this Website

by David S.Lawyer mailto:dave@lafn.org

May 2001

1. Writen in Linuxdoc SGML using the vim editor

This site was both created and updated by free Linux software running on a 486 PC. The free vim editor (a powerful modal editor) was used to type the files. To create html (many files are plain text), a sgml (Standard Generalized Markup Language) of type Linuxdoc was used. Most Linuxdoc tags were entered using only a couple of keystrokes using vim's mapping feature. Then it was converted to html using sgml2html. I do it this way since Linuxdoc is a lot simpler to type than HTML. The Linuxdoc files can also be automatically converted to other formats including plain text. A makefile (see below) automatically generates the html files from the source sgml files when needed using an implicit rule (in makefile) that I wrote to replace the builtin rules.

2. Keeping this site up-to-date

A master copy of the site is kept on my PC in the /website tree. This is used to update my site. To update the site I type "web" which runs the function I defined in /etc/profile:

#Funct for update my website (should be connected to net)

web () { cd /home/dave/website; mk --no-print-directory ;\
 command /usr/bin/sitecopy --update lafn ; cd - ; }

This will first go to my "website" folder and run the "make" command (abbreviated as "mk"). See makefile. Then it contacts my website by ftp and copies to it any updated files that have changed since the last time I updated my site. The configuration file ~/.sitecopyrc tells it what the properties of my site at lafn are and what files not to upload (* is a wildcard). Here's a copy of ~/.sitecopyrc:

`>>

#Configuration for my www.lafn.org/~dave website updating using sitecopy
  site lafn
  server www.lafn.org 
  url http://www.lafn.org/~dave
  username dave
  local ~/website/
  remote ~/
  safe
  symlinks follow
  nodelete
# exclude "*.sgml" (backup)
# exclude makefile (stored on site as a backup)
  exclude "*.bak"
  exclude type_web_to_update

Note that I use symbolic links and instruct the upload program (sitecopy) to follow them: "symlinks follow". This is because most of the files for my site don't actually reside in the ~/website/ tree but are only sym links to other files residing in a variety of folders (directories) on my Linux PC at home. A password is provided too but for obvious reasons I can't discuss it.

3. Makefile for converting .sgml files into HTML files

`>>


# Makefile for David S. Lawyer's website.  Run from the ~/website
# directory.  To aviod the overhead of builtin-rules use "mk" command,
# a function I defined in etc/profile with flag --no-builtin-rules.
# Easiest way to run is to type "web", defined in /etc/profile.

# Here's a list of targets (the .html files I want to make from .sgml
# files).  Note the use of the variable i.
i = index.html
index = ./$(i) trans/$(i) trans/energy/$(i) trans/econ/$(i) throop/$(i) uu/$(i) uu/throop/$(i) linux/$(i) bak/$(i)
htmls = ./linux/site_details.html
# all is a phony target (No file is named "all").  Since all is by
# default the first target, one may just type "mk" to run this
# makefile.
#trans/rail/$(i) 
all: $(index) $(htmls) subsystem
.PHONY: all

# Below are user-defined implicit rules.  For example, each target
# $(index) depends on %.html (itself) which in turn depends on %.sgml.
# % is a wildcard.  The next line (indented)  shows how to make it:

$(index) : %.html : %.sgml
        cd $(*D) ; /usr/bin/sgml2html --split=0 $(<F)
# Use of tidy resulted in removal of <p> tags enclosing list which
# eliminated the blank line before the start of the list.
        -tidy -quiet -modify $@
$(htmls) : %.html : %.sgml
        cd $(*D) ; /usr/bin/sgml2html --split=0 --toc=2 $(<F)
#use tidy to clean up files
        -tidy -quiet -modify $@

# $(*D) is the Directory part of the stem of a match made by the
# implicit rule.  It's just the directory defined by $index (such as
# trans/).  The $(<F) is the File name part of the dependent .sgml
# file such as index.sgml.  cding back to this directory at the end of
# each command line is automatic

# Below, the makefiles in other directories are run
subsystem:
        cd /home/dave/throop/history && $(MAKE)
        cd /home/dave/throop/univ-hist && $(MAKE)
        cd /home/dave/throop/prop && $(MAKE)
        cd /home/dave/rail && $(MAKE)
        cd /home/dave/tenergy && $(MAKE)