From 9ae5db906a8602a4ba76ff97f0a1a9a0ca39af57 Mon Sep 17 00:00:00 2001 From: Jason Fox Date: Tue, 29 Aug 2023 10:52:38 +0200 Subject: [PATCH] Revert "Release preparation" This reverts commit 76712d2023fdca353ebfd252d568e3eefbc0a8a4. --- .github/workflows/ci.yml | 51 + .../prismjs/tasks/IterateDitaFilesTask.java | 87 ++ .../prismjs/tasks/IterateFilesetTask.java | 126 ++ .../jason/prismjs/tasks/ShortLangTask.java | 88 ++ test/basic-usage/build.xml | 12 + test/basic-usage/document.ditamap | 8 + test/basic-usage/expected.fo | 381 +++++ test/basic-usage/topic.dita | 90 ++ test/bootstrap.xml | 13 + test/generics/build.xml | 12 + test/generics/document.ditamap | 8 + test/generics/expected.fo | 1345 +++++++++++++++++ test/generics/topic.dita | 619 ++++++++ test/html/build.xml | 12 + test/html/document.ditamap | 9 + test/html/expected.html | 48 + test/html/logo.svg | 23 + test/html/topic.dita | 28 + test/javadoc/build.xml | 12 + test/javadoc/document.ditamap | 8 + test/javadoc/expected.fo | 1000 ++++++++++++ test/javadoc/topic.dita | 491 ++++++ test/load-libraries/build.xml | 12 + test/load-libraries/document.ditamap | 9 + test/load-libraries/expected.html | 51 + test/load-libraries/logo.svg | 23 + test/load-libraries/topic.dita | 53 + test/pdf/build.xml | 12 + test/pdf/document.ditamap | 8 + test/pdf/expected.fo | 156 ++ test/pdf/logo.svg | 23 + test/pdf/topic.dita | 28 + test/setup.sh | 8 + 33 files changed, 4854 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 src/fox/jason/prismjs/tasks/IterateDitaFilesTask.java create mode 100644 src/fox/jason/prismjs/tasks/IterateFilesetTask.java create mode 100644 src/fox/jason/prismjs/tasks/ShortLangTask.java create mode 100644 test/basic-usage/build.xml create mode 100644 test/basic-usage/document.ditamap create mode 100644 test/basic-usage/expected.fo create mode 100644 test/basic-usage/topic.dita create mode 100644 test/bootstrap.xml create mode 100644 test/generics/build.xml create mode 100644 test/generics/document.ditamap create mode 100644 test/generics/expected.fo create mode 100644 test/generics/topic.dita create mode 100644 test/html/build.xml create mode 100644 test/html/document.ditamap create mode 100644 test/html/expected.html create mode 100644 test/html/logo.svg create mode 100644 test/html/topic.dita create mode 100644 test/javadoc/build.xml create mode 100644 test/javadoc/document.ditamap create mode 100644 test/javadoc/expected.fo create mode 100644 test/javadoc/topic.dita create mode 100644 test/load-libraries/build.xml create mode 100644 test/load-libraries/document.ditamap create mode 100644 test/load-libraries/expected.html create mode 100644 test/load-libraries/logo.svg create mode 100644 test/load-libraries/topic.dita create mode 100644 test/pdf/build.xml create mode 100644 test/pdf/document.ditamap create mode 100644 test/pdf/expected.fo create mode 100644 test/pdf/logo.svg create mode 100644 test/pdf/topic.dita create mode 100755 test/setup.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..55faf27 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,51 @@ +name: CI +'on': + push: + branches: + - master + pull_request: + branches: + - master + +env: + MAVEN_OPTS: >- + -Dhttp.keepAlive=false + -Dmaven.wagon.http.pool=false + -Dmaven.wagon.httpconnectionManager.ttlSeconds=120 + +jobs: + sonarcloud: + name: SonarCloud Scan + runs-on: ubuntu-latest + steps: + - name: Git checkout + uses: actions/checkout@v3 + - name: Use Java 17 + uses: actions/setup-java@v3 + with: + java-version: 17 + distribution: 'zulu' + - name: SonarCloud Scan + uses: jason-fox/sonarcloud-action@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_CLOUD_LOGIN: ${{ secrets.SONAR_CLOUD_LOGIN }} + + unit-test: + name: Unit Tests + runs-on: ubuntu-latest + steps: + - name: Git checkout + uses: actions/checkout@v3 + - name: Run DITA-OT Unit Test + uses: jason-fox/dita-unit-test-action@master + with: + dita-ot-version: '4.0' + plugin: 'fox.jason.prismjs' + prerequisites: fox.jason.extend.css + setup-script: 'test/setup.sh' + - uses: actions/upload-artifact@v3 + if: always() + with: + name: test-results + path: test-results.html diff --git a/src/fox/jason/prismjs/tasks/IterateDitaFilesTask.java b/src/fox/jason/prismjs/tasks/IterateDitaFilesTask.java new file mode 100644 index 0000000..aff78a5 --- /dev/null +++ b/src/fox/jason/prismjs/tasks/IterateDitaFilesTask.java @@ -0,0 +1,87 @@ +/* + * This file is part of the DITA-OT Pretty DITA Plug-in project. + * See the accompanying LICENSE file for applicable licenses. + */ + +package fox.jason.prismjs.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 IterateDitaFilesTask extends Task { + + /** + * Field list. + */ + private String list; + /** + * Field macro. + */ + private String macro; + + /** + * Creates a new IterateDitaFilesTask instance. + */ + public IterateDitaFilesTask() { + super(); + this.list = null; + this.macro = null; + } + + /** + * Method setList. + * + * @param list String + */ + public void setList(String list) { + this.list = list; + } + + /** + * Method setMacro. + * + * @param macro String + */ + public void setMacro(String macro) { + this.macro = macro; + } + + /** + * Method execute. + * + * @throws BuildException if something goes wrong + */ + @Override + public void execute() { + // @param list - The list of files to annotate + if (this.list == null) { + throw new BuildException("You must supply a list of files to annotate"); + } + if (this.macro == null) { + throw new BuildException("You must supply a macro"); + } + + String[] filenames = list.split(";", 0); + + for (String file : filenames) { + + MacroInstance task = (MacroInstance) getProject() + .createTask(this.macro); + try { + task.setDynamicAttribute("file", file); + task.execute(); + } catch (Exception err) { + throw new BuildException(err); + } + } + } +} diff --git a/src/fox/jason/prismjs/tasks/IterateFilesetTask.java b/src/fox/jason/prismjs/tasks/IterateFilesetTask.java new file mode 100644 index 0000000..dc2a469 --- /dev/null +++ b/src/fox/jason/prismjs/tasks/IterateFilesetTask.java @@ -0,0 +1,126 @@ +/* + * This file is part of the DITA-OT Pretty DITA Plug-in project. + * See the accompanying LICENSE file for applicable licenses. + */ + +package fox.jason.prismjs.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 List filesets; + /** + * Field macro. + */ + private String macro; + /** + * Field file. + */ + private String file; + + /** + * Field dir. + */ + private String dir; + + /** + * Creates a new IterateFilesetTask instance. + */ + public IterateFilesetTask() { + super(); + this.dir = null; + this.file = null; + this.macro = null; + this.filesets = new ArrayList<>(); + } + + /** + * Method setDir. + * + * @param dir String + */ + public void setDir(String dir) { + this.dir = dir; + } + + /** + * Method setfile. + * + * @param file String + */ + public void setFile(String file) { + this.file = file; + } + + /** + * 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 file - 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.file == null) { + throw new BuildException("You must supply a destination file"); + } + if (this.macro == null) { + throw new BuildException("You must supply a macro"); + } + if (this.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 src : scanner.getIncludedFiles()) { + MacroInstance task = (MacroInstance) getProject() + .createTask(this.macro); + try { + task.setDynamicAttribute("src", src); + task.setDynamicAttribute("dir", this.dir); + task.setDynamicAttribute("file", this.file); + task.execute(); + } catch (Exception err) { + throw new BuildException(err); + } + } + } + } +} diff --git a/src/fox/jason/prismjs/tasks/ShortLangTask.java b/src/fox/jason/prismjs/tasks/ShortLangTask.java new file mode 100644 index 0000000..3e5efb9 --- /dev/null +++ b/src/fox/jason/prismjs/tasks/ShortLangTask.java @@ -0,0 +1,88 @@ +/* + * This file is part of the DITA-OT Prism-JS Plug-in project + * See the accompanying LICENSE file for applicable licenses. + */ + +package fox.jason.prismjs.tasks; + +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.Task; +import java.util.regex.Pattern; +import java.util.regex.Matcher; + +// +// Obtains the corrected highlighting language from the outputclass +// + +public class ShortLangTask extends Task { + + /** + * Field outputclass. + */ + private String outputclass; + + /** + * Field property. + */ + private String property; + + /** + * Field regex. + */ + private Pattern regex; + + /** + * Creates a new ShortLangTask instance. + */ + public ShortLangTask() { + super(); + this.outputclass = null; + this.property = null; + this.regex = Pattern.compile("\\blang(?:uage)?-([\\w-]+)\\b", Pattern.CASE_INSENSITIVE); + } + + /** + * Method setOutputclass. + * + * @param outputclass String + */ + public void setOutputclass(String outputclass) { + this.outputclass = outputclass; + } + + /** + * Method setProperty. + * + * @param property String + */ + public void setProperty(String property) { + this.property = property; + } + + /** + * Method execute. + * + * @throws BuildException if something goes wrong + */ + @Override + public void execute() { + // @param outputclass - The outputclass of the codeblock + // @param property - The property to set with the corrected + // highighting language + if (outputclass == null) { + throw new BuildException("You must supply an outputclass"); + } + if (property == null) { + throw new BuildException("You must supply a property to set"); + } + + + String language = outputclass.toLowerCase(); + Matcher matcher = regex.matcher(outputclass); + if (matcher.find()) { + language = matcher.group(); + language = language.substring(language.indexOf('-') + 1, language.length()); + } + getProject().setProperty(property, language); + } +} \ No newline at end of file diff --git a/test/basic-usage/build.xml b/test/basic-usage/build.xml new file mode 100644 index 0000000..7fc6f6f --- /dev/null +++ b/test/basic-usage/build.xml @@ -0,0 +1,12 @@ + + + + + Expect that PDF codeblock text highlights using ancestor + + + + + + + diff --git a/test/basic-usage/document.ditamap b/test/basic-usage/document.ditamap new file mode 100644 index 0000000..221952a --- /dev/null +++ b/test/basic-usage/document.ditamap @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/test/basic-usage/expected.fo b/test/basic-usage/expected.fo new file mode 100644 index 0000000..11eb068 --- /dev/null +++ b/test/basic-usage/expected.fo @@ -0,0 +1,381 @@ + + + + + 1 + codeblock + + Chapter + 1 + + + codeblock + + + + + + + + Topics: + + + + + + + + Basic usage + + + + + + + + + + + + + + + + + Basic usage + + Basic usage + + + You will need to include the + prism.cssand + prism.jsfiles you downloaded in your page. Example: + + <!DOCTYPE html> + + + <html + > + + + + <head + > + ... + + + <link + href + + = + "themes/prism.css + " + + rel + + = + "stylesheet + " + + /> + > + + + </head + > + + + + <body + > + ... + + + <script + src + + = + "prism.js + " + + > + + + + + </script + > + + + + </body + > + + + + </html + > + + + Prism does its best to encourage good authoring practices. Therefore, it only works with + + + + <code + > + + elements, since marking up code without a + + + + <code + > + + element is semantically invalid. + According to the HTML5 spec, the recommended way to define a code language is a + language-xxxxclass, which is what Prism uses. + Alternatively, Prism also supports a shorter version: + lang-xxxx. + To make things easier however, Prism assumes that this language definition is inherited. Therefore, if multiple + + + + <code + > + + elements have the same language, you can add the + language-xxxxclass on one of their common ancestors. + This way, you can also define a document-wide default language, by adding a + language-xxxxclass on the + + + + <body + > + + or + + + + <html + > + + element. + If you want to opt-out of highlighting for a + + + + <code + > + + element that is a descendant of an element with a declared code language, you can add the class + language-noneto it (or any non-existing language, really). + The + recommended way to mark up a code block(both for semantics and for Prism) is a + + + + <pre + > + + element with a + + + + <code + > + + element inside, like so: + + + + <pre + > + + + + <code + class + + = + "language-css + " + + > + p { color: red } + + + </code + > + + + + </pre + > + + + If you use that pattern, the + + + + <pre + > + + will automatically get the + language-xxxxclass (if it doesn’t already have it) and will be styled as a code block. + If you want to prevent any elements from being automatically highlighted, you can use the attribute + data-manualon the + + + + <script + > + + element you used for prism and use the + API. + Example: + + + + <script + src + + = + "prism.js + " + + data-manual + > + + + + + </script + > + + + + Usage with Webpack, Browserify, & Other Bundlers + + If you want to use Prism with a bundler, install Prism with + npm: + $ npm install prismjs + You can then + + import + into your bundle: + + importPrism + from + 'prismjs' + ; + + To make it easy to configure your Prism instance with only the languages and plugins you need, use the babel plugin, + babel-plugin-prismjs. This will allow you to load + the minimum number of languages and plugins to satisfy your needs. + See that plugin's documentation for configuration details. + + + + Usage with Node + + If you want to use Prism on the server or through the command line, Prism can be used with Node.js as well. + This might be useful if you're trying to generate static HTML pages with highlighted code for environments that don't support browser-side JS, like + AMP pages. + Example: + + varPrism + = + require + ( + 'prismjs' + ) + ; + // The code snippet you want to highlight, as a string + varcode + = + "var data = 1;" + ; + // Returns a highlighted HTML string + varhtml + =Prism + . + highlight + (code + ,Prism + .languages + .javascript + , + 'javascript' + ) + ; + + Requiring + prismjswill load the default languages: + markup, + css, + clikeand + javascript. You can load more languages with the + + loadLanguages + ( + ) + utility, which will automatically handle any required dependencies. + Example: + + varPrism + = + require + ( + 'prismjs' + ) + ; + varloadLanguages + = + require + ( + 'prismjs/components/' + ) + ; + loadLanguages + ( + [ + 'haml' + ] + ) + ; + // The code snippet you want to highlight, as a string + varcode + = + "= ['hi', 'there', 'reader!'].join \" \"" + ; + // Returns a highlighted HTML string + varhtml + =Prism + . + highlight + (code + ,Prism + .languages + .haml + , + 'haml' + ) + ; + + + Note: Do + notuse + + loadLanguages + ( + ) + with Webpack or another bundler, as this will cause Webpack to include all languages and plugins. Use the babel plugin described above. + + + + + + + + diff --git a/test/basic-usage/topic.dita b/test/basic-usage/topic.dita new file mode 100644 index 0000000..b0b463f --- /dev/null +++ b/test/basic-usage/topic.dita @@ -0,0 +1,90 @@ + + + + Basic usage + + +

You will need to include the prism.css and prism.js files you downloaded in your page. Example:

+ + + <!DOCTYPE html> +<html> +<head> + ... + <link href="themes/prism.css" rel="stylesheet" /> + ></head> +<body> + ... + <script src="prism.js"></script> + </body> +</html> + +

Prism does its best to encourage good authoring practices. Therefore, it only works with <code> elements, since marking up code without a <code> element is semantically invalid. + According to the HTML5 spec, the recommended way to define a code language is a language-xxxx class, which is what Prism uses. + Alternatively, Prism also supports a shorter version: lang-xxxx.

+

To make things easier however, Prism assumes that this language definition is inherited. Therefore, if multiple <code> elements have the same language, you can add the language-xxxx class on one of their common ancestors. + This way, you can also define a document-wide default language, by adding a language-xxxx class on the <body> or <html> element.

+ +

If you want to opt-out of highlighting for a <code> element that is a descendant of an element with a declared code language, you can add the class language-none to it (or any non-existing language, really).

+ +

The recommended way to mark up a code block + (both for semantics and for Prism) is a <pre> element with a <code> element inside, like so:

+ <pre><code class="language-css">p { color: red }</code></pre> +

If you use that pattern, the <pre> will automatically get the language-xxxx class (if it doesn’t already have it) and will be styled as a code block.

+ +

If you want to prevent any elements from being automatically highlighted, you can use the attribute data-manual on the <script> element you used for prism and use the API. + Example:

+ <script src="prism.js" data-manual></script> + +
+ Usage with Webpack, Browserify, & Other Bundlers + +

If you want to use Prism with a bundler, install Prism with npm:

+ + $ npm install prismjs + +

You can then import into your bundle:

+ + import Prism from 'prismjs'; + +

To make it easy to configure your Prism instance with only the languages and plugins you need, use the babel plugin, + babel-plugin-prismjs. This will allow you to load + the minimum number of languages and plugins to satisfy your needs. + See that plugin's documentation for configuration details.

+ +
+
+ Usage with Node + +

If you want to use Prism on the server or through the command line, Prism can be used with Node.js as well. + This might be useful if you're trying to generate static HTML pages with highlighted code for environments that don't support browser-side JS, like AMP pages.

+ +

Example:

+ var Prism = require('prismjs'); + +// The code snippet you want to highlight, as a string +var code = "var data = 1;"; + +// Returns a highlighted HTML string +var html = Prism.highlight(code, Prism.languages.javascript, 'javascript'); + +

Requiring prismjs will load the default languages: markup, css, + clike and javascript. You can load more languages with the + loadLanguages() utility, which will automatically handle any required dependencies.

+

Example:

+ + var Prism = require('prismjs'); +var loadLanguages = require('prismjs/components/'); +loadLanguages(['haml']); + +// The code snippet you want to highlight, as a string +var code = "= ['hi', 'there', 'reader!'].join \" \""; + +// Returns a highlighted HTML string +var html = Prism.highlight(code, Prism.languages.haml, 'haml'); + + +

Note: Do not use loadLanguages() with Webpack or another bundler, as this will cause Webpack to include all languages and plugins. Use the babel plugin described above.

+
+ +
diff --git a/test/bootstrap.xml b/test/bootstrap.xml new file mode 100644 index 0000000..544de8d --- /dev/null +++ b/test/bootstrap.xml @@ -0,0 +1,13 @@ + + + + + + + + diff --git a/test/generics/build.xml b/test/generics/build.xml new file mode 100644 index 0000000..199cb53 --- /dev/null +++ b/test/generics/build.xml @@ -0,0 +1,12 @@ + + + + + Expect that PDF codeblock text highlights java generics correctly + + + + + + + diff --git a/test/generics/document.ditamap b/test/generics/document.ditamap new file mode 100644 index 0000000..221952a --- /dev/null +++ b/test/generics/document.ditamap @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/test/generics/expected.fo b/test/generics/expected.fo new file mode 100644 index 0000000..1989484 --- /dev/null +++ b/test/generics/expected.fo @@ -0,0 +1,1345 @@ + + + + + 1 + codeblock + + Chapter + 1 + + + codeblock + + + + + + + + Topics: + + + + + + + + Class Policy + + + + + + + + + + + + + + + + + Class Policy + + Class Policy + + + + Direct Known Subclasses: + + + + + + + + + Model + + + + + + public + class + + Policy + + extendsjava + .lang + . + Object + + + Field Summary + + + + + + + + + + Modifier and Type + + + Field and Description + + + + + + + + + Map​ + <java + .​lang + .​ + String + >​​ + < + Map​ + <java + .​lang + .​ + String + >​​ + < + Assertion + >​ + > + + + + + + model + + + + + + + + + + + + Constructor Summary + + + + + + + + + Constructor and Description + + + + + + + + + Policy + ( + ) + + + + + + + + + + + + Method Summary + + + + + + + + + + Modifier and Type + + + Method and Description + + + + + + + + + boolean + + + + + + + addPolicy + (java + .​lang + .​ + Stringsec + ,java + .​lang + .​ + Stringptype + , + List​ + <java + .​lang + .​ + String + >​ rule + ) + - addPolicy adds a policy rule to the model. + + + + + + + void + + + + + + + buildRoleLinks + ( + RoleManagerrm + ) + - buildRoleLinks initializes the roles in RBAC. + + + + + + + void + + + + + + + clearPolicy + ( + ) + - clearPolicy clears all current policy. + + + + + + + List​ + < + List​ + <java + .​lang + .​ + String + >​ + > + + + + + + getFilteredPolicy + (java + .​lang + .​ + Stringsec + ,java + .​lang + .​ + Stringptype + , + intfieldIndex + ,java + .​lang + .​ + String + [ + ]fieldValues + ) + - getFilteredPolicy gets rules based on field filters from a policy. + + + + + + + List​ + < + List​ + <java + .​lang + .​ + String + >​ + > + + + + + + getPolicy + (java + .​lang + .​ + Stringsec + ,java + .​lang + .​ + Stringptype + ) + - getPolicy gets all rules in a policy. + + + + + + + List​ + <java + .​lang + .​ + String + > + + + + + + getValuesForFieldInPolicy + (java + .​lang + .​ + Stringsec + ,java + .​lang + .​ + Stringptype + , + intfieldIndex + ) + - getValuesForFieldInPolicy gets all values for a field for all rules in a policy, duplicated values are removed. + + + + + + + boolean + + + + + + + hasPolicy + (java + .​lang + .​ + Stringsec + ,java + .​lang + .​ + Stringptype + , + List​ + <java + .​lang + .​ + String + >​ rule + ) + - hasPolicy determines whether a model has the specified policy rule. + + + + + + + void + + + + + + + printPolicy + ( + ) + - printPolicy prints the policy to log. + + + + + + + boolean + + + + + + + removeFilteredPolicy + (java + .​lang + .​ + Stringsec + ,java + .​lang + .​ + Stringptype + , + intfieldIndex + ,java + .​lang + .​ + String + [ + ]fieldValues + ) + - removeFilteredPolicy removes policy rules based on field filters from the model. + + + + + + + boolean + + + + + + + removePolicy + (java + .​lang + .​ + Stringsec + ,java + .​lang + .​ + Stringptype + , + List​ + <java + .​lang + .​ + String + >​ rule + ) + - removePolicy removes a policy rule from the model. + + + + + + java + .​lang + .​ + String + + + + + + + savePolicyToText + ( + ) + - savePolicyToText saves the policy to the text. + + + + + + + + + + + + + + + Methods inherited from class java.lang.Object + + + + + + + + clone + ,equals + ,finalize + ,getClass + ,hashCode + ,notify + ,notifyAll + ,toString + ,wait + ,wait + ,wait + + + + + + + + + + + Field Detail + + + + + + + + + model + + + + + + + + + public + Map​ + <java + .​lang + .​ + String + >​​ + < + Map​ + <java + .​lang + .​ + String + >​​ + < + Assertion + >​ + >​ model + + + + + + + + + + + + + Constructor Detail + + + + + + + + + Policy + + + + + + + + + Policy + ( + ) + + + + + + + + + + + + + + Method Detail + + + + + + + + + addPolicy + + + + + + + + + public + boolean + addPolicy + (java + .​lang + .​ + Stringsec + ,java + .​lang + .​ + Stringptype + , + List​ + <java + .​lang + .​ + String + >​ rule + ) + + addPolicy adds a policy rule to the model. + + Parameters: + + + + + + + + + sec- sec the section, "p" or "g". + + + + + + + + + ptype- ptype the policy type, "p", "p2", .. or "g", "g2", .. + + + + + + + + + rule- rule the policy rule. + + + + + Returns: + + succeeds or not. + + + + + + + + + + + + + + + + buildRoleLinks + + + + + + + + + public + void + buildRoleLinks + ( + RoleManagerrm + ) + + buildRoleLinks initializes the roles in RBAC. + + Parameters: + + + + + + + + + rm- rm the role manager. + + + + + + + + + + + + + + + + + + + clearPolicy + + + + + + + + + public + void + clearPolicy + ( + ) + + clearPolicy clears all current policy. + + + + + + + + + + + + + + + + getFilteredPolicy + + + + + + + + + public + List​ + < + List​ + <java + .​lang + .​ + String + >​ + >​ + getFilteredPolicy + (java + .​lang + .​ + Stringsec + ,java + .​lang + .​ + Stringptype + , + intfieldIndex + ,java + .​lang + .​ + String + [ + ]fieldValues + ) + + getFilteredPolicy gets rules based on field filters from a policy. + + Parameters: + + + + + + + + + sec- sec the section, "p" or "g". + + + + + + + + + ptype- ptype the policy type, "p", "p2", .. or "g", "g2", .. + + + + + + + + + fieldIndex- fieldIndex the policy rule's start index to be matched. + + + + + + + + + fieldValues- fieldValues the field values to be matched, value "" + means not to match this field. + + + + + Returns: + + the filtered policy rules of section sec and policy type ptype. + + + + + + + + + + + + + + + + getPolicy + + + + + + + + + public + List​ + < + List​ + <java + .​lang + .​ + String + >​ + >​ + getPolicy + (java + .​lang + .​ + Stringsec + ,java + .​lang + .​ + Stringptype + ) + + getPolicy gets all rules in a policy. + + Parameters: + + + + + + + + + sec- sec the section, "p" or "g". + + + + + + + + + ptype- ptype the policy type, "p", "p2", .. or "g", "g2", .. + + + + + Returns: + + the policy rules of section sec and policy type ptype. + + + + + + + + + + + + + + + + getValuesForFieldInPolicy + + + + + + + + + public + List​ + <java + .​lang + .​ + String + >​ + getValuesForFieldInPolicy + (java + .​lang + .​ + Stringsec + ,java + .​lang + .​ + Stringptype + , + intfieldIndex + ) + + getValuesForFieldInPolicy gets all values for a field for all rules in a policy, duplicated values are removed. + + Parameters: + + + + + + + + + sec- sec the section, "p" or "g". + + + + + + + + + ptype- ptype the policy type, "p", "p2", .. or "g", "g2", .. + + + + + + + + + fieldIndex- fieldIndex the policy rule's index. + + + + + Returns: + + the field values specified by fieldIndex. + + + + + + + + + + + + + + + + hasPolicy + + + + + + + + + public + boolean + hasPolicy + (java + .​lang + .​ + Stringsec + ,java + .​lang + .​ + Stringptype + , + List​ + <java + .​lang + .​ + String + >​ rule + ) + + hasPolicy determines whether a model has the specified policy rule. + + Parameters: + + + + + + + + + sec- sec the section, "p" or "g". + + + + + + + + + ptype- ptype the policy type, "p", "p2", .. or "g", "g2", .. + + + + + + + + + rule- rule the policy rule. + + + + + Returns: + + whether the rule exists. + + + + + + + + + + + + + + + + printPolicy + + + + + + + + + public + void + printPolicy + ( + ) + + printPolicy prints the policy to log. + + + + + + + + + + + + + + + + removeFilteredPolicy + + + + + + + + + public + boolean + removeFilteredPolicy + (java + .​lang + .​ + Stringsec + ,java + .​lang + .​ + Stringptype + , + intfieldIndex + ,java + .​lang + .​ + String + [ + ]fieldValues + ) + + removeFilteredPolicy removes policy rules based on field filters from the model. + + Parameters: + + + + + + + + + sec- sec the section, "p" or "g". + + + + + + + + + ptype- ptype the policy type, "p", "p2", .. or "g", "g2", .. + + + + + + + + + fieldIndex- fieldIndex the policy rule's start index to be matched. + + + + + + + + + fieldValues- fieldValues the field values to be matched, value "" + means not to match this field. + + + + + Returns: + + succeeds or not. + + + + + + + + + + + + + + + + removePolicy + + + + + + + + + public + boolean + removePolicy + (java + .​lang + .​ + Stringsec + ,java + .​lang + .​ + Stringptype + , + List​ + <java + .​lang + .​ + String + >​ rule + ) + + removePolicy removes a policy rule from the model. + + Parameters: + + + + + + + + + sec- sec the section, "p" or "g". + + + + + + + + + ptype- ptype the policy type, "p", "p2", .. or "g", "g2", .. + + + + + + + + + rule- rule the policy rule. + + + + + Returns: + + succeeds or not. + + + + + + + + + + + + + + + + savePolicyToText + + + + + + + + + publicjava + .​lang + .​ + String + savePolicyToText + ( + ) + + savePolicyToText saves the policy to the text. + + Returns: + + the policy text. + + + + + + + + + + + + + + + + diff --git a/test/generics/topic.dita b/test/generics/topic.dita new file mode 100644 index 0000000..68fa72e --- /dev/null +++ b/test/generics/topic.dita @@ -0,0 +1,619 @@ + + + + Class Policy + + Policy + Policy + + +

+ Direct Known Subclasses: +

+
    +
  • + Model +
  • +
+ public class Policy extends java.lang.Object + +
+ Field Summary + + + + + + + Modifier and Type + Field and Description + + + + + + Map​<java.​lang.​String>​​<Map​<java.​lang.​String>​​< + Assertion>​>​ + + + + + model + + + + + +
+
+
+ Constructor Summary + + + + + + Constructor and Description + + + + + + + Policy() + + + + + +
+
+
+ Method Summary + + + + + + + Modifier and Type + Method and Description + + + + + + boolean + + + + addPolicy(java.​lang.​String sec, java.​lang.​String ptype, List​<java.​lang.​String>​ rule) + - addPolicy adds a policy rule to the model. + + + + + void + + + + buildRoleLinks( + RoleManager rm) + - buildRoleLinks initializes the roles in RBAC. + + + + + void + + + + clearPolicy() + - clearPolicy clears all current policy. + + + + + List​<List​<java.​lang.​String>​>​ + + + + getFilteredPolicy(java.​lang.​String sec, java.​lang.​String ptype, int fieldIndex, java.​lang.​String[] fieldValues) + - getFilteredPolicy gets rules based on field filters from a policy. + + + + + List​<List​<java.​lang.​String>​>​ + + + + getPolicy(java.​lang.​String sec, java.​lang.​String ptype) + - getPolicy gets all rules in a policy. + + + + + List​<java.​lang.​String>​ + + + + getValuesForFieldInPolicy(java.​lang.​String sec, java.​lang.​String ptype, int fieldIndex) + - getValuesForFieldInPolicy gets all values for a field for all rules in a policy, duplicated values are removed. + + + + + boolean + + + + hasPolicy(java.​lang.​String sec, java.​lang.​String ptype, List​<java.​lang.​String>​ rule) + - hasPolicy determines whether a model has the specified policy rule. + + + + + void + + + + printPolicy() + - printPolicy prints the policy to log. + + + + + boolean + + + + removeFilteredPolicy(java.​lang.​String sec, java.​lang.​String ptype, int fieldIndex, java.​lang.​String[] fieldValues) + - removeFilteredPolicy removes policy rules based on field filters from the model. + + + + + boolean + + + + removePolicy(java.​lang.​String sec, java.​lang.​String ptype, List​<java.​lang.​String>​ rule) + - removePolicy removes a policy rule from the model. + + + + + java.​lang.​String + + + + savePolicyToText() + - savePolicyToText saves the policy to the text. + + + + +
+

+ + + + + + Methods inherited from class java.lang.Object + + + + + + clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait + + + + +
+

+
+ Field Detail + + + + + + model + + + + + + public Map​<java.​lang.​String>​​<Map​<java.​lang.​String>​​<Assertion>​>​ model + +

+ + +

+ +
+

+

+
+ Constructor Detail + + + + + + Policy + + + + + + Policy() +

+ + +

+ +
+

+

+
+ Method Detail + + + + + + addPolicy + + + + + + public boolean addPolicy(java.​lang.​String sec, java.​lang.​String ptype, List​<java.​lang.​String>​ rule) +

addPolicy adds a policy rule to the model.

+

+ Parameters: +

+
    +
  • + sec - sec the section, "p" or "g". +
  • +
  • + ptype - ptype the policy type, "p", "p2", .. or "g", "g2", .. +
  • +
  • + rule - rule the policy rule. +
  • +
+

+ Returns: +

+

succeeds or not.

+
+
+ + +
+

+ + + + + + buildRoleLinks + + + + + + public void buildRoleLinks(RoleManager rm) + +

buildRoleLinks initializes the roles in RBAC.

+

+ Parameters: +

+
    +
  • + rm - rm the role manager. +
  • +
+
+
+ + + +

+ + + + + + clearPolicy + + + + + + public void clearPolicy() +

clearPolicy clears all current policy.

+
+
+ + +
+

+ + + + + + getFilteredPolicy + + + + + + public List​<List​<java.​lang.​String>​>​ getFilteredPolicy(java.​lang.​String sec, java.​lang.​String ptype, int fieldIndex, java.​lang.​String[] fieldValues) +

getFilteredPolicy gets rules based on field filters from a policy.

+

+ Parameters: +

+
    +
  • + sec - sec the section, "p" or "g". +
  • +
  • + ptype - ptype the policy type, "p", "p2", .. or "g", "g2", .. +
  • +
  • + fieldIndex - fieldIndex the policy rule's start index to be matched. +
  • +
  • + fieldValues - fieldValues the field values to be matched, value "" + means not to match this field. +
  • +
+

+ Returns: +

+

the filtered policy rules of section sec and policy type ptype.

+
+
+ + +
+

+ + + + + + getPolicy + + + + + + public List​<List​<java.​lang.​String>​>​ getPolicy(java.​lang.​String sec, java.​lang.​String ptype) +

getPolicy gets all rules in a policy.

+

+ Parameters: +

+
    +
  • + sec - sec the section, "p" or "g". +
  • +
  • + ptype - ptype the policy type, "p", "p2", .. or "g", "g2", .. +
  • +
+

+ Returns: +

+

the policy rules of section sec and policy type ptype.

+
+
+ + +
+

+ + + + + + getValuesForFieldInPolicy + + + + + + public List​<java.​lang.​String>​ getValuesForFieldInPolicy(java.​lang.​String sec, java.​lang.​String ptype, int fieldIndex) +

getValuesForFieldInPolicy gets all values for a field for all rules in a policy, duplicated values are removed.

+

+ Parameters: +

+
    +
  • + sec - sec the section, "p" or "g". +
  • +
  • + ptype - ptype the policy type, "p", "p2", .. or "g", "g2", .. +
  • +
  • + fieldIndex - fieldIndex the policy rule's index. +
  • +
+

+ Returns: +

+

the field values specified by fieldIndex.

+
+
+ + +
+

+ + + + + + hasPolicy + + + + + + public boolean hasPolicy(java.​lang.​String sec, java.​lang.​String ptype, List​<java.​lang.​String>​ rule) +

hasPolicy determines whether a model has the specified policy rule.

+

+ Parameters: +

+
    +
  • + sec - sec the section, "p" or "g". +
  • +
  • + ptype - ptype the policy type, "p", "p2", .. or "g", "g2", .. +
  • +
  • + rule - rule the policy rule. +
  • +
+

+ Returns: +

+

whether the rule exists.

+
+
+ + +
+

+ + + + + + printPolicy + + + + + + public void printPolicy() +

printPolicy prints the policy to log.

+
+
+ + +
+

+ + + + + + removeFilteredPolicy + + + + + + public boolean removeFilteredPolicy(java.​lang.​String sec, java.​lang.​String ptype, int fieldIndex, java.​lang.​String[] fieldValues) +

removeFilteredPolicy removes policy rules based on field filters from the model.

+

+ Parameters: +

+
    +
  • + sec - sec the section, "p" or "g". +
  • +
  • + ptype - ptype the policy type, "p", "p2", .. or "g", "g2", .. +
  • +
  • + fieldIndex - fieldIndex the policy rule's start index to be matched. +
  • +
  • + fieldValues - fieldValues the field values to be matched, value "" + means not to match this field. +
  • +
+

+ Returns: +

+

succeeds or not.

+
+
+ + +
+

+ + + + + + removePolicy + + + + + + public boolean removePolicy(java.​lang.​String sec, java.​lang.​String ptype, List​<java.​lang.​String>​ rule) +

removePolicy removes a policy rule from the model.

+

+ Parameters: +

+
    +
  • + sec - sec the section, "p" or "g". +
  • +
  • + ptype - ptype the policy type, "p", "p2", .. or "g", "g2", .. +
  • +
  • + rule - rule the policy rule. +
  • +
+

+ Returns: +

+

succeeds or not.

+
+
+ + +
+

+ + + + + + savePolicyToText + + + + + + public java.​lang.​String savePolicyToText() +

savePolicyToText saves the policy to the text.

+

+ Returns: +

+

the policy text.

+
+
+ + +
+

+

+ +
\ No newline at end of file diff --git a/test/html/build.xml b/test/html/build.xml new file mode 100644 index 0000000..3ca0842 --- /dev/null +++ b/test/html/build.xml @@ -0,0 +1,12 @@ + + + + + Expect that an HTML codeblock syntax is highlighted correctly + + + + + + + diff --git a/test/html/document.ditamap b/test/html/document.ditamap new file mode 100644 index 0000000..bca2ef8 --- /dev/null +++ b/test/html/document.ditamap @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/test/html/expected.html b/test/html/expected.html new file mode 100644 index 0000000..ea8b890 --- /dev/null +++ b/test/html/expected.html @@ -0,0 +1,48 @@ +
+

topic

+
+

+ Lorem ipsum dolor sit amet consectetur adipiscing, elit porttitor taciti nostra dis potenti donec, fusce gravida primis metus. +

+

This page’s logo (SVG), highlighted with Prism:

+

+	 	
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 170">
+	<path fill="#fff" d="M55.37 131.5H48.4v9.13h6.97c1.67 0 2.92-.4 3.78-1.22.85
+	-.8 1.28-1.92 1.28-3.33s-.43-2.54-1.28-3.35c-.86-.8-2.12-1.2-3.78-1.2m29.52
+	6.4c.3-.53.47-1.2.47-2.04 0-1.35-.45-2.4-1.37-3.2-.92-.76-2.14-1.15-3.65
+	-1.15H72.9v8.52h7.32c2.26 0 3.82-.7 4.67-2.1M100 0L0 170h200L100 0M60.86
+	141.03c-1.3 1.22-3.1 1.84-5.33 1.84H48.4v7.55H46v-21.2h9.53c2.24 0 4.02.63
+	5.34 1.87 1.3 1.23 1.96 2.88 1.96 4.95 0 2.1-.66 3.75-1.97 4.98m24.5 9.4l
+	-5.1-8.14h-7.37v8.12h-2.4v-21.2h10.14c2.15 0 3.88.6 5.18 1.8 1.3 1.18 1.95
+	2.8 1.95 4.84 0 2.64-1.1 4.44-3.3 5.4-.6.28-1.22.5-1.82.6l5.57 8.56h-2.85m
+	13.43 0h-2.4v-21.2h2.4v21.2m23.56-1.32c-1.48 1.05-3.53 1.57-6.16 1.57-2.96 0
+	-5.23-.6-6.78-1.85-1.4-1.1-2.18-2.7-2.37-4.74h2.5c.08 1.45.78 2.56 2.1 3.33
+	1.16.67 2.68 1 4.58 1 3.97 0 5.95-1.25 5.95-3.74 0-.86-.35-1.53-1.07-2.02-.7
+	-.5-1.6-.9-2.68-1.2-1.07-.33-2.24-.63-3.48-.9s-2.4-.65-3.5-1.08-1.97-1.02
+	-2.68-1.73c-.7-.72-1.07-1.68-1.07-2.9 0-1.73.65-3.13 1.97-4.22 1.32-1.08
+	3.32-1.62 6-1.62 2.67 0 4.75.6 6.23 1.85 1.34 1.1 2.05 2.5 2.14 4.2h-2.46c
+	-.22-1.76-1.35-2.92-3.4-3.5-.72-.2-1.62-.3-2.7-.3s-1.98.1-2.72.35c-.74.25
+	-1.3.55-1.7.9-.42.35-.7.74-.83 1.17s-.2.88-.2 1.36c0 .5.2.93.62 1.33s.96.75
+	1.65 1.03c.68.28 1.46.52 2.33.73.88.2 1.77.43 2.67.65.9.22 1.8.48 2.68.77.87
+	.3 1.65.65 2.33 1.1 1.53.96 2.28 2.27 2.28 3.94 0 2-.74 3.5-2.22 4.55m28.84
+	1.32v-17.54l-7.84 10.08-7.97-10.08v17.54H133v-21.2h2.78l7.58 10.06 7.45
+	-10.05h2.8v21.2h-2.4"/>
+</svg>
+	
+ +

Example:

+
var Prism = require('prismjs');
+
+// The code snippet you want to highlight, as a string
+var code = "var data = 1;";
+
+// Returns a highlighted HTML string
+var html = Prism.highlight(code, Prism.languages.javascript, 'javascript');
+ +

Requiring prismjs will load the default languages: markup, css, + clike and javascript. You can load more languages with the + loadLanguages() utility, which will automatically handle any required dependencies. +

+
+
diff --git a/test/html/logo.svg b/test/html/logo.svg new file mode 100644 index 0000000..698d292 --- /dev/null +++ b/test/html/logo.svg @@ -0,0 +1,23 @@ + + + + \ No newline at end of file diff --git a/test/html/topic.dita b/test/html/topic.dita new file mode 100644 index 0000000..405962c --- /dev/null +++ b/test/html/topic.dita @@ -0,0 +1,28 @@ + + + + topic + +

+ Lorem ipsum dolor sit amet consectetur adipiscing, elit porttitor taciti nostra dis potenti donec, fusce gravida primis metus. +

+

This page’s logo (SVG), highlighted with Prism:

+ + + + +

Example:

+ var Prism = require('prismjs'); + +// The code snippet you want to highlight, as a string +var code = "var data = 1;"; + +// Returns a highlighted HTML string +var html = Prism.highlight(code, Prism.languages.javascript, 'javascript'); + +

Requiring prismjs will load the default languages: markup, css, + clike and javascript. You can load more languages with the + loadLanguages() utility, which will automatically handle any required dependencies. +

+ +
\ No newline at end of file diff --git a/test/javadoc/build.xml b/test/javadoc/build.xml new file mode 100644 index 0000000..7900b26 --- /dev/null +++ b/test/javadoc/build.xml @@ -0,0 +1,12 @@ + + + + + Expect that PDF codeblock text highlights embedded elements correctly + + + + + + + diff --git a/test/javadoc/document.ditamap b/test/javadoc/document.ditamap new file mode 100644 index 0000000..221952a --- /dev/null +++ b/test/javadoc/document.ditamap @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/test/javadoc/expected.fo b/test/javadoc/expected.fo new file mode 100644 index 0000000..1a1f6ad --- /dev/null +++ b/test/javadoc/expected.fo @@ -0,0 +1,1000 @@ + + + + + 1 + codeblock + + Chapter + 1 + + + codeblock + + + + + + + + Topics: + + + + + + + + API Reference + + + + + + + + + + + + + + + + + API Reference + + API Reference + + + + Packages + + + + + + + + + org.casbin.jcasbin.config + + + + + + + + + + org.casbin.jcasbin.effect + + + + + + + + + + org.casbin.jcasbin.exception + + + + + + + + + + org.casbin.jcasbin.main + + + + + + + + + + org.casbin.jcasbin.model + + + + + + + + + + org.casbin.jcasbin.persist + + + + + + + + + + org.casbin.jcasbin.persist.file_adapter + + + + + + + + + + org.casbin.jcasbin.rbac + + + + + + + + + + org.casbin.jcasbin.util + + + + + + + + + + org.casbin.jcasbin.util.function + + + + + + + + + + + + + Package org.casbin.jcasbin.config + + + + Class Summary + + + + + + + + + Config + + + + + + + + + + + + + Class Config + + + + public + class + + Config + + extendsjava + .lang + . + Object + + + Method Summary + + + + + + + + + + Modifier and Type + + + Method and Description + + + + + + + + java + .​lang + .​ + String + + + + + + + get + (java + .​lang + .​ + Stringkey + ) + + + + + + + + + boolean + + + + + + + getBool + (java + .​lang + .​ + Stringkey + ) + + + + + + + + + float + + + + + + + getFloat + (java + .​lang + .​ + Stringkey + ) + + + + + + + + + int + + + + + + + getInt + (java + .​lang + .​ + Stringkey + ) + + + + + + + + java + .​lang + .​ + String + + + + + + + getString + (java + .​lang + .​ + Stringkey + ) + + + + + + + + java + .​lang + .​ + String + + + + + + + getStrings + (java + .​lang + .​ + Stringkey + ) + + + + + + + + + static + Config + + + + + + + newConfig + (java + .​lang + .​ + StringconfName + ) + - newConfig create an empty configuration representation from file. + + + + + + + static + Config + + + + + + + newConfigFromText + (java + .​lang + .​ + Stringtext + ) + - newConfigFromText create an empty configuration representation from text. + + + + + + + void + + + + + + + set + (java + .​lang + .​ + Stringkey + ,java + .​lang + .​ + Stringvalue + ) + + + + + + + + + + + + + + + + + Methods inherited from class java.lang.Object + + + + + + + + clone + ,equals + ,finalize + ,getClass + ,hashCode + ,notify + ,notifyAll + ,toString + ,wait + ,wait + ,wait + + + + + + + + + + + Method Detail + + + + + + + + + get + + + + + + + + + publicjava + .​lang + .​ + String + get + (java + .​lang + .​ + Stringkey + ) + + + + Parameters: + + + + + + + + + key + + + + + + Returns: + + + java + .lang + . + String + + + + + + + + + + + + + + + + + + getBool + + + + + + + + + public + boolean + getBool + (java + .​lang + .​ + Stringkey + ) + + + + Parameters: + + + + + + + + + key + + + + + + Returns: + + + + boolean + + + + + + + + + + + + + + + + + + getFloat + + + + + + + + + public + float + getFloat + (java + .​lang + .​ + Stringkey + ) + + + + Parameters: + + + + + + + + + key + + + + + + Returns: + + + + float + + + + + + + + + + + + + + + + + + getInt + + + + + + + + + public + int + getInt + (java + .​lang + .​ + Stringkey + ) + + + + Parameters: + + + + + + + + + key + + + + + + Returns: + + + + int + + + + + + + + + + + + + + + + + + getString + + + + + + + + + publicjava + .​lang + .​ + String + getString + (java + .​lang + .​ + Stringkey + ) + + + + Parameters: + + + + + + + + + key + + + + + + Returns: + + + java + .lang + . + String + + + + + + + + + + + + + + + + + + getStrings + + + + + + + + + publicjava + .​lang + .​ + String + getStrings + (java + .​lang + .​ + Stringkey + ) + + + + Parameters: + + + + + + + + + key + + + + + + Returns: + + + java + .lang + . + String + [ + ] + + + + + + + + + + + + + + + + + + newConfig + + + + + + + + + public + static + Config + newConfig + (java + .​lang + .​ + StringconfName + ) + + newConfig create an empty configuration representation from file. + + Parameters: + + + + + + + + + confName- confName the path of the model file. + + + + + Returns: + + the constructor of Config. + + + + + + + + + + + + + + + + newConfigFromText + + + + + + + + + public + static + Config + newConfigFromText + (java + .​lang + .​ + Stringtext + ) + + newConfigFromText create an empty configuration representation from text. + + Parameters: + + + + + + + + + text- text the model text. + + + + + Returns: + + the constructor of Config. + + + + + + + + + + + + + + + + set + + + + + + + + + public + void + set + (java + .​lang + .​ + Stringkey + ,java + .​lang + .​ + Stringvalue + ) + + + + Parameters: + + + + + + + + + key + + + + + + + + + + value + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/javadoc/topic.dita b/test/javadoc/topic.dita new file mode 100644 index 0000000..eafab8a --- /dev/null +++ b/test/javadoc/topic.dita @@ -0,0 +1,491 @@ + + + + API Reference + +
+ Packages +
    +
  • + org.casbin.jcasbin.config +
  • +
  • + org.casbin.jcasbin.effect +
  • +
  • + org.casbin.jcasbin.exception +
  • +
  • + org.casbin.jcasbin.main +
  • +
  • + org.casbin.jcasbin.model +
  • +
  • + org.casbin.jcasbin.persist +
  • +
  • + org.casbin.jcasbin.persist.file_adapter +
  • +
  • + org.casbin.jcasbin.rbac +
  • +
  • + org.casbin.jcasbin.util +
  • +
  • + org.casbin.jcasbin.util.function +
  • +
+
+ + + Package org.casbin.jcasbin.config + + org.casbin.jcasbin.config + org.casbin.jcasbin.config + + +
+ Class Summary +
    +
  • + Config +
  • +
+
+ + + Class Config + + Config + Config + + + public class Config extends java.lang.Object +
+ Method Summary + + + + + + + Modifier and Type + Method and Description + + + + + + java.​lang.​String + + + + get(java.​lang.​String key) + + + + + + boolean + + + + getBool(java.​lang.​String key) + + + + + + float + + + + getFloat(java.​lang.​String key) + + + + + + int + + + + getInt(java.​lang.​String key) + + + + + + java.​lang.​String + + + + getString(java.​lang.​String key) + + + + + + java.​lang.​String + + + + getStrings(java.​lang.​String key) + + + + + + static Config + + + + + newConfig(java.​lang.​String confName) + - newConfig create an empty configuration representation from file. + + + + + static Config + + + + + newConfigFromText(java.​lang.​String text) + - newConfigFromText create an empty configuration representation from text. + + + + + void + + + + set(java.​lang.​String key, java.​lang.​String value) + + + + + +
+

+ + + + + + Methods inherited from class java.lang.Object + + + + + + clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait + + + + +
+

+
+ Method Detail + + + + + + get + + + + + + public java.​lang.​String get(java.​lang.​String key) +

+

+ Parameters: +

+
    +
  • + key +
  • +
+

+ Returns: +

+

+ java.lang.String +

+
+
+ + +
+

+ + + + + + getBool + + + + + + public boolean getBool(java.​lang.​String key) +

+

+ Parameters: +

+
    +
  • + key +
  • +
+

+ Returns: +

+

+ boolean +

+
+
+ + +
+

+ + + + + + getFloat + + + + + + public float getFloat(java.​lang.​String key) +

+

+ Parameters: +

+
    +
  • + key +
  • +
+

+ Returns: +

+

+ float +

+
+
+ + +
+

+ + + + + + getInt + + + + + + public int getInt(java.​lang.​String key) +

+

+ Parameters: +

+
    +
  • + key +
  • +
+

+ Returns: +

+

+ int +

+
+
+ + +
+

+ + + + + + getString + + + + + + public java.​lang.​String getString(java.​lang.​String key) +

+

+ Parameters: +

+
    +
  • + key +
  • +
+

+ Returns: +

+

+ java.lang.String +

+
+
+ + +
+

+ + + + + + getStrings + + + + + + public java.​lang.​String getStrings(java.​lang.​String key) +

+

+ Parameters: +

+
    +
  • + key +
  • +
+

+ Returns: +

+

+ java.lang.String[] +

+
+
+ + +
+

+ + + + + + newConfig + + + + + + public static Config newConfig(java.​lang.​String confName) + +

newConfig create an empty configuration representation from file.

+

+ Parameters: +

+
    +
  • + confName - confName the path of the model file. +
  • +
+

+ Returns: +

+

the constructor of Config.

+
+
+ + +
+

+ + + + + + newConfigFromText + + + + + + public static Config newConfigFromText(java.​lang.​String text) + +

newConfigFromText create an empty configuration representation from text.

+

+ Parameters: +

+
    +
  • + text - text the model text. +
  • +
+

+ Returns: +

+

the constructor of Config.

+
+
+ + +
+

+ + + + + + set + + + + + + public void set(java.​lang.​String key, java.​lang.​String value) +

+

+ Parameters: +

+
    +
  • + key +
  • +
  • + value +
  • +
+
+
+ + +
+

+

+ +
+
+
\ No newline at end of file diff --git a/test/load-libraries/build.xml b/test/load-libraries/build.xml new file mode 100644 index 0000000..7f80996 --- /dev/null +++ b/test/load-libraries/build.xml @@ -0,0 +1,12 @@ + + + + + Expect that an HTML codeblock using java and docker loads the libs and highlights + + + + + + + diff --git a/test/load-libraries/document.ditamap b/test/load-libraries/document.ditamap new file mode 100644 index 0000000..bca2ef8 --- /dev/null +++ b/test/load-libraries/document.ditamap @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/test/load-libraries/expected.html b/test/load-libraries/expected.html new file mode 100644 index 0000000..7f38b9a --- /dev/null +++ b/test/load-libraries/expected.html @@ -0,0 +1,51 @@ +
+

topic

+
+

+ Lorem ipsum dolor sit amet consectetur adipiscing, elit porttitor taciti nostra dis potenti donec, fusce gravida primis metus. +

+

Example Java

+

+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package helloworldapp;
+
+/**
+ * The HelloWorldApp class implements an application that
+ * simply prints "Hello World!" to standard output.
+ */
+public class HelloWorldApp {
+
+   
+    /**
+     * @param args the command line arguments
+     */
+    public static void main(String[] args) {
+        System.out.println("Hello World!"); // Display the string.
+    }
+
+}
+	
+ +

Example Dockerfile

+

+FROM openjdk:8-jdk-alpine
+VOLUME /tmp
+ADD target/hello-docker-0.0.1-SNAPSHOT.jar hello-docker-app.jar
+ENV JAVA_OPTS=""
+ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /hello-docker-app.jar" ]
+	
+ +

Example no highlights

+

+Plain text = ""
+  
+ +

+ Lorem ipsum dolor sit amet consectetur adipiscing, elit porttitor taciti nostra dis potenti donec, fusce gravida primis metus. +

+
+
diff --git a/test/load-libraries/logo.svg b/test/load-libraries/logo.svg new file mode 100644 index 0000000..698d292 --- /dev/null +++ b/test/load-libraries/logo.svg @@ -0,0 +1,23 @@ + + + + \ No newline at end of file diff --git a/test/load-libraries/topic.dita b/test/load-libraries/topic.dita new file mode 100644 index 0000000..91ddf6c --- /dev/null +++ b/test/load-libraries/topic.dita @@ -0,0 +1,53 @@ + + + + topic + +

+ Lorem ipsum dolor sit amet consectetur adipiscing, elit porttitor taciti nostra dis potenti donec, fusce gravida primis metus. +

+

Example Java

+ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package helloworldapp; + +/** + * The HelloWorldApp class implements an application that + * simply prints "Hello World!" to standard output. + */ +public class HelloWorldApp { + + + /** + * @param args the command line arguments + */ + public static void main(String[] args) { + System.out.println("Hello World!"); // Display the string. + } + +} + + +

Example Dockerfile

+ +FROM openjdk:8-jdk-alpine +VOLUME /tmp +ADD target/hello-docker-0.0.1-SNAPSHOT.jar hello-docker-app.jar +ENV JAVA_OPTS="" +ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /hello-docker-app.jar" ] + + +

Example no highlights

+ +Plain text = "" + + +

+ Lorem ipsum dolor sit amet consectetur adipiscing, elit porttitor taciti nostra dis potenti donec, fusce gravida primis metus. +

+ +
\ No newline at end of file diff --git a/test/pdf/build.xml b/test/pdf/build.xml new file mode 100644 index 0000000..0225295 --- /dev/null +++ b/test/pdf/build.xml @@ -0,0 +1,12 @@ + + + + + Expect that PDF codeblock text highlights syntax correctly + + + + + + + diff --git a/test/pdf/document.ditamap b/test/pdf/document.ditamap new file mode 100644 index 0000000..221952a --- /dev/null +++ b/test/pdf/document.ditamap @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/test/pdf/expected.fo b/test/pdf/expected.fo new file mode 100644 index 0000000..2c37cd8 --- /dev/null +++ b/test/pdf/expected.fo @@ -0,0 +1,156 @@ + + + + + 1 + codeblock + + Chapter + 1 + + + codeblock + + + + + + + + Topics: + + + + + + + + topic + + + + + + + + + + + + + + + + + topic + + topic + + + Lorem ipsum dolor sit amet consectetur adipiscing, elit porttitor taciti nostra dis potenti donec, fusce gravida primis metus. + This page’s logo (SVG), highlighted with Prism: + + + + <svg + xmlns + + = + "http://www.w3.org/2000/svg + " + + viewBox + + = + "0 0 200 170 + " + + > + + + + <path + fill + + = + "#fff + " + + d + + = + "M55.37 131.5H48.4v9.13h6.97c1.67 0 2.92-.4 3.78-1.22.85 + -.8 1.28-1.92 1.28-3.33s-.43-2.54-1.28-3.35c-.86-.8-2.12-1.2-3.78-1.2m29.52 + 6.4c.3-.53.47-1.2.47-2.04 0-1.35-.45-2.4-1.37-3.2-.92-.76-2.14-1.15-3.65 + -1.15H72.9v8.52h7.32c2.26 0 3.82-.7 4.67-2.1M100 0L0 170h200L100 0M60.86 + 141.03c-1.3 1.22-3.1 1.84-5.33 1.84H48.4v7.55H46v-21.2h9.53c2.24 0 4.02.63 + 5.34 1.87 1.3 1.23 1.96 2.88 1.96 4.95 0 2.1-.66 3.75-1.97 4.98m24.5 9.4l + -5.1-8.14h-7.37v8.12h-2.4v-21.2h10.14c2.15 0 3.88.6 5.18 1.8 1.3 1.18 1.95 + 2.8 1.95 4.84 0 2.64-1.1 4.44-3.3 5.4-.6.28-1.22.5-1.82.6l5.57 8.56h-2.85m + 13.43 0h-2.4v-21.2h2.4v21.2m23.56-1.32c-1.48 1.05-3.53 1.57-6.16 1.57-2.96 0 + -5.23-.6-6.78-1.85-1.4-1.1-2.18-2.7-2.37-4.74h2.5c.08 1.45.78 2.56 2.1 3.33 + 1.16.67 2.68 1 4.58 1 3.97 0 5.95-1.25 5.95-3.74 0-.86-.35-1.53-1.07-2.02-.7 + -.5-1.6-.9-2.68-1.2-1.07-.33-2.24-.63-3.48-.9s-2.4-.65-3.5-1.08-1.97-1.02 + -2.68-1.73c-.7-.72-1.07-1.68-1.07-2.9 0-1.73.65-3.13 1.97-4.22 1.32-1.08 + 3.32-1.62 6-1.62 2.67 0 4.75.6 6.23 1.85 1.34 1.1 2.05 2.5 2.14 4.2h-2.46c + -.22-1.76-1.35-2.92-3.4-3.5-.72-.2-1.62-.3-2.7-.3s-1.98.1-2.72.35c-.74.25 + -1.3.55-1.7.9-.42.35-.7.74-.83 1.17s-.2.88-.2 1.36c0 .5.2.93.62 1.33s.96.75 + 1.65 1.03c.68.28 1.46.52 2.33.73.88.2 1.77.43 2.67.65.9.22 1.8.48 2.68.77.87 + .3 1.65.65 2.33 1.1 1.53.96 2.28 2.27 2.28 3.94 0 2-.74 3.5-2.22 4.55m28.84 + 1.32v-17.54l-7.84 10.08-7.97-10.08v17.54H133v-21.2h2.78l7.58 10.06 7.45 + -10.05h2.8v21.2h-2.4 + " + + /> + + + + </svg + > + + + Example: + + varPrism + = + require + ( + 'prismjs' + ) + ; + // The code snippet you want to highlight, as a string + varcode + = + "var data = 1;" + ; + // Returns a highlighted HTML string + varhtml + =Prism + . + highlight + (code + ,Prism + .languages + .javascript + , + 'javascript' + ) + ; + + Requiring + prismjswill load the default languages: + markup, + css, + clikeand + javascript. You can load more languages with the + + loadLanguages + ( + ) + utility, which will automatically handle any required dependencies. + + + + + + diff --git a/test/pdf/logo.svg b/test/pdf/logo.svg new file mode 100644 index 0000000..698d292 --- /dev/null +++ b/test/pdf/logo.svg @@ -0,0 +1,23 @@ + + + + \ No newline at end of file diff --git a/test/pdf/topic.dita b/test/pdf/topic.dita new file mode 100644 index 0000000..405962c --- /dev/null +++ b/test/pdf/topic.dita @@ -0,0 +1,28 @@ + + + + topic + +

+ Lorem ipsum dolor sit amet consectetur adipiscing, elit porttitor taciti nostra dis potenti donec, fusce gravida primis metus. +

+

This page’s logo (SVG), highlighted with Prism:

+ + + + +

Example:

+ var Prism = require('prismjs'); + +// The code snippet you want to highlight, as a string +var code = "var data = 1;"; + +// Returns a highlighted HTML string +var html = Prism.highlight(code, Prism.languages.javascript, 'javascript'); + +

Requiring prismjs will load the default languages: markup, css, + clike and javascript. You can load more languages with the + loadLanguages() utility, which will automatically handle any required dependencies. +

+ +
\ No newline at end of file diff --git a/test/setup.sh b/test/setup.sh new file mode 100755 index 0000000..c7f70da --- /dev/null +++ b/test/setup.sh @@ -0,0 +1,8 @@ +#!/bin/sh +# This file is part of the DITA-OT Prism-JS Plug-in project. +set -e + +apt-get update -q +export DEBIAN_FRONTEND=noninteractive +apt-get install -qy --no-install-recommends nodejs +nodejs -v \ No newline at end of file