Zotero integration + EPUB split + a few other fixes

git-svn-id: svn://svn.code.sf.net/p/writer2latex/code/trunk@76 f0f2a975-2e09-46c8-9428-3b39399b9f3c
This commit is contained in:
henrikjust 2010-10-30 10:35:46 +00:00
parent b415705e47
commit 2174e5cbf5
13 changed files with 2323 additions and 74 deletions

View file

@ -20,7 +20,7 @@
*
* All Rights Reserved.
*
* Version 1.2 (2010-10-27)
* Version 1.2 (2010-10-30)
*
*/
@ -34,7 +34,12 @@ import java.io.UnsupportedEncodingException;
import java.lang.Math;
import java.net.URLEncoder;
import java.net.URLDecoder;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;
import java.util.Locale;
//import java.util.Hashtable;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@ -52,6 +57,20 @@ public class Misc{
for (int i=0; i<n; i++) { newArray[i] = array[i]; }
return newArray;
}
public static final String formatDate(String sDate, String sLanguage, String sCountry) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
Date date = null;
try {
date = sdf.parse(sDate);
} catch (ParseException e) {
// If the date cannot be parsed according to the given pattern, return the original string
return sDate;
}
// Return using a default format for the given locale
Locale locale = sCountry!=null ? new Locale(sLanguage,sCountry) : new Locale(sLanguage);
return DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.SHORT, locale).format(date);
}
public static final String int2roman(int number) {
assert number>0; // Only works for positive numbers!