EPUB meta data editor 4th draft (creators and contributors)
git-svn-id: svn://svn.code.sf.net/p/writer2latex/code/trunk@94 f0f2a975-2e09-46c8-9428-3b39399b9f3c
This commit is contained in:
parent
4fc6052426
commit
e147126315
8 changed files with 327 additions and 26 deletions
|
@ -20,7 +20,7 @@
|
|||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.2 (2011-02-23)
|
||||
* Version 1.2 (2011-02-24)
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -33,7 +33,7 @@ public class ConverterFactory {
|
|||
|
||||
// Version information
|
||||
private static final String VERSION = "1.1.7";
|
||||
private static final String DATE = "2011-02-23";
|
||||
private static final String DATE = "2011-02-24";
|
||||
|
||||
/** Return the Writer2LaTeX version in the form
|
||||
* (major version).(minor version).(patch level)<br/>
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* version 1.2 (2011-02-23)
|
||||
* version 1.2 (2011-02-24)
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -147,6 +147,7 @@ public class OPFWriter extends NewDOMDocument {
|
|||
}
|
||||
else if (sKey.startsWith("creator")) {
|
||||
Element creator = appendElement(contentDOM, metadata, "dc:creator", sValue);
|
||||
creator.setAttribute("opf:file-as", fileAs(sValue));
|
||||
if (sAttributeValue!=null) {
|
||||
creator.setAttribute("opf:role", sAttributeValue);
|
||||
}
|
||||
|
@ -154,6 +155,7 @@ public class OPFWriter extends NewDOMDocument {
|
|||
}
|
||||
else if (sKey.startsWith("contributor")) {
|
||||
Element contributor = appendElement(contentDOM, metadata, "dc:contributor", sValue);
|
||||
contributor.setAttribute("opf:file-as", fileAs(sValue));
|
||||
if (sAttributeValue!=null) {
|
||||
contributor.setAttribute("opf:role", sAttributeValue);
|
||||
}
|
||||
|
@ -270,6 +272,16 @@ public class OPFWriter extends NewDOMDocument {
|
|||
return sUID;
|
||||
}
|
||||
|
||||
private String fileAs(String sName) {
|
||||
int nSpace = sName.lastIndexOf(' ');
|
||||
if (nSpace>-1) {
|
||||
return sName.substring(nSpace+1).trim()+", "+sName.substring(0, nSpace).trim();
|
||||
}
|
||||
else {
|
||||
return sName.trim();
|
||||
}
|
||||
}
|
||||
|
||||
private Element appendElement(Document contentDOM, Element node, String sTagName, String sContent) {
|
||||
Element child = contentDOM.createElement(sTagName);
|
||||
node.appendChild(child);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue