Commit 76e2bf95 authored by Stephan Kreutzer's avatar Stephan Kreutzer

text_position_retriever_1: Autocopy option.

parent fdd58691
......@@ -484,6 +484,8 @@ public class change_history_concatenator_1
try
{
XMLInputFactory inputFactory = XMLInputFactory.newInstance();
inputFactory.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false);
inputFactory.setProperty(XMLInputFactory.SUPPORT_DTD, false);
InputStream in = new FileInputStream(inputFile);
XMLEventReader eventReader = inputFactory.createXMLEventReader(in);
......
/* Copyright (C) 2016-2018 Stephan Kreutzer
/* Copyright (C) 2016-2019 Stephan Kreutzer
*
* This file is part of change_instructions_concatenator_1, a submodule of the
* digital_publishing_workflow_tools package.
......@@ -55,13 +55,13 @@ public class change_instructions_concatenator_1
{
public static void main(String args[])
{
System.out.print("change_instructions_concatenator_1 Copyright (C) 2016-2018 Stephan Kreutzer\n" +
System.out.print("change_instructions_concatenator_1 Copyright (C) 2016-2019 Stephan Kreutzer\n" +
"This program comes with ABSOLUTELY NO WARRANTY.\n" +
"This is free software, and you are welcome to redistribute it\n" +
"under certain conditions. See the GNU Affero General Public License 3\n" +
"or any later version for details. Also, see the source code repository\n" +
"https://gitlab.com/publishing-systems/digital_publishing_workflow_tools/ and\n" +
"the project website http://www.publishing-systems.org.\n\n");
"the project website http://www.hypertext-systems.org.\n\n");
change_instructions_concatenator_1 instance = new change_instructions_concatenator_1();
......@@ -473,6 +473,8 @@ public class change_instructions_concatenator_1
try
{
XMLInputFactory inputFactory = XMLInputFactory.newInstance();
inputFactory.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false);
inputFactory.setProperty(XMLInputFactory.SUPPORT_DTD, false);
InputStream in = new FileInputStream(inputFile);
XMLEventReader eventReader = inputFactory.createXMLEventReader(in);
......
......@@ -60,7 +60,7 @@ public class change_instructions_executor_1
"under certain conditions. See the GNU Affero General Public License 3\n" +
"or any later version for details. Also, see the source code repository\n" +
"https://gitlab.com/publishing-systems/digital_publishing_workflow_tools/ and\n" +
"the project website http://www.publishing-systems.org.\n\n");
"the project website http://www.hypertext-systems.org.\n\n");
change_instructions_executor_1 executor = new change_instructions_executor_1();
......@@ -496,6 +496,8 @@ public class change_instructions_executor_1
try
{
XMLInputFactory inputFactory = XMLInputFactory.newInstance();
inputFactory.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false);
inputFactory.setProperty(XMLInputFactory.SUPPORT_DTD, false);
InputStream in = new FileInputStream(inputFile);
XMLEventReader eventReader = inputFactory.createXMLEventReader(in);
......
......@@ -522,6 +522,8 @@ public class change_instructions_optimizer_1
try
{
XMLInputFactory inputFactory = XMLInputFactory.newInstance();
inputFactory.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false);
inputFactory.setProperty(XMLInputFactory.SUPPORT_DTD, false);
InputStream in = new FileInputStream(inputFile);
XMLEventReader eventReader = inputFactory.createXMLEventReader(in);
......
......@@ -62,7 +62,7 @@ public class edl_to_xml_1
"under certain conditions. See the GNU Affero General Public License 3\n" +
"or any later version for details. Also, see the source code repository\n" +
"https://gitlab.com/publishing-systems/digital_publishing_workflow_tools/ and\n" +
"the project website http://www.publishing-systems.org.\n\n");
"the project website http://www.hypertext-systems.org.\n\n");
edl_to_xml_1 converter = new edl_to_xml_1();
......
......@@ -34,7 +34,11 @@ import java.awt.datatransfer.Clipboard;
class MouseEventListener extends MouseAdapter
{
public MouseEventListener(JTextArea textArea, JTextField positionField, String positionFormatString, String contextMenuCopyItemCaption)
public MouseEventListener(JTextArea textArea,
JTextField positionField,
String positionFormatString,
String contextMenuCopyItemCaption,
boolean autocopy)
{
if (textArea == null ||
positionField == null ||
......@@ -45,6 +49,7 @@ class MouseEventListener extends MouseAdapter
this.textArea = textArea;
this.positionField = positionField;
this.autocopy = autocopy;
if (positionFormatString != null)
{
......@@ -107,6 +112,12 @@ class MouseEventListener extends MouseAdapter
Object positions[] = { startPosition, endPosition, startPosition + 1, endPosition + 1, endPosition - startPosition, selectedText };
positionField.setText(formatter.format(positions));
if (this.autocopy == true)
{
StringSelection stringSelection = new StringSelection(this.positionField.getText());
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
clipboard.setContents(stringSelection, null);
}
}
else
{
......@@ -136,6 +147,7 @@ class MouseEventListener extends MouseAdapter
protected JTextArea textArea = null;
protected JTextField positionField = null;
protected boolean autocopy = false;
protected JPopupMenu contextMenuCopy = null;
protected JMenuItem contextMenuCopyItem = null;
......
......@@ -20,6 +20,9 @@ along with text_position_retriever_1. If not, see <http://www.gnu.org/licenses/>
<text-position-retriever-1-jobfile>
<input-file path="input.txt"/>
<font-size point="16"/>
<!-- Be careful with this, might destroy previous clipboard content for the user! -->
<selection autocopy="false"/>
<position-format-string format=",start={0,number,#},length={4,number,#}"/>
<!--
https://www.w3.org/TR/annotation-model/#text-position-selector:
......
/* Copyright (C) 2014-2018 Stephan Kreutzer
/* Copyright (C) 2014-2019 Stephan Kreutzer
*
* This file is part of text_position_retriever_1, a submodule of the
* digital_publishing_workflow_tools package.
......@@ -62,13 +62,13 @@ public class text_position_retriever_1
{
public static void main(String[] args)
{
System.out.print("text_position_retriever_1 Copyright (C) 2014-2018 Stephan Kreutzer\n" +
System.out.print("text_position_retriever_1 Copyright (C) 2014-2019 Stephan Kreutzer\n" +
"This program comes with ABSOLUTELY NO WARRANTY.\n" +
"This is free software, and you are welcome to redistribute it\n" +
"under certain conditions. See the GNU Affero General Public License 3\n" +
"or any later version for details. Also, see the source code repository\n" +
"https://gitlab.com/publishing-systems/digital_publishing_workflow_tools/ and\n" +
"the project website http://www.publishing-systems.org.\n\n");
"the project website http://www.hypertext-systems.org.\n\n");
text_position_retriever_1 retriever = new text_position_retriever_1();
......@@ -334,6 +334,7 @@ public class text_position_retriever_1
File inputFile = null;
int fontSize = 16;
String positionFormatString = null;
boolean autocopy = false;
try
{
......@@ -407,6 +408,22 @@ public class text_position_retriever_1
positionFormatString = attributeFormat.getValue();
}
else if (tagName.equals("selection") == true)
{
Attribute attributeSelection = event.asStartElement().getAttributeByName(new QName("autocopy"));
if (attributeSelection != null)
{
if (attributeSelection.getValue().equals("true") == true)
{
autocopy = true;
}
else
{
autocopy = false;
}
}
}
}
}
}
......@@ -509,7 +526,7 @@ public class text_position_retriever_1
JTextArea textArea = new JTextArea(inputText.toString());
JTextField positionField = new JTextField();
MouseEventListener mouseListener = new MouseEventListener(textArea, positionField, positionFormatString, getI10nString("windowTextPositionContextMenuCopy"));
MouseEventListener mouseListener = new MouseEventListener(textArea, positionField, positionFormatString, getI10nString("windowTextPositionContextMenuCopy"), autocopy);
KeyEventListener keyListener = new KeyEventListener(positionField);
textArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, fontSize));
......
......@@ -1445,6 +1445,8 @@ public class change_tracking_text_editor_1
try
{
XMLInputFactory inputFactory = XMLInputFactory.newInstance();
inputFactory.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false);
inputFactory.setProperty(XMLInputFactory.SUPPORT_DTD, false);
InputStream in = new FileInputStream(inputFile);
XMLEventReader eventReader = inputFactory.createXMLEventReader(in);
......
/* Copyright (C) 2016-2018 Stephan Kreutzer
/* Copyright (C) 2016-2019 Stephan Kreutzer
*
* This file is part of edl_fulfiller_1 workflow, a submodule of the
* digital_publishing_workflow_tools package.
......@@ -61,13 +61,13 @@ public class edl_fulfiller_1
{
public static void main(String args[])
{
System.out.print("edl_fulfiller_1 workflow Copyright (C) 2016-2018 Stephan Kreutzer\n" +
System.out.print("edl_fulfiller_1 workflow Copyright (C) 2016-2019 Stephan Kreutzer\n" +
"This program comes with ABSOLUTELY NO WARRANTY.\n" +
"This is free software, and you are welcome to redistribute it\n" +
"under certain conditions. See the GNU Affero General Public License 3\n" +
"or any later version for details. Also, see the source code repository\n" +
"https://gitlab.com/publishing-systems/digital_publishing_workflow_tools/ and\n" +
"the project website http://www.publishing-systems.org.\n\n");
"the project website http://www.hypertext-systems.org.\n\n");
edl_fulfiller_1 fulfiller = new edl_fulfiller_1();
......@@ -523,6 +523,8 @@ public class edl_fulfiller_1
try
{
XMLInputFactory inputFactory = XMLInputFactory.newInstance();
inputFactory.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false);
inputFactory.setProperty(XMLInputFactory.SUPPORT_DTD, false);
InputStream in = new FileInputStream(inputFile);
XMLEventReader eventReader = inputFactory.createXMLEventReader(in);
......
......@@ -21,5 +21,13 @@ along with text_position_retriever_1 workflow. If not, see <http://www.gnu.org/l
<start-directory path="."/>
<!-- file-type extension="txt">Plain text file (.txt)</file-type -->
<font-size point="16"/>
<!-- Be careful with this, might destroy previous clipboard content for the user! -->
<selection autocopy="false"/>
<position-format-string format=",start={0,number,#},length={4,number,#}"/>
<!--
https://www.w3.org/TR/annotation-model/#text-position-selector:
<position-format-string format="&lt;selector&gt;&lt;type&gt;TextPositionSelector&lt;/type&gt;&lt;start&gt;{0,number,#}&lt;/start&gt;&lt;end&gt;{1,number,#}&lt;/end&gt;&lt;/selector&gt;"/>
-->
<!-- <position-format-string format="&lt;span&gt;{5}&lt;/span&gt;"/> -->
</text-position-retriever-1-workflow-jobfile>
......@@ -363,6 +363,7 @@ public class text_position_retriever_1
Map<String, String> fileExtensions = new LinkedHashMap<String, String>();
Integer fontSize = null;
String positionFormatString = null;
boolean autocopy = false;
try
{
......@@ -493,6 +494,22 @@ public class text_position_retriever_1
positionFormatString = positionFormatString.replaceAll("\"", "&quot;");
positionFormatString = positionFormatString.replaceAll("'", "&apos;");
}
else if (tagName.equals("selection") == true)
{
Attribute attributeSelection = event.asStartElement().getAttributeByName(new QName("autocopy"));
if (attributeSelection != null)
{
if (attributeSelection.getValue().equals("true") == true)
{
autocopy = true;
}
else
{
autocopy = false;
}
}
}
}
}
}
......@@ -821,6 +838,11 @@ public class text_position_retriever_1
writer.write(" <font-size point=\"" + fontSize + "\"/>\n");
}
if (autocopy == true)
{
writer.write(" <selection autocopy=\"true\"/>\n");
}
if (positionFormatString != null)
{
writer.write(" <position-format-string format=\"" + positionFormatString + "\"/>\n");
......
......@@ -26,7 +26,7 @@ along with xhtml_to_glossary_1 workflow. If not, see <http://www.gnu.org/license
<head>
<meta http-equiv="content-type" content="application/xhtml+xml; charset=UTF-8"/>
<xsl:text>&#x0A;</xsl:text>
<xsl:comment> This file was created by hyperglossary.xsl of xhtml_to_glossary_1 workflow, which is free software licensed under the GNU Affero General Public License 3 or any later version (see http://www.hypertext-systems.org). </xsl:comment>
<xsl:comment> This file was created by hyperglossary_1.xsl of xhtml_to_glossary_1 workflow, which is free software licensed under the GNU Affero General Public License 3 or any later version (see http://www.hypertext-systems.org). </xsl:comment>
<xsl:text>&#x0A;</xsl:text>
<xsl:comment>
Copyright (C) 2018-2019 Stephan Kreutzer
......@@ -50,7 +50,9 @@ not part of this program, it's user data that is only processed. A different
license may apply.
</xsl:comment>
<xsl:text>&#x0A;</xsl:text>
<title>Glossary</title>
<title>
<xsl:value-of select="./hyperglossary/xhtml-src:html/xhtml-src:head/xhtml-src:title//text()"/>
</title>
<script type="text/javascript">
"use strict";
......@@ -405,7 +407,7 @@ license may apply.
.glossary-usage
{
color: #B8860B;
color: #87CEEB;
font-style: italic;
}
......@@ -449,6 +451,42 @@ license may apply.
<xsl:copy/>
</xsl:template>
<xsl:template match="/hyperglossary/xhtml-src:html/xhtml-src:body//xhtml-src:h1">
<h1>
<xsl:apply-templates/>
</h1>
</xsl:template>
<xsl:template match="/hyperglossary/xhtml-src:html/xhtml-src:body//xhtml-src:h2">
<h2>
<xsl:apply-templates/>
</h2>
</xsl:template>
<xsl:template match="/hyperglossary/xhtml-src:html/xhtml-src:body//xhtml-src:h3">
<h3>
<xsl:apply-templates/>
</h3>
</xsl:template>
<xsl:template match="/hyperglossary/xhtml-src:html/xhtml-src:body//xhtml-src:h4">
<h4>
<xsl:apply-templates/>
</h4>
</xsl:template>
<xsl:template match="/hyperglossary/xhtml-src:html/xhtml-src:body//xhtml-src:h5">
<h5>
<xsl:apply-templates/>
</h5>
</xsl:template>
<xsl:template match="/hyperglossary/xhtml-src:html/xhtml-src:body//xhtml-src:h6">
<h6>
<xsl:apply-templates/>
</h6>
</xsl:template>
<xsl:template match="/hyperglossary/xhtml-src:html/xhtml-src:body//xhtml-src:p">
<p>
<xsl:apply-templates/>
......
......@@ -46,6 +46,42 @@ along with xhtml_to_glossary_1 workflow. If not, see <http://www.gnu.org/license
<xsl:copy/>
</xsl:template>
<xsl:template match="/xhtml-src:html/xhtml-src:body//xhtml-src:h1">
<h1>
<xsl:apply-templates/>
</h1>
</xsl:template>
<xsl:template match="/xhtml-src:html/xhtml-src:body//xhtml-src:h2">
<h2>
<xsl:apply-templates/>
</h2>
</xsl:template>
<xsl:template match="/xhtml-src:html/xhtml-src:body//xhtml-src:h3">
<h3>
<xsl:apply-templates/>
</h3>
</xsl:template>
<xsl:template match="/xhtml-src:html/xhtml-src:body//xhtml-src:h4">
<h4>
<xsl:apply-templates/>
</h4>
</xsl:template>
<xsl:template match="/xhtml-src:html/xhtml-src:body//xhtml-src:h5">
<h5>
<xsl:apply-templates/>
</h5>
</xsl:template>
<xsl:template match="/xhtml-src:html/xhtml-src:body//xhtml-src:h6">
<h6>
<xsl:apply-templates/>
</h6>
</xsl:template>
<xsl:template match="/xhtml-src:html/xhtml-src:body//xhtml-src:p">
<p>
<xsl:apply-templates/>
......
......@@ -1932,7 +1932,7 @@ public class xhtml_to_glossary_1
writer.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
writer.write("<!-- This file was created by xhtml_to_glossary_1 workflow, which is free software licensed under the GNU Affero General Public License 3 or any later version (see https://gitlab.com/publishing-systems/digital_publishing_workflow_tools/ and http://www.hypertext-systems.org). -->\n");
writer.write("<xml-xslt-transformator-1-job>\n");
writer.write(" <job input-file=\"" + concatenatedFile.getAbsolutePath() + "\" entities-resolver-config-file=\"" + programPath + ".." + File.separator + ".." + File.separator + ".." + File.separator + "xml_xslt_transformator" + File.separator + "xml_xslt_transformator_1" + File.separator + "entities" + File.separator + "config_empty.xml\" stylesheet-file=\"" + programPath + "hyperglossary.xsl\" output-file=\"" + this.outputHyperglossaryFile.getAbsolutePath() + "\"/>\n");
writer.write(" <job input-file=\"" + concatenatedFile.getAbsolutePath() + "\" entities-resolver-config-file=\"" + programPath + ".." + File.separator + ".." + File.separator + ".." + File.separator + "xml_xslt_transformator" + File.separator + "xml_xslt_transformator_1" + File.separator + "entities" + File.separator + "config_empty.xml\" stylesheet-file=\"" + programPath + "hyperglossary_1.xsl\" output-file=\"" + this.outputHyperglossaryFile.getAbsolutePath() + "\"/>\n");
writer.write("</xml-xslt-transformator-1-job>\n");
writer.flush();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment