Modified metadata structure
This commit is contained in:
parent
47bceb3461
commit
8741ed024f
6 changed files with 286 additions and 234 deletions
|
@ -2,7 +2,7 @@ apply plugin: 'java'
|
||||||
repositories{
|
repositories{
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
def releaseVersion = "0.8.4"
|
def releaseVersion = "0.8.6"
|
||||||
def propertyFile = file "src/main/java/w2phtml/project.properties"
|
def propertyFile = file "src/main/java/w2phtml/project.properties"
|
||||||
Properties properties = new Properties()
|
Properties properties = new Properties()
|
||||||
propertyFile.withReader { properties.load(it) }
|
propertyFile.withReader { properties.load(it) }
|
||||||
|
|
|
@ -274,6 +274,10 @@ public class ConfigurationWindow extends JFrame {
|
||||||
configuration.put("page_break_style", tf_pageBreakInlineStyle);
|
configuration.put("page_break_style", tf_pageBreakInlineStyle);
|
||||||
tf_pageBreakInlineStyle.setText("height:3em;margin-top:1em;margin-bottom:1em;background-color:#f6f6f6;");
|
tf_pageBreakInlineStyle.setText("height:3em;margin-top:1em;margin-bottom:1em;background-color:#f6f6f6;");
|
||||||
tf_pageBreakInlineStyle.setColumns(10);
|
tf_pageBreakInlineStyle.setColumns(10);
|
||||||
|
|
||||||
|
JCheckBox cb_Pagination = new JCheckBox("Pagination");
|
||||||
|
configuration.put("pagination", cb_Pagination);
|
||||||
|
|
||||||
GroupLayout gl_panel_configHTML = new GroupLayout(panel_configHTML);
|
GroupLayout gl_panel_configHTML = new GroupLayout(panel_configHTML);
|
||||||
gl_panel_configHTML.setHorizontalGroup(
|
gl_panel_configHTML.setHorizontalGroup(
|
||||||
gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||||
|
@ -281,48 +285,52 @@ public class ConfigurationWindow extends JFrame {
|
||||||
.addGap(32)
|
.addGap(32)
|
||||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
.addComponent(cb_Pagination, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE)
|
||||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
|
||||||
.addComponent(lb_Scale, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addGap(18)
|
|
||||||
.addComponent(tf_Scale, GroupLayout.PREFERRED_SIZE, 175, GroupLayout.PREFERRED_SIZE))
|
|
||||||
.addComponent(cb_UseMathJax, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
|
||||||
.addComponent(lb_FilterLetterSpacing, GroupLayout.PREFERRED_SIZE, 253, GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addGap(18)
|
|
||||||
.addComponent(tf_FilterLetterSpacing, GroupLayout.PREFERRED_SIZE, 58, GroupLayout.PREFERRED_SIZE))
|
|
||||||
.addComponent(cb_convertToPx, GroupLayout.PREFERRED_SIZE, 592, GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(cb_IgnoreHardLineBreaks, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(cb_IgnoreEmptyParagraphs, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(cb_EmbedRaster, GroupLayout.PREFERRED_SIZE, 194, GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(cb_EmbedVectorImages, GroupLayout.PREFERRED_SIZE, 214, GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(cb_InlineStyles, GroupLayout.PREFERRED_SIZE, 156, GroupLayout.PREFERRED_SIZE))
|
|
||||||
.addContainerGap())
|
.addContainerGap())
|
||||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
|
||||||
.addComponent(lb_pageBreakInlineStyle, GroupLayout.PREFERRED_SIZE, 191, GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addPreferredGap(ComponentPlacement.RELATED)
|
|
||||||
.addComponent(tf_pageBreakInlineStyle, GroupLayout.DEFAULT_SIZE, 697, Short.MAX_VALUE)
|
|
||||||
.addGap(32))
|
|
||||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||||
.addComponent(lb_OutFilePath, GroupLayout.PREFERRED_SIZE, 131, GroupLayout.PREFERRED_SIZE)
|
.addComponent(lb_Scale, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE)
|
||||||
.addPreferredGap(ComponentPlacement.RELATED)
|
.addGap(18)
|
||||||
.addComponent(tf_OutputFile, GroupLayout.DEFAULT_SIZE, 616, Short.MAX_VALUE)
|
.addComponent(tf_Scale, GroupLayout.PREFERRED_SIZE, 175, GroupLayout.PREFERRED_SIZE))
|
||||||
.addGap(12)
|
.addComponent(cb_UseMathJax, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE)
|
||||||
.addComponent(btn_ChooseOutputFile, GroupLayout.PREFERRED_SIZE, 113, GroupLayout.PREFERRED_SIZE))
|
|
||||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||||
.addComponent(lb_TargetFormat_description, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE)
|
.addComponent(lb_FilterLetterSpacing, GroupLayout.PREFERRED_SIZE, 253, GroupLayout.PREFERRED_SIZE)
|
||||||
.addPreferredGap(ComponentPlacement.UNRELATED)
|
.addGap(18)
|
||||||
.addComponent(lb_TargetFormat, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE))
|
.addComponent(tf_FilterLetterSpacing, GroupLayout.PREFERRED_SIZE, 58, GroupLayout.PREFERRED_SIZE))
|
||||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
.addComponent(cb_convertToPx, GroupLayout.PREFERRED_SIZE, 592, GroupLayout.PREFERRED_SIZE)
|
||||||
.addComponent(lb_FilePath, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE)
|
.addComponent(cb_IgnoreHardLineBreaks, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE)
|
||||||
.addGap(32)
|
.addComponent(cb_IgnoreEmptyParagraphs, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE)
|
||||||
.addComponent(tf_inputFile, GroupLayout.DEFAULT_SIZE, 616, Short.MAX_VALUE)
|
.addComponent(cb_EmbedRaster, GroupLayout.PREFERRED_SIZE, 194, GroupLayout.PREFERRED_SIZE)
|
||||||
.addGap(12)
|
.addComponent(cb_EmbedVectorImages, GroupLayout.PREFERRED_SIZE, 214, GroupLayout.PREFERRED_SIZE)
|
||||||
.addComponent(btnChooseFile, GroupLayout.PREFERRED_SIZE, 113, GroupLayout.PREFERRED_SIZE)))
|
.addComponent(cb_InlineStyles, GroupLayout.PREFERRED_SIZE, 156, GroupLayout.PREFERRED_SIZE))
|
||||||
.addGap(48)))))
|
.addContainerGap())
|
||||||
|
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||||
|
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||||
|
.addComponent(lb_pageBreakInlineStyle, GroupLayout.PREFERRED_SIZE, 191, GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addPreferredGap(ComponentPlacement.RELATED)
|
||||||
|
.addComponent(tf_pageBreakInlineStyle, GroupLayout.DEFAULT_SIZE, 697, Short.MAX_VALUE)
|
||||||
|
.addGap(32))
|
||||||
|
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||||
|
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||||
|
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||||
|
.addComponent(lb_OutFilePath, GroupLayout.PREFERRED_SIZE, 131, GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addPreferredGap(ComponentPlacement.RELATED)
|
||||||
|
.addComponent(tf_OutputFile, GroupLayout.DEFAULT_SIZE, 616, Short.MAX_VALUE)
|
||||||
|
.addGap(12)
|
||||||
|
.addComponent(btn_ChooseOutputFile, GroupLayout.PREFERRED_SIZE, 113, GroupLayout.PREFERRED_SIZE))
|
||||||
|
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||||
|
.addComponent(lb_TargetFormat_description, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addPreferredGap(ComponentPlacement.UNRELATED)
|
||||||
|
.addComponent(lb_TargetFormat, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE))
|
||||||
|
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||||
|
.addComponent(lb_FilePath, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addGap(32)
|
||||||
|
.addComponent(tf_inputFile, GroupLayout.DEFAULT_SIZE, 616, Short.MAX_VALUE)
|
||||||
|
.addGap(12)
|
||||||
|
.addComponent(btnChooseFile, GroupLayout.PREFERRED_SIZE, 113, GroupLayout.PREFERRED_SIZE)))
|
||||||
|
.addGap(48))))))
|
||||||
);
|
);
|
||||||
gl_panel_configHTML.setVerticalGroup(
|
gl_panel_configHTML.setVerticalGroup(
|
||||||
gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||||
|
@ -381,7 +389,9 @@ public class ConfigurationWindow extends JFrame {
|
||||||
.addComponent(cb_IgnoreEmptyParagraphs)
|
.addComponent(cb_IgnoreEmptyParagraphs)
|
||||||
.addPreferredGap(ComponentPlacement.UNRELATED)
|
.addPreferredGap(ComponentPlacement.UNRELATED)
|
||||||
.addComponent(cb_UseMathJax)
|
.addComponent(cb_UseMathJax)
|
||||||
.addContainerGap(298, Short.MAX_VALUE))
|
.addPreferredGap(ComponentPlacement.UNRELATED)
|
||||||
|
.addComponent(cb_Pagination)
|
||||||
|
.addContainerGap(271, Short.MAX_VALUE))
|
||||||
);
|
);
|
||||||
panel_configHTML.setLayout(gl_panel_configHTML);
|
panel_configHTML.setLayout(gl_panel_configHTML);
|
||||||
return panel_configHTML;
|
return panel_configHTML;
|
||||||
|
@ -499,6 +509,10 @@ public class ConfigurationWindow extends JFrame {
|
||||||
tf_pageBreakInlineStyle.setColumns(10);
|
tf_pageBreakInlineStyle.setColumns(10);
|
||||||
|
|
||||||
JLabel lb_pageBreakInlineStyle = new JLabel("Page break inline style");
|
JLabel lb_pageBreakInlineStyle = new JLabel("Page break inline style");
|
||||||
|
|
||||||
|
JCheckBox cb_Pagination = new JCheckBox("Pagination");
|
||||||
|
configuration.put("pagination", cb_Pagination);
|
||||||
|
|
||||||
GroupLayout gl_panel_configHTML = new GroupLayout(panel_configHTML);
|
GroupLayout gl_panel_configHTML = new GroupLayout(panel_configHTML);
|
||||||
gl_panel_configHTML.setHorizontalGroup(
|
gl_panel_configHTML.setHorizontalGroup(
|
||||||
gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||||
|
@ -506,57 +520,61 @@ public class ConfigurationWindow extends JFrame {
|
||||||
.addGap(32)
|
.addGap(32)
|
||||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||||
.addComponent(lb_pageBreakInlineStyle, GroupLayout.PREFERRED_SIZE, 191, GroupLayout.PREFERRED_SIZE)
|
.addComponent(cb_Pagination, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE)
|
||||||
.addPreferredGap(ComponentPlacement.RELATED)
|
|
||||||
.addComponent(tf_pageBreakInlineStyle, GroupLayout.DEFAULT_SIZE, 717, Short.MAX_VALUE)
|
|
||||||
.addContainerGap())
|
.addContainerGap())
|
||||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||||
.addComponent(lb_FilePath, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE)
|
.addComponent(lb_pageBreakInlineStyle, GroupLayout.PREFERRED_SIZE, 191, GroupLayout.PREFERRED_SIZE)
|
||||||
.addComponent(lb_OutFilePath, GroupLayout.PREFERRED_SIZE, 131, GroupLayout.PREFERRED_SIZE))
|
.addPreferredGap(ComponentPlacement.RELATED)
|
||||||
.addPreferredGap(ComponentPlacement.RELATED)
|
.addComponent(tf_pageBreakInlineStyle, GroupLayout.DEFAULT_SIZE, 717, Short.MAX_VALUE)
|
||||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
.addContainerGap())
|
||||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||||
.addComponent(tf_OutputFile, GroupLayout.DEFAULT_SIZE, 652, Short.MAX_VALUE)
|
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||||
.addPreferredGap(ComponentPlacement.UNRELATED)
|
.addComponent(lb_FilePath, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE)
|
||||||
.addComponent(btn_ChooseOutputFile, GroupLayout.PREFERRED_SIZE, 113, GroupLayout.PREFERRED_SIZE))
|
.addComponent(lb_OutFilePath, GroupLayout.PREFERRED_SIZE, 131, GroupLayout.PREFERRED_SIZE))
|
||||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
.addPreferredGap(ComponentPlacement.RELATED)
|
||||||
.addComponent(tf_inputFile, GroupLayout.DEFAULT_SIZE, 652, Short.MAX_VALUE)
|
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||||
.addPreferredGap(ComponentPlacement.UNRELATED)
|
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||||
.addComponent(btn_ChooseInputFile, GroupLayout.PREFERRED_SIZE, 113, GroupLayout.PREFERRED_SIZE)))
|
.addComponent(tf_OutputFile, GroupLayout.DEFAULT_SIZE, 652, Short.MAX_VALUE)
|
||||||
.addContainerGap())
|
.addPreferredGap(ComponentPlacement.UNRELATED)
|
||||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
.addComponent(btn_ChooseOutputFile, GroupLayout.PREFERRED_SIZE, 113, GroupLayout.PREFERRED_SIZE))
|
||||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||||
.addComponent(cb_UseMathJax, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE)
|
.addComponent(tf_inputFile, GroupLayout.DEFAULT_SIZE, 652, Short.MAX_VALUE)
|
||||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
.addPreferredGap(ComponentPlacement.UNRELATED)
|
||||||
.addComponent(lb_Scale, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE)
|
.addComponent(btn_ChooseInputFile, GroupLayout.PREFERRED_SIZE, 113, GroupLayout.PREFERRED_SIZE)))
|
||||||
.addGap(18)
|
.addContainerGap())
|
||||||
.addComponent(tf_Scale, GroupLayout.PREFERRED_SIZE, 175, GroupLayout.PREFERRED_SIZE))
|
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||||
.addComponent(lb_MaxWidth)
|
.addComponent(cb_UseMathJax, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE)
|
||||||
.addGap(18)
|
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||||
.addComponent(tf_MaxWidth, GroupLayout.PREFERRED_SIZE, 175, GroupLayout.PREFERRED_SIZE))
|
.addComponent(lb_Scale, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE)
|
||||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
.addGap(18)
|
||||||
.addComponent(lb_FilterLetterSpacing, GroupLayout.PREFERRED_SIZE, 253, GroupLayout.PREFERRED_SIZE)
|
.addComponent(tf_Scale, GroupLayout.PREFERRED_SIZE, 175, GroupLayout.PREFERRED_SIZE))
|
||||||
.addGap(18)
|
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||||
.addComponent(tf_FilterLetterSpacing, GroupLayout.PREFERRED_SIZE, 58, GroupLayout.PREFERRED_SIZE))
|
.addComponent(lb_MaxWidth)
|
||||||
.addComponent(cb_convertToPx, GroupLayout.PREFERRED_SIZE, 592, GroupLayout.PREFERRED_SIZE)
|
.addGap(18)
|
||||||
.addComponent(cb_IgnoreHardLineBreaks, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE)
|
.addComponent(tf_MaxWidth, GroupLayout.PREFERRED_SIZE, 175, GroupLayout.PREFERRED_SIZE))
|
||||||
.addComponent(cb_IgnoreEmptyParagraphs, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE)
|
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||||
.addComponent(cb_Greenstone, GroupLayout.PREFERRED_SIZE, 482, GroupLayout.PREFERRED_SIZE)
|
.addComponent(lb_FilterLetterSpacing, GroupLayout.PREFERRED_SIZE, 253, GroupLayout.PREFERRED_SIZE)
|
||||||
.addComponent(cb_SplitWholePagesOnly, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE)
|
.addGap(18)
|
||||||
.addComponent(cb_EmbedRaster, GroupLayout.PREFERRED_SIZE, 194, GroupLayout.PREFERRED_SIZE)
|
.addComponent(tf_FilterLetterSpacing, GroupLayout.PREFERRED_SIZE, 58, GroupLayout.PREFERRED_SIZE))
|
||||||
.addComponent(cb_EmbedVectorImages, GroupLayout.PREFERRED_SIZE, 214, GroupLayout.PREFERRED_SIZE)
|
.addComponent(cb_convertToPx, GroupLayout.PREFERRED_SIZE, 592, GroupLayout.PREFERRED_SIZE)
|
||||||
.addComponent(cb_InlineStyles, GroupLayout.PREFERRED_SIZE, 156, GroupLayout.PREFERRED_SIZE)
|
.addComponent(cb_IgnoreHardLineBreaks, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE)
|
||||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
.addComponent(cb_IgnoreEmptyParagraphs, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE)
|
||||||
.addComponent(lb_TargetFormat_description, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE)
|
.addComponent(cb_Greenstone, GroupLayout.PREFERRED_SIZE, 482, GroupLayout.PREFERRED_SIZE)
|
||||||
.addPreferredGap(ComponentPlacement.UNRELATED)
|
.addComponent(cb_SplitWholePagesOnly, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE)
|
||||||
.addComponent(lb_TargetFormat, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE))
|
.addComponent(cb_EmbedRaster, GroupLayout.PREFERRED_SIZE, 194, GroupLayout.PREFERRED_SIZE)
|
||||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
.addComponent(cb_EmbedVectorImages, GroupLayout.PREFERRED_SIZE, 214, GroupLayout.PREFERRED_SIZE)
|
||||||
.addComponent(lb_SplitByLevel, GroupLayout.PREFERRED_SIZE, 295, GroupLayout.PREFERRED_SIZE)
|
.addComponent(cb_InlineStyles, GroupLayout.PREFERRED_SIZE, 156, GroupLayout.PREFERRED_SIZE)
|
||||||
.addGap(42)
|
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||||
.addComponent(tf_SplitByLevel, GroupLayout.PREFERRED_SIZE, 175, GroupLayout.PREFERRED_SIZE)))
|
.addComponent(lb_TargetFormat_description, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE)
|
||||||
.addGap(340))))
|
.addPreferredGap(ComponentPlacement.UNRELATED)
|
||||||
|
.addComponent(lb_TargetFormat, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE))
|
||||||
|
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||||
|
.addComponent(lb_SplitByLevel, GroupLayout.PREFERRED_SIZE, 295, GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addGap(42)
|
||||||
|
.addComponent(tf_SplitByLevel, GroupLayout.PREFERRED_SIZE, 175, GroupLayout.PREFERRED_SIZE)))
|
||||||
|
.addGap(340)))))
|
||||||
);
|
);
|
||||||
gl_panel_configHTML.setVerticalGroup(
|
gl_panel_configHTML.setVerticalGroup(
|
||||||
gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||||
|
@ -625,7 +643,9 @@ public class ConfigurationWindow extends JFrame {
|
||||||
.addComponent(cb_SplitWholePagesOnly)
|
.addComponent(cb_SplitWholePagesOnly)
|
||||||
.addPreferredGap(ComponentPlacement.UNRELATED)
|
.addPreferredGap(ComponentPlacement.UNRELATED)
|
||||||
.addComponent(cb_UseMathJax)
|
.addComponent(cb_UseMathJax)
|
||||||
.addContainerGap(258, Short.MAX_VALUE))
|
.addPreferredGap(ComponentPlacement.RELATED)
|
||||||
|
.addComponent(cb_Pagination)
|
||||||
|
.addContainerGap(235, Short.MAX_VALUE))
|
||||||
);
|
);
|
||||||
panel_configHTML.setLayout(gl_panel_configHTML);
|
panel_configHTML.setLayout(gl_panel_configHTML);
|
||||||
return panel_configHTML;
|
return panel_configHTML;
|
||||||
|
@ -817,67 +837,76 @@ public class ConfigurationWindow extends JFrame {
|
||||||
|
|
||||||
tf_pageBreakInlineStyle.setText("height:3em;margin-top:1em;margin-bottom:1em;background-color:#f6f6f6;");
|
tf_pageBreakInlineStyle.setText("height:3em;margin-top:1em;margin-bottom:1em;background-color:#f6f6f6;");
|
||||||
tf_pageBreakInlineStyle.setColumns(10);
|
tf_pageBreakInlineStyle.setColumns(10);
|
||||||
|
|
||||||
|
JCheckBox cb_Pagination = new JCheckBox("Pagination");
|
||||||
|
configuration.put("pagination", cb_Pagination);
|
||||||
|
|
||||||
|
|
||||||
GroupLayout gl_panel_configHTML = new GroupLayout(panel_configHTML);
|
GroupLayout gl_panel_configHTML = new GroupLayout(panel_configHTML);
|
||||||
gl_panel_configHTML.setHorizontalGroup(
|
gl_panel_configHTML.setHorizontalGroup(
|
||||||
gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
gl_panel_configHTML.createParallelGroup(Alignment.TRAILING)
|
||||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||||
.addGap(32)
|
|
||||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
|
||||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
|
||||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
|
||||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
|
||||||
.addComponent(lb_type, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addPreferredGap(ComponentPlacement.RELATED)
|
|
||||||
.addComponent(cbox_type, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
|
|
||||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
|
||||||
.addComponent(lb_Scale, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addPreferredGap(ComponentPlacement.RELATED)
|
|
||||||
.addComponent(tf_Scale, GroupLayout.PREFERRED_SIZE, 98, GroupLayout.PREFERRED_SIZE))
|
|
||||||
.addComponent(cb_UseMathJax, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
|
||||||
.addComponent(lb_FilterLetterSpacing, GroupLayout.PREFERRED_SIZE, 229, GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addPreferredGap(ComponentPlacement.RELATED)
|
|
||||||
.addComponent(tf_FilterLetterSpacing, GroupLayout.PREFERRED_SIZE, 58, GroupLayout.PREFERRED_SIZE))
|
|
||||||
.addComponent(cb_convertToPx, GroupLayout.PREFERRED_SIZE, 592, GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(cb_IgnoreHardLineBreaks, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(cb_IgnoreEmptyParagraphs, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(cb_EmbedRaster, GroupLayout.PREFERRED_SIZE, 194, GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(cb_EmbedVectorImages, GroupLayout.PREFERRED_SIZE, 214, GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(cb_InlineStyles, GroupLayout.PREFERRED_SIZE, 156, GroupLayout.PREFERRED_SIZE))
|
|
||||||
.addContainerGap())
|
|
||||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
|
||||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
|
||||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
|
||||||
.addComponent(lb_OutFilePath, GroupLayout.PREFERRED_SIZE, 125, GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addPreferredGap(ComponentPlacement.UNRELATED)
|
|
||||||
.addComponent(tf_OutputFile, GroupLayout.DEFAULT_SIZE, 600, Short.MAX_VALUE)
|
|
||||||
.addGap(6)
|
|
||||||
.addComponent(btn_ChooseOutputFile, GroupLayout.PREFERRED_SIZE, 113, GroupLayout.PREFERRED_SIZE))
|
|
||||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
|
||||||
.addComponent(lb_TargetFormat_description, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addPreferredGap(ComponentPlacement.UNRELATED)
|
|
||||||
.addComponent(lb_TargetFormat, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE))
|
|
||||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
|
||||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
|
||||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
|
||||||
.addComponent(lb_metadataFilePath, GroupLayout.PREFERRED_SIZE, 131, GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addPreferredGap(ComponentPlacement.RELATED)
|
|
||||||
.addComponent(tf_metadataPath, GroupLayout.DEFAULT_SIZE, 600, Short.MAX_VALUE))
|
|
||||||
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
|
||||||
.addComponent(lb_FilePath, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addGap(32)
|
|
||||||
.addComponent(tf_inputFile, GroupLayout.DEFAULT_SIZE, 600, Short.MAX_VALUE)))
|
|
||||||
.addGap(6)
|
|
||||||
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
|
||||||
.addComponent(btn_metadataChoose, GroupLayout.PREFERRED_SIZE, 113, GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(btnChooseFile, GroupLayout.PREFERRED_SIZE, 113, GroupLayout.PREFERRED_SIZE))))
|
|
||||||
.addGap(70))))
|
|
||||||
.addGroup(Alignment.TRAILING, gl_panel_configHTML.createSequentialGroup()
|
|
||||||
.addGap(23)
|
.addGap(23)
|
||||||
.addComponent(lb_pageBreakInlineStyle, GroupLayout.PREFERRED_SIZE, 191, GroupLayout.PREFERRED_SIZE)
|
.addComponent(lb_pageBreakInlineStyle, GroupLayout.PREFERRED_SIZE, 191, GroupLayout.PREFERRED_SIZE)
|
||||||
.addGap(12)
|
.addGap(12)
|
||||||
.addComponent(tf_pageBreakInlineStyle, GroupLayout.DEFAULT_SIZE, 717, Short.MAX_VALUE)
|
.addComponent(tf_pageBreakInlineStyle, GroupLayout.DEFAULT_SIZE, 717, Short.MAX_VALUE)
|
||||||
.addGap(21))
|
.addGap(21))
|
||||||
|
.addGroup(Alignment.LEADING, gl_panel_configHTML.createSequentialGroup()
|
||||||
|
.addGap(32)
|
||||||
|
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||||
|
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||||
|
.addComponent(cb_Pagination, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addContainerGap())
|
||||||
|
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||||
|
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||||
|
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||||
|
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||||
|
.addComponent(lb_type, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addPreferredGap(ComponentPlacement.RELATED)
|
||||||
|
.addComponent(cbox_type, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
|
||||||
|
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||||
|
.addComponent(lb_Scale, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addPreferredGap(ComponentPlacement.RELATED)
|
||||||
|
.addComponent(tf_Scale, GroupLayout.PREFERRED_SIZE, 98, GroupLayout.PREFERRED_SIZE))
|
||||||
|
.addComponent(cb_UseMathJax, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||||
|
.addComponent(lb_FilterLetterSpacing, GroupLayout.PREFERRED_SIZE, 229, GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addPreferredGap(ComponentPlacement.RELATED)
|
||||||
|
.addComponent(tf_FilterLetterSpacing, GroupLayout.PREFERRED_SIZE, 58, GroupLayout.PREFERRED_SIZE))
|
||||||
|
.addComponent(cb_convertToPx, GroupLayout.PREFERRED_SIZE, 592, GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addComponent(cb_IgnoreHardLineBreaks, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addComponent(cb_IgnoreEmptyParagraphs, GroupLayout.PREFERRED_SIZE, 303, GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addComponent(cb_EmbedRaster, GroupLayout.PREFERRED_SIZE, 194, GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addComponent(cb_EmbedVectorImages, GroupLayout.PREFERRED_SIZE, 214, GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addComponent(cb_InlineStyles, GroupLayout.PREFERRED_SIZE, 156, GroupLayout.PREFERRED_SIZE))
|
||||||
|
.addContainerGap())
|
||||||
|
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||||
|
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||||
|
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||||
|
.addComponent(lb_OutFilePath, GroupLayout.PREFERRED_SIZE, 125, GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addPreferredGap(ComponentPlacement.UNRELATED)
|
||||||
|
.addComponent(tf_OutputFile, GroupLayout.DEFAULT_SIZE, 600, Short.MAX_VALUE)
|
||||||
|
.addGap(6)
|
||||||
|
.addComponent(btn_ChooseOutputFile, GroupLayout.PREFERRED_SIZE, 113, GroupLayout.PREFERRED_SIZE))
|
||||||
|
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||||
|
.addComponent(lb_TargetFormat_description, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addPreferredGap(ComponentPlacement.UNRELATED)
|
||||||
|
.addComponent(lb_TargetFormat, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE))
|
||||||
|
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||||
|
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||||
|
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||||
|
.addComponent(lb_metadataFilePath, GroupLayout.PREFERRED_SIZE, 131, GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addPreferredGap(ComponentPlacement.RELATED)
|
||||||
|
.addComponent(tf_metadataPath, GroupLayout.DEFAULT_SIZE, 600, Short.MAX_VALUE))
|
||||||
|
.addGroup(gl_panel_configHTML.createSequentialGroup()
|
||||||
|
.addComponent(lb_FilePath, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addGap(32)
|
||||||
|
.addComponent(tf_inputFile, GroupLayout.DEFAULT_SIZE, 600, Short.MAX_VALUE)))
|
||||||
|
.addGap(6)
|
||||||
|
.addGroup(gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||||
|
.addComponent(btn_metadataChoose, GroupLayout.PREFERRED_SIZE, 113, GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addComponent(btnChooseFile, GroupLayout.PREFERRED_SIZE, 113, GroupLayout.PREFERRED_SIZE))))
|
||||||
|
.addGap(70)))))
|
||||||
);
|
);
|
||||||
gl_panel_configHTML.setVerticalGroup(
|
gl_panel_configHTML.setVerticalGroup(
|
||||||
gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
gl_panel_configHTML.createParallelGroup(Alignment.LEADING)
|
||||||
|
@ -944,7 +973,9 @@ public class ConfigurationWindow extends JFrame {
|
||||||
.addComponent(cb_IgnoreEmptyParagraphs)
|
.addComponent(cb_IgnoreEmptyParagraphs)
|
||||||
.addPreferredGap(ComponentPlacement.UNRELATED)
|
.addPreferredGap(ComponentPlacement.UNRELATED)
|
||||||
.addComponent(cb_UseMathJax)
|
.addComponent(cb_UseMathJax)
|
||||||
.addContainerGap(234, Short.MAX_VALUE))
|
.addPreferredGap(ComponentPlacement.UNRELATED)
|
||||||
|
.addComponent(cb_Pagination)
|
||||||
|
.addContainerGap(207, Short.MAX_VALUE))
|
||||||
);
|
);
|
||||||
panel_configHTML.setLayout(gl_panel_configHTML);
|
panel_configHTML.setLayout(gl_panel_configHTML);
|
||||||
return panel_configHTML;
|
return panel_configHTML;
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
package w2phtml.rdf;
|
package w2phtml.rdf;
|
||||||
|
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.xml.transform.OutputKeys;
|
import javax.xml.transform.OutputKeys;
|
||||||
|
@ -35,10 +37,11 @@ public class DocumentPart {
|
||||||
private String parentPath;
|
private String parentPath;
|
||||||
private String name = null;
|
private String name = null;
|
||||||
private String order = null;
|
private String order = null;
|
||||||
private HashMap<String,Set<String>> metadata = null;
|
private Metadata metadata = null;
|
||||||
|
|
||||||
public DocumentPart(XhtmlDocument document) {
|
public DocumentPart(XhtmlDocument document,Metadata metadata) {
|
||||||
this.excerptDoc = document;
|
this.excerptDoc = document;
|
||||||
|
this.metadata = metadata;
|
||||||
extractPath();
|
extractPath();
|
||||||
extractName();
|
extractName();
|
||||||
extractNumber();
|
extractNumber();
|
||||||
|
@ -46,8 +49,17 @@ public class DocumentPart {
|
||||||
calculateParentPath();
|
calculateParentPath();
|
||||||
extractAnnotationMetadata();
|
extractAnnotationMetadata();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DocumentPart(String path, Metadata metadata) {
|
||||||
|
this.path = path;
|
||||||
|
this.metadata = metadata;
|
||||||
|
this.name = "";
|
||||||
|
extractNumber();
|
||||||
|
this.body = "";
|
||||||
|
calculateParentPath();
|
||||||
|
}
|
||||||
|
|
||||||
private void extractAnnotationMetadata() {
|
private void extractAnnotationMetadata() {
|
||||||
metadata = new HashMap<String,Set<String>>();
|
|
||||||
if (excerptDoc == null) {
|
if (excerptDoc == null) {
|
||||||
System.out.println("Error. Excerpt doc is null!");
|
System.out.println("Error. Excerpt doc is null!");
|
||||||
return;
|
return;
|
||||||
|
@ -65,24 +77,12 @@ public class DocumentPart {
|
||||||
if (metaElements.hasAttribute("name") && metaElements.hasAttribute("content")) {
|
if (metaElements.hasAttribute("name") && metaElements.hasAttribute("content")) {
|
||||||
String metaName = metaElements.getAttribute("name");
|
String metaName = metaElements.getAttribute("name");
|
||||||
String metaValue = metaElements.getAttribute("content");
|
String metaValue = metaElements.getAttribute("content");
|
||||||
if (!metadata.containsKey(metaName)) {
|
metadata.addMetadata(order, metaName, metaValue);
|
||||||
Set<String> names = new HashSet<String>();
|
|
||||||
metadata.put(metaName, names);
|
|
||||||
}
|
|
||||||
Set<String> names = metadata.get(metaName);
|
|
||||||
names.add(metaValue);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public DocumentPart(String path) {
|
|
||||||
metadata = new HashMap<String,Set<String>>();
|
|
||||||
this.path = path;
|
|
||||||
this.name = "";
|
|
||||||
extractNumber();
|
|
||||||
this.body = "";
|
|
||||||
calculateParentPath();
|
|
||||||
}
|
|
||||||
private void extractName() {
|
private void extractName() {
|
||||||
Element excerptContentNode = excerptDoc.getContentNode();
|
Element excerptContentNode = excerptDoc.getContentNode();
|
||||||
this.name = excerptContentNode.getAttribute("name");
|
this.name = excerptContentNode.getAttribute("name");
|
||||||
|
@ -105,7 +105,7 @@ public class DocumentPart {
|
||||||
public void setOrder(String order) {
|
public void setOrder(String order) {
|
||||||
this.order = order;
|
this.order = order;
|
||||||
}
|
}
|
||||||
public String getSequentionalNumber() {
|
public String getOrder() {
|
||||||
return order;
|
return order;
|
||||||
}
|
}
|
||||||
public String getParentPath() {
|
public String getParentPath() {
|
||||||
|
@ -119,25 +119,15 @@ public class DocumentPart {
|
||||||
}
|
}
|
||||||
public String getName() {
|
public String getName() {
|
||||||
if (metadata != null) {
|
if (metadata != null) {
|
||||||
Set<String> nameSet = metadata.get(DC_TITLE);
|
String nameFromMeta = metadata.getFirstValue(order,DC_TITLE);
|
||||||
if (nameSet != null && !nameSet.isEmpty()) {
|
if (!nameFromMeta.isEmpty()) {
|
||||||
for (String value : nameSet) {
|
return nameFromMeta;
|
||||||
//return first one
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (name.isEmpty()) {
|
if (!name.isEmpty()) {
|
||||||
return "NONAME";
|
return name;
|
||||||
}
|
}
|
||||||
return name;
|
return "No name";
|
||||||
}
|
|
||||||
|
|
||||||
public void setMetadata(HashMap<String,Set<String>> metadata) {
|
|
||||||
this.metadata = metadata;
|
|
||||||
}
|
|
||||||
public HashMap<String,Set<String>> getMetadata(){
|
|
||||||
return metadata;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void extractPath() {
|
private void extractPath() {
|
||||||
|
|
|
@ -4,7 +4,9 @@ import java.io.File;
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|
||||||
|
@ -28,6 +30,7 @@ public class DocumentStructure {
|
||||||
private static final String TEXT_EXCERPT = "textExcerpt";
|
private static final String TEXT_EXCERPT = "textExcerpt";
|
||||||
private static final String TOC_LEVEL = "TOCLevel";
|
private static final String TOC_LEVEL = "TOCLevel";
|
||||||
private static final String TABLE_OF_CONTENTS = "TOC";
|
private static final String TABLE_OF_CONTENTS = "TOC";
|
||||||
|
private static final String PARTICIPANT = "publicationParticipant";
|
||||||
private static final String PUBLICATION = "publication";
|
private static final String PUBLICATION = "publication";
|
||||||
private static final String BOOK = "book";
|
private static final String BOOK = "book";
|
||||||
private static final String JOURNAL = "journal";
|
private static final String JOURNAL = "journal";
|
||||||
|
@ -49,11 +52,13 @@ public class DocumentStructure {
|
||||||
|
|
||||||
private HashMap<String, Resource> tocLevels;
|
private HashMap<String, Resource> tocLevels;
|
||||||
private HashMap<String, DocumentPart> inputParts;
|
private HashMap<String, DocumentPart> inputParts;
|
||||||
|
private Metadata metadata;
|
||||||
|
|
||||||
public DocumentStructure(Vector<XhtmlDocument> files,String fileName, XhtmlConfig config) {
|
public DocumentStructure(Vector<XhtmlDocument> files,String fileName, XhtmlConfig config,Metadata metadata) {
|
||||||
this.tocLevels = new HashMap<String, Resource>();
|
this.tocLevels = new HashMap<String, Resource>();
|
||||||
this.inputParts = new HashMap<String, DocumentPart>();
|
this.inputParts = new HashMap<String, DocumentPart>();
|
||||||
this.m = ModelFactory.createOntologyModel();
|
this.m = ModelFactory.createOntologyModel();
|
||||||
|
this.metadata = metadata;
|
||||||
this.textOntology = ModelFactory.createOntologyModel();
|
this.textOntology = ModelFactory.createOntologyModel();
|
||||||
this.tocLevelClass = textOntology.createClass(TS + TOC_LEVEL);
|
this.tocLevelClass = textOntology.createClass(TS + TOC_LEVEL);
|
||||||
this.tocClass = textOntology.createClass(TS + TABLE_OF_CONTENTS);
|
this.tocClass = textOntology.createClass(TS + TABLE_OF_CONTENTS);
|
||||||
|
@ -65,7 +70,7 @@ public class DocumentStructure {
|
||||||
this.excerptClass = textOntology.createClass(TS + excerptType);
|
this.excerptClass = textOntology.createClass(TS + excerptType);
|
||||||
for(int i = 0 ; i< files.size();i++) {
|
for(int i = 0 ; i< files.size();i++) {
|
||||||
XhtmlDocument inputDoc = files.get(i);
|
XhtmlDocument inputDoc = files.get(i);
|
||||||
DocumentPart part = new DocumentPart(inputDoc);
|
DocumentPart part = new DocumentPart(inputDoc, metadata);
|
||||||
part.setOrder(Integer.toString(i));
|
part.setOrder(Integer.toString(i));
|
||||||
addPart(part);
|
addPart(part);
|
||||||
}
|
}
|
||||||
|
@ -74,7 +79,7 @@ public class DocumentStructure {
|
||||||
|
|
||||||
private void setPublicationType(String publicationType) {
|
private void setPublicationType(String publicationType) {
|
||||||
|
|
||||||
if (publicationType.equals(documentType)) {
|
if (publicationType.equals(ELENPH_ARTICLE)) {
|
||||||
this.documentType = ELENPH_ARTICLE;
|
this.documentType = ELENPH_ARTICLE;
|
||||||
this.excerptType = ELENPH_EXCERPT;
|
this.excerptType = ELENPH_EXCERPT;
|
||||||
} else if (publicationType.equals(BOOK)){
|
} else if (publicationType.equals(BOOK)){
|
||||||
|
@ -99,7 +104,7 @@ public class DocumentStructure {
|
||||||
if (levels[i].equals("0")) {
|
if (levels[i].equals("0")) {
|
||||||
String emptyPath = createEmptyPath(levels, i);
|
String emptyPath = createEmptyPath(levels, i);
|
||||||
if (!inputParts.containsKey(emptyPath)) {
|
if (!inputParts.containsKey(emptyPath)) {
|
||||||
DocumentPart emptyPart = new DocumentPart(emptyPath);
|
DocumentPart emptyPart = new DocumentPart(emptyPath, metadata);
|
||||||
addPart(emptyPart);
|
addPart(emptyPart);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -166,28 +171,50 @@ public class DocumentStructure {
|
||||||
|
|
||||||
private void createDocument(DocumentPart docPart) {
|
private void createDocument(DocumentPart docPart) {
|
||||||
String documentURI = TS + documentType + "/" + PARSERNAME + "_" + docID ;
|
String documentURI = TS + documentType + "/" + PARSERNAME + "_" + docID ;
|
||||||
Resource document = m.createResource(documentURI, documentClass);
|
Resource mainResource = m.createResource(documentURI, documentClass);
|
||||||
document.addProperty( RDFS.label, docPart.getName());
|
mainResource.addProperty( RDFS.label, docPart.getName());
|
||||||
String tocURI = TS + TABLE_OF_CONTENTS + "/" + PARSERNAME + "_" + docID ;
|
String tocURI = TS + TABLE_OF_CONTENTS + "/" + PARSERNAME + "_" + docID ;
|
||||||
|
|
||||||
Resource toc = m.createResource(tocURI, tocClass);
|
Resource toc = m.createResource(tocURI, tocClass);
|
||||||
toc.addProperty( RDFS.label, docPart.getName());
|
toc.addProperty( RDFS.label, docPart.getName());
|
||||||
|
|
||||||
Property hasTOC = m.createProperty(TS + "hasTOC");
|
Property hasTOC = m.createProperty(TS + "hasTOC");
|
||||||
document.addProperty(hasTOC, toc);
|
mainResource.addProperty(hasTOC, toc);
|
||||||
|
|
||||||
addMetadataProperties(document, docPart.getMetadata());
|
addMetadataProperties(mainResource, docPart);
|
||||||
|
addAuthor(mainResource, docPart);
|
||||||
tocLevels.put(docPart.getPath(), toc);
|
tocLevels.put(docPart.getPath(), toc);
|
||||||
attachExcerpt(docPart, toc);
|
attachExcerpt(docPart, toc);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addMetadataProperties(Resource resource, HashMap<String, Set<String>> metadata) {
|
private void addAuthor(Resource resource, DocumentPart docPart) {
|
||||||
Set<String> names = metadata.keySet();
|
String order = docPart.getOrder();
|
||||||
for (String name : names) {
|
ArrayList<Map<String, String>> sectionMeta = metadata.getSection(order);
|
||||||
Set<String> values = metadata.get(name);
|
for (Map<String, String> map : sectionMeta) {
|
||||||
if (values != null) {
|
Set<String> names = map.keySet();
|
||||||
for (String value : values) {
|
if (names.contains("author given name")) {
|
||||||
addMetadata(resource,name,value);
|
attachAuthor(resource, map, order);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void attachAuthor(Resource resource, Map<String, String> map, String order) {
|
||||||
|
//String tocURI = TS + PARTICIPANT + "/" + PARSERNAME + "_" + docID ;
|
||||||
|
//Resource toc = m.createResource(tocURI, tocClass);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addMetadataProperties(Resource resource, DocumentPart docPart) {
|
||||||
|
|
||||||
|
String order = docPart.getOrder();
|
||||||
|
ArrayList<Map<String, String>> sectionMeta = metadata.getSection(order);
|
||||||
|
for (Map<String, String> map : sectionMeta) {
|
||||||
|
Set<String> names = map.keySet();
|
||||||
|
for (String name : names) {
|
||||||
|
String value = map.get(name);
|
||||||
|
if (value != null && !value.isEmpty()) {
|
||||||
|
addMetadata(resource,name,value.trim());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -219,11 +246,9 @@ public class DocumentStructure {
|
||||||
private boolean isDefinedInOntology(Resource resource, String name) {
|
private boolean isDefinedInOntology(Resource resource, String name) {
|
||||||
String nameSpace = resource.getNameSpace();
|
String nameSpace = resource.getNameSpace();
|
||||||
if (nameSpace.contains(TS + excerptType)) {
|
if (nameSpace.contains(TS + excerptType)) {
|
||||||
if (name.equals("author") ||
|
if (name.equals("bibliography") ||
|
||||||
name.equals("bibliography") ||
|
|
||||||
name.equals("keywords") ||
|
name.equals("keywords") ||
|
||||||
name.equals("works") ||
|
name.equals("works")
|
||||||
name.equals("affiliation")
|
|
||||||
) {
|
) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -231,7 +256,6 @@ public class DocumentStructure {
|
||||||
if (nameSpace.contains(TS + documentType)) {
|
if (nameSpace.contains(TS + documentType)) {
|
||||||
if (name.equals("doi") ||
|
if (name.equals("doi") ||
|
||||||
name.equals("firstPublication") ||
|
name.equals("firstPublication") ||
|
||||||
//name.equals("yearAndMonth") ||
|
|
||||||
name.equals("year") ||
|
name.equals("year") ||
|
||||||
name.equals("issue")
|
name.equals("issue")
|
||||||
) {
|
) {
|
||||||
|
@ -299,7 +323,9 @@ public class DocumentStructure {
|
||||||
Property hasText = m.createProperty(TS + "hasText");
|
Property hasText = m.createProperty(TS + "hasText");
|
||||||
element.addProperty(hasText, excerpt);
|
element.addProperty(hasText, excerpt);
|
||||||
if (!docPart.isMasterPart()) {
|
if (!docPart.isMasterPart()) {
|
||||||
addMetadataProperties(excerpt,docPart.getMetadata());
|
addMetadataProperties(excerpt, docPart);
|
||||||
|
addAuthor(excerpt, docPart);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -329,10 +355,5 @@ public class DocumentStructure {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void applyMetadata(Metadata metadata) {
|
|
||||||
for (DocumentPart part: inputParts.values()) {
|
|
||||||
metadata.apply(part);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,12 @@ import java.io.FileReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -22,10 +25,10 @@ public class Metadata {
|
||||||
private static final String SECTION = "Section";
|
private static final String SECTION = "Section";
|
||||||
private static final Logger logger = LoggerFactory.getLogger(Metadata.class);
|
private static final Logger logger = LoggerFactory.getLogger(Metadata.class);
|
||||||
|
|
||||||
private HashMap<String, HashMap<String, Set<String>>> sectionsMetadata;
|
private HashMap<String, ArrayList<Map<String, String>>> sectionsMetadata;
|
||||||
|
|
||||||
public Metadata() {
|
public Metadata() {
|
||||||
sectionsMetadata = new HashMap<String, HashMap<String,Set<String>>>();
|
sectionsMetadata = new HashMap<String, ArrayList<Map<String, String>>>();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,46 +93,54 @@ public class Metadata {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processSectionMetadata(Map<String, String> lineMap, String sectionNum) {
|
private void processSectionMetadata(Map<String, String> lineMap, String sectionNum) {
|
||||||
HashMap<String, Set<String>> sectionMetadata = getSectionMetadataContainer(sectionNum);
|
ArrayList<Map<String, String>> sectionMetadata = getSection(sectionNum);
|
||||||
Set<String> names = lineMap.keySet();
|
Iterator<Entry<String, String>> iterator = lineMap.entrySet().iterator();
|
||||||
for (String name : names) {
|
for (;iterator.hasNext();) {
|
||||||
Set<String> values = getValueSet(sectionMetadata,name.trim());
|
Entry<String, String> entry = iterator.next();
|
||||||
String curValue = lineMap.get(name);
|
String key = entry.getKey();
|
||||||
if (!curValue.trim().isEmpty()) {
|
String value = entry.getValue();
|
||||||
values.add(curValue.trim());
|
if (key == null || value == null || key.trim().isEmpty() || value.trim().isEmpty()) {
|
||||||
|
iterator.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
sectionMetadata.add(lineMap);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Set<String> getValueSet(HashMap<String, Set<String>> sectionMetadata, String name) {
|
public ArrayList<Map<String, String>> getSection(String sectionNum) {
|
||||||
if (!sectionMetadata.containsKey(name)) {
|
if (sectionNum.equals("0")) {
|
||||||
Set<String> values = new HashSet<String>();
|
sectionNum = "";
|
||||||
sectionMetadata.put(name, values);
|
|
||||||
}
|
}
|
||||||
return sectionMetadata.get(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
private HashMap<String, Set<String>> getSectionMetadataContainer(String sectionNum) {
|
|
||||||
if (!sectionsMetadata.containsKey(sectionNum)) {
|
if (!sectionsMetadata.containsKey(sectionNum)) {
|
||||||
HashMap<String,Set<String>> sectionMetadata = new HashMap<String, Set<String>>();
|
ArrayList<Map<String, String>> sectionMetadata = new ArrayList<Map<String, String>>();
|
||||||
sectionsMetadata.putIfAbsent(sectionNum, sectionMetadata);
|
sectionsMetadata.putIfAbsent(sectionNum, sectionMetadata);
|
||||||
}
|
}
|
||||||
return sectionsMetadata.get(sectionNum);
|
return sectionsMetadata.get(sectionNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void apply(DocumentPart part) {
|
public String getFirstValue(String section, String metadataName) {
|
||||||
String sequenceNumber = part.getSequentionalNumber();
|
if (section.equals("0")) {
|
||||||
if (sequenceNumber == null) {
|
section = "";
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
//root part doesn't have number in csv
|
if (sectionsMetadata.containsKey(section)) {
|
||||||
if (sequenceNumber.equals("0")) {
|
ArrayList<Map<String, String>> sectionMetadata = sectionsMetadata.get(section);
|
||||||
sequenceNumber = "";
|
for (Map<String, String> lineMap : sectionMetadata) {
|
||||||
|
String value = lineMap.get(metadataName);
|
||||||
|
if (value != null && !value.trim().isEmpty()) {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
HashMap<String, Set<String>> metadata = sectionsMetadata.get(sequenceNumber);
|
return "";
|
||||||
if (metadata != null) {
|
}
|
||||||
part.setMetadata(metadata);
|
public void addMetadata(String section, String metaName, String metaValue) {
|
||||||
|
if (section.equals("0")) {
|
||||||
|
section = "";
|
||||||
}
|
}
|
||||||
}
|
ArrayList<Map<String, String>> sectionContainer = getSection(section);
|
||||||
|
HashMap<String, String> map = new HashMap<String,String>();
|
||||||
|
map.put(metaName, metaValue);
|
||||||
|
sectionContainer.add(map);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,10 +23,9 @@ public class RDFDocumentResult implements OutputFile {
|
||||||
public RDFDocumentResult(Vector<XhtmlDocument> outFiles, String fileName, XhtmlConfig config) {
|
public RDFDocumentResult(Vector<XhtmlDocument> outFiles, String fileName, XhtmlConfig config) {
|
||||||
this.sFileName = Misc.removeExtension(fileName);
|
this.sFileName = Misc.removeExtension(fileName);
|
||||||
this.config = config;
|
this.config = config;
|
||||||
rdfStructure = new DocumentStructure(outFiles,sFileName,config);
|
|
||||||
Metadata metadata = new Metadata();
|
Metadata metadata = new Metadata();
|
||||||
metadata.read(config.getCSVMetadataFile());
|
metadata.read(config.getCSVMetadataFile());
|
||||||
rdfStructure.applyMetadata(metadata);
|
rdfStructure = new DocumentStructure(outFiles,sFileName,config,metadata);
|
||||||
rdfStructure.createTree();
|
rdfStructure.createTree();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue