diff options
author | Alexey Zelkin <phantom@FreeBSD.org> | 2001-11-22 15:26:43 +0000 |
---|---|---|
committer | Alexey Zelkin <phantom@FreeBSD.org> | 2001-11-22 15:26:43 +0000 |
commit | 29ff18f4bd95463fe6b2fe2fc22470499aa5e710 (patch) | |
tree | 596622673e2a261cc0eb06cb32c1a7b307035bf3 /www/tidy-devel | |
parent | Add new option '-preserve' to preserve characters entities from source file (diff) |
Add new option '-preserve' to preserve characters entities from source file
(i.e. leave them undecoded into plain characters). This feature will be utilized
by translation teams and was successfuly tested against Russian and Japanese
Translation Projects.
Also add simple hack to not to display annoying "Can't open ~/.tidyrc" warning
message in case if ~/.tidyrc file missing.
Bump PORTREVISION.
Approved by: Scott Kenney <saken@hotel.rmta.org> (maintainer)
Tested by: myself, hrs
Notes
Notes:
svn path=/head/; revision=50378
Diffstat (limited to 'www/tidy-devel')
-rw-r--r-- | www/tidy-devel/files/patch-ac | 43 | ||||
-rw-r--r-- | www/tidy-devel/files/patch-ad | 18 | ||||
-rw-r--r-- | www/tidy-devel/files/patch-ae | 24 | ||||
-rw-r--r-- | www/tidy-devel/files/patch-af | 37 | ||||
-rw-r--r-- | www/tidy-devel/files/patch-ag | 20 | ||||
-rw-r--r-- | www/tidy-devel/files/patch-ah | 11 |
6 files changed, 153 insertions, 0 deletions
diff --git a/www/tidy-devel/files/patch-ac b/www/tidy-devel/files/patch-ac new file mode 100644 index 000000000000..957ffed0d981 --- /dev/null +++ b/www/tidy-devel/files/patch-ac @@ -0,0 +1,43 @@ +--- config.c.orig Fri Aug 4 19:21:05 2000 ++++ config.c Mon Nov 19 14:42:14 2001 +@@ -94,6 +94,7 @@ + Bool TidyMark = yes; /* add meta element indicating tidied doc */ + Bool Emacs = no; /* if true format error output for GNU Emacs */ + Bool LiteralAttribs = no; /* if true attributes may use newlines */ ++Bool PreserveEntities = no; /* if true don't convert entities to chars */ + + typedef struct _lex PLex; + +@@ -186,6 +187,7 @@ + {"doctype", {(int *)&doctype_str}, ParseDocType}, + {"fix-backslash", {(int *)&FixBackslash}, ParseBool}, + {"gnu-emacs", {(int *)&Emacs}, ParseBool}, ++ {"preserve-entities", {(int *)&PreserveEntities}, ParseBool}, + + /* this must be the final entry */ + {0, 0, 0} +@@ -423,7 +425,10 @@ + /* open the file and parse its contents */ + + if ((fin = fopen(fname, "r")) == null) +- FileError(stderr, fname); ++ { ++ if (FileExists(fname)) /* quiet file open error on */ ++ FileError(stderr, fname); /* non-existent file */ ++ } + else + { + config_text = null; +@@ -533,6 +538,12 @@ + { + QuoteAmpersand = yes; + HideEndTags = no; ++ } ++ ++ /* Avoid &copy; in preserve-entities case */ ++ if (PreserveEntities) ++ { ++ QuoteAmpersand = no; + } + } + diff --git a/www/tidy-devel/files/patch-ad b/www/tidy-devel/files/patch-ad new file mode 100644 index 000000000000..c4a03c56e27d --- /dev/null +++ b/www/tidy-devel/files/patch-ad @@ -0,0 +1,18 @@ +--- html.h.orig Fri Aug 4 19:21:05 2000 ++++ html.h Mon Nov 19 14:36:54 2001 +@@ -380,6 +380,7 @@ + + void FatalError(char *msg); + void FileError(FILE *fp, const char *file); ++int FileExists(const char *file); + + Node *GetToken(Lexer *lexer, uint mode); + +@@ -758,6 +759,7 @@ + extern Bool Word2000; + extern Bool Emacs; /* sasdjb 01May00 GNU Emacs error output format */ + extern Bool LiteralAttribs; ++extern Bool PreserveEntities; + + /* Parser methods for tags */ + diff --git a/www/tidy-devel/files/patch-ae b/www/tidy-devel/files/patch-ae new file mode 100644 index 000000000000..fb56ac67c400 --- /dev/null +++ b/www/tidy-devel/files/patch-ae @@ -0,0 +1,24 @@ +--- lexer.c.orig Fri Aug 4 19:21:05 2000 ++++ lexer.c Thu Nov 15 21:44:03 2001 +@@ -1517,8 +1517,10 @@ + + continue; + } +- else if (c == '&' && mode != IgnoreMarkup) +- ParseEntity(lexer, mode); ++ else if (c == '&' && mode != IgnoreMarkup ++ && !PreserveEntities) { ++ ParseEntity(lexer, mode); ++ } + + /* this is needed to avoid trimming trailing whitespace */ + if (mode == IgnoreWhitespace) +@@ -2624,7 +2626,7 @@ + seen_gt = yes; + } + +- if (c == '&') ++ if (c == '&') /* XXX: possibly need support for PreserveEntities */ + { + AddCharToLexer(lexer, c); + ParseEntity(lexer, null); diff --git a/www/tidy-devel/files/patch-af b/www/tidy-devel/files/patch-af new file mode 100644 index 000000000000..4c9587322849 --- /dev/null +++ b/www/tidy-devel/files/patch-af @@ -0,0 +1,37 @@ +--- localize.c.orig Fri Aug 4 19:21:05 2000 ++++ localize.c Mon Nov 19 14:39:38 2001 +@@ -8,6 +8,9 @@ + to localize HTML tidy. + */ + ++#include <sys/types.h> ++#include <sys/stat.h> ++ + #include "platform.h" + #include "html.h" + +@@ -50,6 +53,16 @@ + tidy_out(fp, "Can't open \"%s\"\n", file); + } + ++int FileExists(const char *file) ++{ ++ struct stat st; ++ ++ if (stat(file, &st) < 0) ++ return (0); ++ else ++ return (1); ++} ++ + static void ReportTag(Lexer *lexer, Node *tag) + { + if (tag) +@@ -736,6 +749,7 @@ + tidy_out(out, " -xml use this when input is wellformed xml\n"); + tidy_out(out, " -asxml to convert html to wellformed xml\n"); + tidy_out(out, " -slides to burst into slides on h2 elements\n"); ++ tidy_out(out, " -preserve to preserve entities from source file\n"); + tidy_out(out, "\n"); + + tidy_out(out, "Character encodings\n"); diff --git a/www/tidy-devel/files/patch-ag b/www/tidy-devel/files/patch-ag new file mode 100644 index 000000000000..3c62b315f922 --- /dev/null +++ b/www/tidy-devel/files/patch-ag @@ -0,0 +1,20 @@ +--- man_page.txt.orig Fri Aug 4 19:21:05 2000 ++++ man_page.txt Thu Nov 15 21:54:05 2001 +@@ -12,6 +12,7 @@ + .IR column ] + .RB [ -upper ] + .RB [ -clean ] ++.RB [ -preserve ] + .RB [ -raw + | + .B -ascii +@@ -106,6 +107,9 @@ + .TP + .B -slides + Burst into slides on <H2> elements. ++.TP ++.B -preserve ++Preserve source file entities as is. + .TP + .BR -help ", " -h + List command-line options. diff --git a/www/tidy-devel/files/patch-ah b/www/tidy-devel/files/patch-ah new file mode 100644 index 000000000000..f0a953e44452 --- /dev/null +++ b/www/tidy-devel/files/patch-ah @@ -0,0 +1,11 @@ +--- tidy.c.orig Fri Aug 4 19:21:05 2000 ++++ tidy.c Mon Nov 19 14:39:50 2001 +@@ -785,6 +785,8 @@ + Quiet = yes; + else if (strcmp(arg, "slides") == 0) + BurstSlides = yes; ++ else if (strcmp(arg, "preserve") == 0) ++ PreserveEntities = yes; + else if (strcmp(arg, "help") == 0 || + argv[1][1] == '?'|| argv[1][1] == 'h') + { |