Parser
Copyright 2008, 2012 Neil Edelman, distributed under the terms of the
GNU General Public License, see copying.txt
Parsing of strings. '~' on a line by itself is recognised in ".newsfile.rss"
and ".sitemap.xml" as a <head>~<body>~<tail>; there should be two of them.
Parsed in ".index.html",
-
@(content) prints content.d, or, if it is missing, index.d;
-
@(files){} repeats for all the files in the directory the contents of the
argument;
-
@(htmlcontent);
-
@(pwd){} prints the directory, the argument is the separator;
eg, @(pwd){/};
-
@(root){}, like @(pwd), except up instead of down;
-
@(now) prints the date and the time in UTC.
Further parsed in @(files) in ".index.html",
-
@(filealt) prints Dir or File;
-
@(filedesc);
-
@(filehref) prints the filename or the .link;
-
@(fileicon) prints it's .d.jpeg, or if it is not there, dir.jpeg or
file.jpeg;
-
@(filename) prints the file name;
-
@(filesize) prints the file size, if it exits;
-
@(now) prints the date and the time in UTC.
Parsed in ".newsfeed.rss",
-
@(date) prints the date on the news file;
-
@(news) prints the contents of the file (as a text file);
-
@(newsname) prints the filename of the news story;
-
@(now) prints the date and the time in UTC;
-
@(title) prints the second line in the .news.
- minimum standard
- C89/90
- author
- Neil
- version
- 1.1; 2017-03 fixed pedantic warnings; command-line improvements
- since
- 0.6; 2008-03-21
Declarations
struct Parser
struct Parser
See Parser.
struct Files
struct Files
Dependancy on Files.
typedef int (*ParserWidget)(struct Files *const files, FILE *const fp)
typedef int (*ParserWidget)(struct Files *const files, FILE *const fp)
All ParserWidgets are in Widget.c.
Function Summary
Return Type | Function Name | Argument List |
struct Parser * |
Parser |
char *const str |
void |
Parser_ |
struct Parser **const p_ptr |
void |
ParserRewind |
struct Parser *p |
int |
ParserParse |
struct Parser *p, struct Files *const f, int invisible,
FILE *fp |
Function Detail
Parser
struct Parser * Parser (char *const str)
- return
- Creates a parser for the string, str.
Parser_
void Parser_ (struct Parser **const p_ptr)
- parameter: p_ptr
- A pointer to the Parser that's to be destucted.
ParserRewind
void ParserRewind (struct Parser *p)
Resets the parser, p.
ParserParse
int ParserParse (struct Parser *p, struct Files *const f, int invisible,
FILE *fp)
Parse, called recursively.
- parameter: f
- Called in the handler to ParserWidgets.
- parameter: invisible
- No output.
- parameter: fp
- Output.
- fixme
- This fn needs rewriting; messy.
- fixme
- Invisible, hack.