BingParseTask
instance.
- */
- public BingParseTask() {
- super();
- this.text = null;
- this.outproperty = null;
- this.parser = new JSONParser();
- }
-
- /**
- * Method setText.
- *
- * @param text String
- */
- public void setText(String text) {
- this.text = text;
- }
-
- /**
- * Method setOutproperty.
- *
- * @param outproperty String
- */
- public void setOutproperty(String outproperty) {
- this.outproperty = outproperty;
- }
-
- /**
- * Method execute.
- *
- * @throws BuildException if something goes wrong
- */
- @Override
- public void execute() {
- // @param text - The response from Microsoft Translate
- // @param outproperty - The property to output to
- if (this.text == null) {
- throw new BuildException("You must supply a response from Microsoft Translate");
- }
- if (this.outproperty == null) {
- throw new BuildException("You must supply a property to output to");
- }
-
- try {
- JSONArray json = (JSONArray) this.parser
- .parse(this.text);
- JSONArray translations = (JSONArray) ((JSONObject) json.get(0)).get("translations");
- String trans = (String) ((JSONObject) translations.get(0)).get("text");
- trans = trans.replaceAll("\\\\\"", "\"");
- trans = trans.replaceAll("class=\"notranslate\"", "translate=\"no\"");
- getProject().setProperty(this.outproperty, trans);
- } catch (ParseException e) {
- throw new BuildException("Unable to translate JSON", e);
- }
- }
-}
diff --git a/src/fox/jason/translate/tasks/DeeplParseTask.java b/src/fox/jason/translate/tasks/DeeplParseTask.java
deleted file mode 100644
index aca7b1e..0000000
--- a/src/fox/jason/translate/tasks/DeeplParseTask.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * This file is part of the DITA-OT Translate Plug-in project.
- * See the accompanying LICENSE file for applicable licenses.
- */
-
-package fox.jason.translate.tasks;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Task;
-import org.json.simple.JSONObject;
-import org.json.simple.JSONArray;
-import org.json.simple.parser.JSONParser;
-import org.json.simple.parser.ParseException;
-
-// Watson Translation. Parses the response and extracts the translated text
-//
-
-public class DeeplParseTask extends Task {
-
- private String text;
- private String outproperty;
- private JSONParser parser;
-
- /**
- * Creates a new DeeplParseTask
instance.
- */
- public DeeplParseTask() {
- super();
- this.text = null;
- this.outproperty = null;
- this.parser = new JSONParser();
- }
-
- /**
- * Method setText.
- *
- * @param text String
- */
- public void setText(String text) {
- this.text = text;
- }
-
- /**
- * Method setOutproperty.
- *
- * @param outproperty String
- */
- public void setOutproperty(String outproperty) {
- this.outproperty = outproperty;
- }
-
- /**
- * Method execute.
- *
- * @throws BuildException if something goes wrong
- */
- @Override
- public void execute() {
- // @param text - The response from Deepl
- // @param outproperty - The property to output to
- if (this.text == null) {
- throw new BuildException("You must supply a response from Deepl");
- }
- if (this.outproperty == null) {
- throw new BuildException("You must supply a property to output to");
- }
-
- try {
- JSONObject json = (JSONObject) this.parser
- .parse(this.text);
- JSONArray translations = (JSONArray) json.get("translations");
- String trans = (String) ((JSONObject) translations.get(0)).get("text");
- trans = trans.replaceAll("\\\\\"", "\"");
- getProject().setProperty(this.outproperty, trans);
- } catch (ParseException e) {
- throw new BuildException("Unable to translate JSON", e);
- }
-
- }
-}
diff --git a/src/fox/jason/translate/tasks/IterateFilesetTask.java b/src/fox/jason/translate/tasks/IterateFilesetTask.java
deleted file mode 100644
index 6762ba6..0000000
--- a/src/fox/jason/translate/tasks/IterateFilesetTask.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * This file is part of the DITA-OT Pretty DITA Plug-in project.
- * See the accompanying LICENSE file for applicable licenses.
- */
-
-package fox.jason.translate.tasks;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.DirectoryScanner;
-import org.apache.tools.ant.Task;
-import org.apache.tools.ant.taskdefs.MacroInstance;
-import org.apache.tools.ant.types.FileSet;
-
-//
-// Iterator function to run a given macro against a set of files
-//
-
-public class IterateFilesetTask extends Task {
- /**
- * Field filesets.
- */
- private ListIterateFilesetTask
instance.
- */
- public IterateFilesetTask() {
- super();
- this.dir = null;
- this.todir = null;
- this.macro = null;
- this.filesets = new ArrayList<>();
- }
-
- /**
- * Method setDir.
- *
- * @param dir String
- */
- public void setDir(String dir) {
- this.dir = dir;
- }
-
- /**
- * Method setTodir.
- *
- * @param todir String
- */
- public void setTodir(String todir) {
- this.todir = todir;
- }
-
- /**
- * Method setMacro.
- *
- * @param macro String
- */
- public void setMacro(String macro) {
- this.macro = macro;
- }
-
- /**
- * @param set FileSet
- */
- public void addFileset(FileSet set) {
- this.filesets.add(set);
- }
-
- /**
- * Method execute.
- *
- * @throws BuildException if something goes wrong
- */
- @Override
- public void execute() {
- // @param toDir - The output location of the files
- // @param dir - The location of the files to process
- // @param macro - A macro to run.
- // @param fileset - A set of files
- if (this.dir == null) {
- throw new BuildException("You must supply a source directory");
- }
- if (this.macro == null) {
- throw new BuildException("You must supply a macro");
- }
- if (filesets.isEmpty()) {
- throw new BuildException("You must supply a set of files");
- }
-
- for (FileSet fileset : this.filesets) {
- DirectoryScanner scanner = fileset.getDirectoryScanner(getProject());
- scanner.scan();
-
- for (String file : scanner.getIncludedFiles()) {
- MacroInstance task = (MacroInstance) getProject()
- .createTask(this.macro);
- try {
- task.setDynamicAttribute("file", this.dir + "/" + file);
- if (this.todir != null){
- task.setDynamicAttribute("toDir", this.todir);
- }
- task.execute();
- } catch (Exception err) {
- throw new BuildException(err);
- }
- }
- }
- }
-}
\ No newline at end of file
diff --git a/src/fox/jason/translate/tasks/ReinsertDoctypeTask.java b/src/fox/jason/translate/tasks/ReinsertDoctypeTask.java
deleted file mode 100644
index 14ffda2..0000000
--- a/src/fox/jason/translate/tasks/ReinsertDoctypeTask.java
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * This file is part of the DITA-OT Translate Plug-in project.
- * See the accompanying LICENSE file for applicable licenses.
- */
-
-package fox.jason.translate.tasks;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Task;
-import java.util.regex.Pattern;
-import org.apache.tools.ant.taskdefs.Echo;
-import org.apache.tools.ant.util.FileUtils;
-
-// Iterator function to run a given macro against a set of files
-//
-
-public class ReinsertDoctypeTask extends Task {
-
- private String file;
- /**
- * Creates a new ReinsertDoctypeTask
instance.
- */
- public ReinsertDoctypeTask() {
- super();
- this.file = null;
- }
-
- private void addDoctype(String doctype, ListUriEncodeTask
instance.
- */
- public UrlEncodeTask() {
- super();
- this.to = null;
- this.string = null;
- }
-
- /**
- * Method setTo.
- *
- * @param to String
- */
- public void setTo(String to) {
- this.to = to;
- }
-
- /**
- * Method setString.
- *
- * @param string String
- */
- public void setString(String string) {
- this.string = string;
- }
-
- // Method to encode a string value using `UTF-8` encoding scheme
- private String encodeURIComponent(String value) {
- try {
- return URLEncoder.encode(value, StandardCharsets.UTF_8.toString());
- } catch (UnsupportedEncodingException ex) {
- throw new BuildException("Unable to encode URI", ex);
- }
- }
-
- /**
- * Method execute.
- *
- * @throws BuildException if something goes wrong
- */
- @Override
- public void execute() {
-
- // @param string - The value to convert
- // @param to - The property to set
- if (this.string == null) {
- throw new BuildException("You must supply a value to convert");
- }
- if (this.to == null) {
- throw new BuildException("You must supply a property to set");
- }
-
- getProject().setProperty(this.to, encodeURIComponent(this.string));
- }
-}
diff --git a/src/fox/jason/translate/tasks/WatsonParseTask.java b/src/fox/jason/translate/tasks/WatsonParseTask.java
deleted file mode 100644
index 36bcff6..0000000
--- a/src/fox/jason/translate/tasks/WatsonParseTask.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * This file is part of the DITA-OT Translate Plug-in project.
- * See the accompanying LICENSE file for applicable licenses.
- */
-
-package fox.jason.translate.tasks;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Task;
-import org.json.simple.JSONObject;
-import org.json.simple.JSONArray;
-import org.json.simple.parser.JSONParser;
-import org.json.simple.parser.ParseException;
-
-//
-// Watson Translation. Parses the response and extracts the translated text
-//
-
-public class WatsonParseTask extends Task {
-
- private String text;
- private String outproperty;
- private JSONParser parser;
-
- /**
- * Creates a new WatsonParseTask
instance.
- */
- public WatsonParseTask() {
- super();
- this.text = null;
- this.outproperty = null;
- this.parser = new JSONParser();
- }
-
- /**
- * Method setText.
- *
- * @param text String
- */
- public void setText(String text) {
- this.text = text;
- }
-
- /**
- * Method setOutproperty.
- *
- * @param outproperty String
- */
- public void setOutproperty(String outproperty) {
- this.outproperty = outproperty;
- }
-
- /**
- * Method execute.
- *
- * @throws BuildException if something goes wrong
- */
- @Override
- public void execute() {
- // @param text - The response from Watson Translate
- // @param outproperty - The property to output to
- if (this.text == null) {
- throw new BuildException("You must supply a response from Watson Translate");
- }
- if (this.outproperty == null) {
- throw new BuildException("You must supply a property to output to");
- }
-
- try {
- JSONObject json = (JSONObject) this.parser
- .parse(this.text);
-
- JSONArray translations = (JSONArray) json.get("translations");
- String trans = (String) ((JSONObject) translations.get(0)).get("translation");
- getProject().setProperty(this.outproperty, trans);
- } catch (ParseException e) {
- throw new BuildException("Unable to translate JSON", e);
- }
- }
-}
diff --git a/src/fox/jason/translate/tasks/YandexParseTask.java b/src/fox/jason/translate/tasks/YandexParseTask.java
deleted file mode 100644
index 97bd8f4..0000000
--- a/src/fox/jason/translate/tasks/YandexParseTask.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * This file is part of the DITA-OT Translate Plug-in project.
- * See the accompanying LICENSE file for applicable licenses.
- */
-
-package fox.jason.translate.tasks;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Task;
-import org.json.simple.JSONObject;
-import org.json.simple.JSONArray;
-import org.json.simple.parser.JSONParser;
-import org.json.simple.parser.ParseException;
-
-//
-// Yandex Translation. Parses the response and extracts the translated text
-//
-
-public class YandexParseTask extends Task {
-
- private String text;
- private String outproperty;
- private JSONParser parser;
-
- /**
- * Creates a new YandexParseTask
instance.
- */
- public YandexParseTask() {
- super();
- this.text = null;
- this.outproperty = null;
- this.parser = new JSONParser();
- }
-
- /**
- * Method setText.
- *
- * @param text String
- */
- public void setText(String text) {
- this.text = text;
- }
-
- /**
- * Method setOutproperty.
- *
- * @param outproperty String
- */
- public void setOutproperty(String outproperty) {
- this.outproperty = outproperty;
- }
-
- /**
- * Method execute.
- *
- * @throws BuildException if something goes wrong
- */
- @Override
- public void execute() {
- // @param text - The response from Yandex Translate
- // @param outproperty - The property to output to
- if (this.text == null) {
- throw new BuildException("You must supply a response from Yandex Translate");
- }
- if (this.outproperty == null) {
- throw new BuildException("You must supply a property to output to");
- }
-
- try {
- JSONObject json = (JSONObject) this.parser
- .parse(this.text);
- JSONArray texts = (JSONArray) json.get("text");
- String trans = (String) texts.get(0);
- trans = trans.replaceAll("\\\\\"", "\"");
- trans = trans.replaceAll("class=\"notranslate\"", "translate=\"no\"");
- getProject().setProperty(this.outproperty, trans);
- } catch (ParseException e) {
- throw new BuildException("Unable to translate JSON", e);
- }
-
- }
-}
diff --git a/src/main/resources/fox/jason/translate/antlib.xml b/src/main/resources/fox/jason/translate/antlib.xml
deleted file mode 100644
index e82a321..0000000
--- a/src/main/resources/fox/jason/translate/antlib.xml
+++ /dev/null
@@ -1,568 +0,0 @@
-
-
-- Loves or pursues or desires to obtain pain of itself, because it - is pain, but occasionally circumstances occur in which toil and - pain can procure him some great pleasure. -
-- To take a trivial example, which of us ever undertakes laborious - physical exercise, except to obtain some advantage from it? -
-- But who has any right to find fault with a man who chooses to - enjoy a pleasure that has no annoying consequences, or one who - avoids a pain that produces no resultant pleasure? -
- -- Loves or pursues or desires to obtain pain of itself, because it - is pain, but occasionally circumstances occur in which toil and - pain can procure him some great pleasure. -
-- To take a trivial example, which of us ever undertakes laborious - physical exercise, except to obtain some advantage from it? -
-- But who has any right to find fault with a man who chooses to - enjoy a pleasure that has no annoying consequences, or one who - avoids a pain that produces no resultant pleasure? -
- -
Prism tut sein Bestes, um bewährte Praktiken zu fördern. Daher funktioniert es nur mit < Code > Elementen, da das Markieren von Code ohne < Code > Element semantisch ungültig ist.
Um die Sache zu erleichtern, geht Prism jedoch davon aus, dass diese Sprachdefinition vererbt wird. Wenn also
Wenn Sie sich gegen die
Die
Wenn Sie dieses Muster verwenden, erhält
Wenn Sie verhindern wollen, dass Elemente automatisch hervorgehoben werden, können Sie das Attribut
Wenn Sie Prism mit einem Bundler verwenden wollen, installieren Sie Prism mit
Sie können dann
Um es einfach zu machen, Ihre Prism-Instanz mit nur den Sprachen und Plugins zu konfigurieren, die Sie benötigen, verwenden Sie das Babel-Plugin,
Wenn Sie Prism auf dem Server oder über die Kommandozeile verwenden wollen, kann Prism auch mit Node.js verwendet werden. Dies könnte nützlich sein, wenn Sie versuchen, statische HTML-Seiten mit hervorgehobenem Code für Umgebungen zu generieren, die keine Browser-side-JS unterstützen, wie
beispiel:
-Wenn
beispiel:
- Hinweis : Verwenden Sie
@@@60323@@@
-@@@51849@@@
-@@@50700@@@
-@@@46850@@@
-@@@25020@@@
-@@@34362@@@
-@@@25518@@@
-@@@32784@@@
-@@@4035@@@
-@@@57344@@@
-@@@5250@@@
-@@@60425@@@
-@@@14934@@@
-@@@60425@@@
-@@@34183@@@
-
- You will need to include the
- Prism does its best to encourage good authoring practices. Therefore,it only
- works with
- To make things easier however, Prism assumes that this language definition is
- inherited. Therefore, if multiple
- If you want to opt-out of highlighting for a
- The
- If you use that pattern, the
- If you want to prevent any elements from being automatically highlighted, you
- can use the attribute
- If you want to use Prism with a bundler, install Prism with
- You can then
- To make it easy to configure your Prism instance with only thelanguages and
- plugins you need, use the babel plugin,
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
-Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
-Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
- -@@@54947@@@
-@@@9962@@@
-@@@19770@@@
- -