Using the !RANGE special directive
In circumstances where one wishes to allow clients to view
selected portions of a long document, one can always have
multiple versions available. For example, you could have
a set of small files, each containing a chapter, as well as
a larger file containing the entire document.
This can be somewhat inconvenient, especially if one
has dynamic documents that change frequently -- since one
would have to change both the "chapters" and the
"entire document". To alleviate this necessity, SRE-http
can be instructed to extract, and send to the client,
selected portions of a larger document. This can be
done using the !RANGE
special directive.
Syntax of the !RANGE special directive
The syntax of a !RANGE
special directive is:
The range_info
The range_info
has the following basic syntax:
type=range1-range2,range3-range4,...;type=....;
Note that for each type you can specify several ranges
(seperated by commas); and you can specify several types (seperated
by semi-colons).
An alternate syntax
Instead of using a !RANGE:type=range1-range,.../selector
syntax, you can use:
selector;type=range1-range2,..;...
Caution:
Although this may be a somewhat more natural means of specifying a
range, on occasion it may cause problems (such as when a semi-colon
is a legitimate argument to an aliased SRE-http addon; for example,
the BBS addon). Furthermore, SEARCH ranges must not contain
semi-colons, question marks, or / characters (you can use URL
encoding if need be).
Section Files
Section files are used to define SECTIONS
. Typically, one
would define sections to correspond to particular lines (or bytes) of a file.
If these lines (or bytes) change from time to time, it can be tedious
to change the URLS in the possibly numerous HTML
documents that refer to these sections. By defining these
"sections" in one file, this can be avoided -- you just change the
definition in the section file.
Section files are simple text files that you create with your favorite
text editor. They should be located relative to the SRE-http
"data" directory (say; \GOSERVE\DATA). They should (but need not)
have a .SEC
extension.
For example, assuming that your SRE-http data directory is
D:\GOSERVE\DATA:
The structure of a section file is:
; lines beginning with semi-colons are quotes
SECTION_LABEL: type=range1-range2, range3-range4 ;
type=range1-range ;
SECTION2_label: ....
Note that
- Sections are defined by the
type=range1-range2
syntax
described above.
- Section definitions start with a label ending with a colon.
- Section definitions end with a blank line
- For improved readability, you can embed spaces and line feeds
anywhere. Since these spaces and lines will be removed....
- ... when specifying SEARCH strings, you must use + to signify
a space, and URL encoding for &, " and other such
charactes.
Example of a section file
The following is an example of a section file.
; this is a sample "SECTION" file t
chap1: linenumbers=0-20,
40-80
section1: search="2a"-"2b"
section2: search="2d"-"2e","2g"-"2h"
chap2: lines=100-140, 160-180
chap3: linenumbers= 200-250
chap4: lines=300-350
chap5: linenumbers=450-500
;all done