diff options
| author | Simon Tatham <anakin@pobox.com> | 2004-04-15 08:50:04 +0000 |
|---|---|---|
| committer | Simon Tatham <anakin@pobox.com> | 2004-04-15 08:50:04 +0000 |
| commit | 8100588592f8c84f049870a17e6401646378dc5f (patch) | |
| tree | 8710d36de61e21c3a4d4accf8fad70ebf00cd5dd /bk_ps.c | |
| parent | 8603d13eb7651e7721e421750202344f0ced55a7 (diff) | |
| download | halibut-8100588592f8c84f049870a17e6401646378dc5f.zip halibut-8100588592f8c84f049870a17e6401646378dc5f.tar.gz halibut-8100588592f8c84f049870a17e6401646378dc5f.tar.bz2 halibut-8100588592f8c84f049870a17e6401646378dc5f.tar.xz | |
Put the document's version IDs into comments in the PS and PDF
output files.
[originally from svn r4079]
Diffstat (limited to 'bk_ps.c')
| -rw-r--r-- | bk_ps.c | 49 |
1 files changed, 49 insertions, 0 deletions
@@ -6,6 +6,8 @@ #include "halibut.h" #include "paper.h" +static void ps_versionid(FILE *fp, word *words); + paragraph *ps_config_filename(char *filename) { paragraph *p; @@ -74,6 +76,14 @@ void ps_backend(paragraph *sourceform, keywordlist *keywords, fprintf(fp, "%%%%EndProlog\n"); fprintf(fp, "%%%%BeginSetup\n"); + + /* + * This is as good a place as any to put version IDs. + */ + for (p = sourceform; p; p = p->next) + if (p->type == para_VersionID) + ps_versionid(fp, p->words); + /* * Re-encode and re-metric the fonts. */ @@ -169,3 +179,42 @@ void ps_backend(paragraph *sourceform, keywordlist *keywords, sfree(filename); } + +static void ps_versionid(FILE *fp, word *words) +{ + fprintf(fp, "%% "); + + for (; words; words = words->next) { + char *text; + int type; + + switch (words->type) { + case word_HyperLink: + case word_HyperEnd: + case word_UpperXref: + case word_LowerXref: + case word_XrefEnd: + case word_IndexRef: + continue; + } + + type = removeattr(words->type); + + switch (type) { + case word_Normal: + text = utoa_dup(words->text); + break; + case word_WhiteSpace: + text = dupstr(" "); + break; + case word_Quote: + text = dupstr("'"); + break; + } + + fputs(text, fp); + sfree(text); + } + + fprintf(fp, "\n"); +} |