Permalink
Browse files

Some minor renaming, addition of menu option (fixes #21 and #22)

  • Loading branch information...
1 parent 524b842 commit db8cd8e693350501959cc5bab34dcca8298badbf Nicholas C. Zakas committed Apr 19, 2011
View
@@ -14,7 +14,7 @@ class.version = 1.5
#CSSEmbed properties
cssembed.name = cssembed
-cssembed.version = 0.3.4
+cssembed.version = 0.3.5
cssembed.jar = ${cssembed.name}-${cssembed.version}.jar
cssembed.main = net.nczonline.web.cssembed.CSSEmbed
@@ -62,7 +62,7 @@ public static void main(String[] args) {
CmdLineParser.Option outputFilenameOpt = parser.addStringOption('o', "output");
CmdLineParser.Option mhtmlOpt = parser.addBooleanOption("mhtml");
CmdLineParser.Option mhtmlRootOpt = parser.addStringOption("mhtmlroot");
- CmdLineParser.Option allowMissingFilesOpt = parser.addBooleanOption("allowmissingfiles");
+ CmdLineParser.Option skipMissingOpt = parser.addBooleanOption("skip-missing");
try {
@@ -116,9 +116,9 @@ public static void main(String[] args) {
}
//are missing files ok?
- boolean allowMissingFiles = parser.getOptionValue(allowMissingFilesOpt) != null;
- if(allowMissingFiles) {
- options = options + CSSURLEmbedder.MISSING_FILES_OPTION;
+ boolean skipMissingFiles = parser.getOptionValue(skipMissingOpt) != null;
+ if(skipMissingFiles) {
+ options = options | CSSURLEmbedder.SKIP_MISSING_OPTION;
}
CSSURLEmbedder embedder = new CSSURLEmbedder(in, options, verbose);
@@ -209,6 +209,7 @@ private static void usage() {
+ " --mhtmlroot <root> Use <root> as the MHTML root for the file.\n"
+ " -v, --verbose Display informational messages and warnings.\n"
+ " --root <root> Prepends <root> to all relative URLs.\n"
+ + " --skip-missing Don't throw an error for missing image files.\n"
+ " -o <file> Place the output into <file>. Defaults to stdout.");
}
}
@@ -44,7 +44,7 @@
public static final int DATAURI_OPTION = 1;
public static final int MHTML_OPTION = 2;
- public static final int MISSING_FILES_OPTION = 4;
+ public static final int SKIP_MISSING_OPTION = 4;
protected static String MHTML_SEPARATOR = "CSSEmbed_Image";
@@ -62,7 +62,6 @@
private int options = 1;
private String mhtmlRoot = "";
private String outputFilename = "";
- private boolean allowMissingFiles = false;
//--------------------------------------------------------------------------
// Constructors
@@ -335,7 +334,7 @@ private String getImageURIString(String url, String originalUrl) throws IOExcept
System.err.println("[INFO] Generated data URI for '" + url + "'.");
}
} catch (FileNotFoundException e){
- if(hasOption(MISSING_FILES_OPTION)) {
+ if(hasOption(SKIP_MISSING_OPTION)) {
System.err.println("[INFO] Could not find file. " + e.getMessage() + " Skipping.");
writer.write(originalUrl);

0 comments on commit db8cd8e

Please sign in to comment.