Skip to content

Commit

Permalink
Removes options related to a specific path (fixes #5, fixes #7)
Browse files Browse the repository at this point in the history
  • Loading branch information
Joel Håkansson committed Mar 31, 2017
1 parent e5202c4 commit 497566f
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 30 deletions.
23 changes: 1 addition & 22 deletions src/org/daisy/dotify/Dotify.java
Original file line number Diff line number Diff line change
Expand Up @@ -141,22 +141,8 @@ public static void run(File inputFile, File output, FilterLocale context, Map<St
map.put(SystemKeys.INPUT_URI, ai.getFile().toURI().toString());

// Add default values for optional parameters
String dateFormat = params.get(SystemKeys.DATE_FORMAT);
if (dateFormat==null || "".equals(dateFormat)) {
dateFormat = SystemProperties.DEFAULT_DATE_FORMAT;
map.put(SystemKeys.DATE_FORMAT, dateFormat);
}
final String tempFilesDirectory = params.get(SystemKeys.TEMP_FILES_DIRECTORY);

if (map.get(SystemKeys.DATE)==null || "".equals(map.get(SystemKeys.DATE))) {
map.put(SystemKeys.DATE, getDefaultDate(dateFormat));
}
if (map.get(SystemKeys.IDENTIFIER)==null || "".equals(map.get(SystemKeys.IDENTIFIER))) {
String id = Double.toHexString(Math.random());
id = id.substring(id.indexOf('.')+1);
id = id.substring(0, id.indexOf('p'));
map.put(SystemKeys.IDENTIFIER, "dummy-id-"+ id);
}
final String tempFilesDirectory = params.get(SystemKeys.TEMP_FILES_DIRECTORY);

// Load additional settings from file
if (map.get("config")==null || "".equals(map.get("config"))) {
Expand Down Expand Up @@ -331,11 +317,4 @@ private static void printOptions(String title, List<TaskOption> options, PrintWr
out.println();
}

public static String getDefaultDate(String dateFormat) {
Calendar c = Calendar.getInstance();
c.setTime(new Date());
SimpleDateFormat sdf = new SimpleDateFormat(dateFormat);
return sdf.format(c.getTime());
}

}
4 changes: 1 addition & 3 deletions src/org/daisy/dotify/SystemKeys.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ public interface SystemKeys {

public static final String TEMPLATE = "template";

public static final String DATE_FORMAT = "dateFormat";
public static final String DATE = "date";
public static final String IDENTIFIER = "identifier";


public static final String PEF_FORMAT = "pef";
public static final String TEXT_FORMAT = "text";
Expand Down
2 changes: 0 additions & 2 deletions src/org/daisy/dotify/SystemProperties.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ public final class SystemProperties {
* Defines the system release
*/
public static final String SYSTEM_RELEASE = getWithDefault(retriever.getManifest().getMainAttributes().getValue("Implementation-Version"), "N/A");

public static final String DEFAULT_DATE_FORMAT = "yyyy-MM-dd";

private static final String getWithDefault(String val, String def) {
return (val!=null?val:def);
Expand Down
3 changes: 0 additions & 3 deletions src/org/daisy/dotify/cli/Convert.java
Original file line number Diff line number Diff line change
Expand Up @@ -293,16 +293,13 @@ public List<OptionalArgument> getOptionalArguments() {
//vals.add(new Definition(SystemKeys.OBFL_FORMAT, "write result in OBFL-format (bypass formatter)"));
optionalArgs.add(new OptionalArgument(SystemKeys.OUTPUT_FORMAT, "Specifies output format", vals, "[detect]"));
}
optionalArgs.add(new OptionalArgument(SystemKeys.IDENTIFIER, "Sets identifier in meta data (if available)", "[generated value]"));
{
ArrayList<Definition> vals = new ArrayList<Definition>();
vals.add(new Definition("true", "outputs temp files"));
vals.add(new Definition("false", "does not output temp files"));
optionalArgs.add(new OptionalArgument(SystemKeys.WRITE_TEMP_FILES, "Writes temp files", vals, "false"));
}
optionalArgs.add(new OptionalArgument(SystemKeys.TEMP_FILES_DIRECTORY, "Path to temp files directory", DefaultTempFileWriter.TEMP_DIR));
optionalArgs.add(new OptionalArgument(SystemKeys.DATE, "Sets date in meta data (if available)", Dotify.getDefaultDate(SystemProperties.DEFAULT_DATE_FORMAT)));
optionalArgs.add(new OptionalArgument(SystemKeys.DATE_FORMAT, "Date format in meta data (if available and date is not specified)", SystemProperties.DEFAULT_DATE_FORMAT));
optionalArgs.add(new OptionalArgument(PEFConverterFacade.KEY_TABLE, "If specified, an ASCII-braille file (.brl) is generated in addition to the PEF-file using the specified braille code table", brailleInfo.getDefinitionList(), ""));
}
return optionalArgs;
Expand Down

0 comments on commit 497566f

Please sign in to comment.