From: fabrizio g. <fg...@us...> - 2004-03-19 20:30:31
|
Update of /cvsroot/jtidy/jtidy2/src/main/org/w3c/tidy In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24190/src/main/org/w3c/tidy Modified Files: Configuration.java Log Message: formatting/javadoc Index: Configuration.java =================================================================== RCS file: /cvsroot/jtidy/jtidy2/src/main/org/w3c/tidy/Configuration.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- Configuration.java 14 Mar 2004 16:37:44 -0000 1.8 +++ Configuration.java 19 Mar 2004 20:20:40 -0000 1.9 @@ -1,56 +1,56 @@ /** -* Java HTML Tidy - JTidy -* HTML parser and pretty printer -* -* Copyright (c) 1998-2000 World Wide Web Consortium (Massachusetts -* Institute of Technology, Institut National de Recherche en -* Informatique et en Automatique, Keio University). All Rights -* Reserved. -* -* Contributing Author(s): -* -* Dave Raggett <ds...@w3...> -* Andy Quick <ac....@sy...> (translation to Java) -* Gary L Peskin <ga...@fi...> (Java development) -* Sami Lempinen <sa...@le...> (release management) -* Fabrizio Giustina <fgiust at users.sourceforge.net> -* -* The contributing author(s) would like to thank all those who -* helped with testing, bug fixes, and patience. This wouldn't -* have been possible without all of you. -* -* COPYRIGHT NOTICE: -* -* This software and documentation is provided "as is," and -* the copyright holders and contributing author(s) make no -* representations or warranties, express or implied, including -* but not limited to, warranties of merchantability or fitness -* for any particular purpose or that the use of the software or -* documentation will not infringe any third party patents, -* copyrights, trademarks or other rights. -* -* The copyright holders and contributing author(s) will not be -* liable for any direct, indirect, special or consequential damages -* arising out of any use of the software or documentation, even if -* advised of the possibility of such damage. -* -* Permission is hereby granted to use, copy, modify, and distribute -* this source code, or portions hereof, documentation and executables, -* for any purpose, without fee, subject to the following restrictions: -* -* 1. The origin of this source code must not be misrepresented. -* 2. Altered versions must be plainly marked as such and must -* not be misrepresented as being the original source. -* 3. This Copyright notice may not be removed or altered from any -* source or altered source distribution. -* -* The copyright holders and contributing author(s) specifically -* permit, without fee, and encourage the use of this source code -* as a component for supporting the Hypertext Markup Language in -* commercial products. If you use this source code in a product, -* acknowledgment is not required but would be appreciated. -* -*/ + * Java HTML Tidy - JTidy + * HTML parser and pretty printer + * + * Copyright (c) 1998-2000 World Wide Web Consortium (Massachusetts + * Institute of Technology, Institut National de Recherche en + * Informatique et en Automatique, Keio University). All Rights + * Reserved. + * + * Contributing Author(s): + * + * Dave Raggett <ds...@w3...> + * Andy Quick <ac....@sy...> (translation to Java) + * Gary L Peskin <ga...@fi...> (Java development) + * Sami Lempinen <sa...@le...> (release management) + * Fabrizio Giustina <fgiust at users.sourceforge.net> + * + * The contributing author(s) would like to thank all those who + * helped with testing, bug fixes, and patience. This wouldn't + * have been possible without all of you. + * + * COPYRIGHT NOTICE: + * + * This software and documentation is provided "as is," and + * the copyright holders and contributing author(s) make no + * representations or warranties, express or implied, including + * but not limited to, warranties of merchantability or fitness + * for any particular purpose or that the use of the software or + * documentation will not infringe any third party patents, + * copyrights, trademarks or other rights. + * + * The copyright holders and contributing author(s) will not be + * liable for any direct, indirect, special or consequential damages + * arising out of any use of the software or documentation, even if + * advised of the possibility of such damage. + * + * Permission is hereby granted to use, copy, modify, and distribute + * this source code, or portions hereof, documentation and executables, + * for any purpose, without fee, subject to the following restrictions: + * + * 1. The origin of this source code must not be misrepresented. + * 2. Altered versions must be plainly marked as such and must + * not be misrepresented as being the original source. + * 3. This Copyright notice may not be removed or altered from any + * source or altered source distribution. + * + * The copyright holders and contributing author(s) specifically + * permit, without fee, and encourage the use of this source code + * as a component for supporting the Hypertext Markup Language in + * commercial products. If you use this source code in a product, + * acknowledgment is not required but would be appreciated. + * + */ package org.w3c.tidy; import java.io.FileInputStream; @@ -59,140 +59,346 @@ import java.util.Properties; import java.util.StringTokenizer; + /** * Read configuration file and manage configuration properties. Configuration files associate a property name with a * value. The format is that of a Java .properties file. - * @author Dave Raggett <a href="mailto:ds...@w3...">ds...@w3...</a> - * @author Andy Quick <a href="mailto:ac....@sy...">ac....@sy...</a> (translation to Java) + * @author Dave Raggett <a href="mailto:ds...@w3...">ds...@w3... </a> + * @author Andy Quick <a href="mailto:ac....@sy...">ac....@sy... </a> (translation to Java) * @version $Revision $ ($Author $) */ public class Configuration implements java.io.Serializable { - /** character encodings. */ + /** + * character encoding = RAW. + */ public static final int RAW = 0; + + /** + * character encoding = ASCII. + */ public static final int ASCII = 1; + + /** + * character encoding = LATIN1. + */ public static final int LATIN1 = 2; + + /** + * character encoding = UTF8. + */ public static final int UTF8 = 3; + + /** + * character encoding = ISO2022. + */ public static final int ISO2022 = 4; + + /** + * character encoding = MACROMAN. + */ public static final int MACROMAN = 5; - /** mode controlling treatment of doctype. */ + /** + * treatment of doctype: omit. + */ public static final int DOCTYPE_OMIT = 0; + + /** + * treatment of doctype: auto. + */ public static final int DOCTYPE_AUTO = 1; + + /** + * treatment of doctype: strict. + */ public static final int DOCTYPE_STRICT = 2; + + /** + * treatment of doctype: loose. + */ public static final int DOCTYPE_LOOSE = 3; + + /** + * treatment of doctype: user. + */ public static final int DOCTYPE_USER = 4; - /** default indentation. */ - protected int spaces = 2; - /** default wrap margin. */ - protected int wraplen = 68; + /** + * default indentation. + */ + protected int spaces = 2; + + /** + * default wrap margin (68). + */ + protected int wraplen = 68; + + /** + * default character encoding (ASCII). + */ protected int charEncoding = ASCII; + + /** + * default tab size (4). + */ protected int tabsize = 4; - /** see doctype property. */ - protected int docTypeMode = DOCTYPE_AUTO; - /** default text for alt attribute. */ - protected String altText; - /** style sheet for slides. */ - protected String slidestyle; - /** user specified doctype. */ + /** + * see doctype property. + */ + protected int docTypeMode = DOCTYPE_AUTO; + + /** + * default text for alt attribute. + */ + protected String altText; + + /** + * style sheet for slides. + */ + protected String slidestyle; + + /** + * user specified doctype. + */ protected String docTypeStr; - /** file name to write errors to. */ - protected String errfile; - /** if true then output tidied markup. */ - protected boolean writeback; - - /** if true normal output is suppressed. */ - protected boolean onlyErrors; - /** however errors are always shown. */ + + /** + * file name to write errors to. + */ + protected String errfile; + + /** + * if true then output tidied markup. + */ + protected boolean writeback; + + /** + * if true normal output is suppressed. + */ + protected boolean onlyErrors; + + /** + * however errors are always shown. + */ protected boolean showWarnings = true; - /** no 'Parsing X', guessed DTD or summary. */ - protected boolean quiet; - /** indent content of appropriate tags. */ + + /** + * no 'Parsing X', guessed DTD or summary. + */ + protected boolean quiet; + + /** + * indent content of appropriate tags. + */ protected boolean indentContent; - /** does text/block level content effect indentation. */ - protected boolean smartIndent; - /** suppress optional end tags. */ + + /** + * does text/block level content effect indentation. + */ + protected boolean smartIndent; + + /** + * suppress optional end tags. + */ protected boolean hideEndTags; - /** treat input as XML. */ + + /** + * treat input as XML. + */ protected boolean xmlTags; - /** create output as XML. */ + + /** + * create output as XML. + */ protected boolean xmlOut; - /** output extensible HTML. */ - protected boolean xHTML; - /** add <?xml?> for XML docs. */ - protected boolean xmlPi; - /** avoid mapping values > 127 to entities. */ - protected boolean rawOut; - /** output tags in upper not lower case. */ - protected boolean upperCaseTags; - /** output attributes in upper not lower case. */ + + /** + * output extensible HTML. + */ + protected boolean xHTML; + + /** + * add <?xml?>for XML docs. + */ + protected boolean xmlPi; + + /** + * avoid mapping values > 127 to entities. + */ + protected boolean rawOut; + + /** + * output tags in upper not lower case. + */ + protected boolean upperCaseTags; + + /** + * output attributes in upper not lower case. + */ protected boolean upperCaseAttrs; - /** remove presentational clutter. */ - protected boolean makeClean; - /** replace i by em and b by strong. */ + + /** + * remove presentational clutter. + */ + protected boolean makeClean; + + /** + * replace i by em and b by strong. + */ protected boolean logicalEmphasis; - /** discard presentation tags. */ - protected boolean dropFontTags; - /** discard empty p elements. */ + + /** + * discard presentation tags. + */ + protected boolean dropFontTags; + + /** + * discard empty p elements. + */ protected boolean dropEmptyParas = true; - /** fix comments with adjacent hyphens. */ + + /** + * fix comments with adjacent hyphens. + */ protected boolean fixComments = true; - /** o/p newline before br or not? */ - protected boolean breakBeforeBR; - /** create slides on each h2 element. */ - protected boolean burstSlides; - /** use numeric entities. */ + + /** + * o/p newline before br or not? + */ + protected boolean breakBeforeBR; + + /** + * create slides on each h2 element. + */ + protected boolean burstSlides; + + /** + * use numeric entities. + */ protected boolean numEntities; - /** output " marks as ". */ - protected boolean quoteMarks; - /** output non-breaking space as entity. */ - protected boolean quoteNbsp = true; - /** output naked ampersand as &. */ + + /** + * output " marks as ". + */ + protected boolean quoteMarks; + + /** + * output non-breaking space as entity. + */ + protected boolean quoteNbsp = true; + + /** + * output naked ampersand as &. + */ protected boolean quoteAmpersand = true; - /** wrap within attribute values. */ - protected boolean wrapAttVals; - /** wrap within JavaScript string literals. */ - protected boolean wrapScriptlets; - /** wrap within CDATA section tags. */ + + /** + * wrap within attribute values. + */ + protected boolean wrapAttVals; + + /** + * wrap within JavaScript string literals. + */ + protected boolean wrapScriptlets; + + /** + * wrap within CDATA section tags. + */ protected boolean wrapSection = true; - /** wrap within ASP pseudo elements. */ - protected boolean wrapAsp = true; - /** wrap within JSTE pseudo elements. */ + + /** + * wrap within ASP pseudo elements. + */ + protected boolean wrapAsp = true; + + /** + * wrap within JSTE pseudo elements. + */ protected boolean wrapJste = true; - /** wrap within PHP pseudo elements. */ - protected boolean wrapPhp = true; - /** fix URLs by replacing \ with /. */ + + /** + * wrap within PHP pseudo elements. + */ + protected boolean wrapPhp = true; + + /** + * fix URLs by replacing \ with /. + */ protected boolean fixBackslash = true; - /** newline+indent before each attribute. */ - protected boolean indentAttributes; - /** if set to yes PIs must end with ?>. */ - protected boolean xmlPIs; - /** if set to yes adds xml:space attr as needed. */ - protected boolean xmlSpace; - /** if yes text at body is wrapped in p's. */ - protected boolean encloseBodyText; - /** if yes text in blocks is wrapped in p's. */ - protected boolean encloseBlockText; - /** if yes last modied time is preserved. */ - protected boolean keepFileTimes = true; - /** draconian cleaning for Word2000. */ - protected boolean word2000; - /** add meta element indicating tidied doc. */ + + /** + * newline+indent before each attribute. + */ + protected boolean indentAttributes; + + /** + * if set to yes PIs must end with ?>. + */ + protected boolean xmlPIs; + + /** + * if set to yes adds xml:space attr as needed. + */ + protected boolean xmlSpace; + + /** + * if yes text at body is wrapped in p's. + */ + protected boolean encloseBodyText; + + /** + * if yes text in blocks is wrapped in p's. + */ + protected boolean encloseBlockText; + + /** + * if yes last modied time is preserved. + */ + protected boolean keepFileTimes = true; + + /** + * draconian cleaning for Word2000. + */ + protected boolean word2000; + + /** + * add meta element indicating tidied doc. + */ protected boolean tidyMark = true; - /** if true format error output for GNU Emacs. */ - protected boolean emacs; - /** if true attributes may use newlines. */ - protected boolean literalAttribs; - /** TagTable associated with this Configuration. */ - protected TagTable tt; + /** + * if true format error output for GNU Emacs. + */ + protected boolean emacs; + + /** + * if true attributes may use newlines. + */ + protected boolean literalAttribs; + + /** + * TagTable associated with this Configuration. + */ + protected TagTable tt; + + /** + * configuration properties. + */ private transient Properties properties = new Properties(); + /** + * Report instance. Used for messages. + */ private Report report; - + + /** + * Instantiates a new Configuration. This method should be called by Tidy only. + * @param report Report instance + */ protected Configuration(Report report) { this.report = report; @@ -595,13 +801,13 @@ xmlPIs = true; } - // #427837 - fix by Dave Raggett 02 Jun 01 + // #427837 - fix by Dave Raggett 02 Jun 01 // generate <?xml version="1.0" encoding="iso-8859-1"?> if the character encoding is Latin-1 etc. - if (charEncoding != UTF8 && charEncoding != ASCII && xmlOut) - { + if (charEncoding != UTF8 && charEncoding != ASCII && xmlOut) + { xmlPi = true; } - + /* XML requires end tags */ if (xmlOut) { @@ -794,8 +1000,7 @@ } /** - * doctype: omit | auto | strict | loose | <fpi> where the fpi is a string similar to "-//ACME//DTD HTML - * 3.14159//EN" + * doctype: omit | auto | strict | loose | <fpi>where the fpi is a string similar to "-//ACME//DTD HTML 3.14159//EN" */ protected String parseDocType(String s, String option) { @@ -841,4 +1046,4 @@ return null; } -} +} \ No newline at end of file |