Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document new Java API for 2.5 #131

Closed
infotexture opened this issue Feb 20, 2017 · 1 comment
Closed

Document new Java API for 2.5 #131

infotexture opened this issue Feb 20, 2017 · 1 comment
Assignees
Labels
feature New topic, feature or request
Milestone

Comments

@infotexture
Copy link
Member

Pull request dita-ot/dita-ot#2604 adds a simple API to invoke DITA-OT from Java. The Developer Reference and related documentation should be extended per @jelovirt's recommendations:

As a developer, my preference would be to ship Javadoc with our HTML documentation and have a tutorial topic on how to use it. The API is small, so a single topic should be enough.

@infotexture infotexture added the feature New topic, feature or request label Feb 20, 2017
@infotexture infotexture added this to the 2.5 milestone Feb 20, 2017
@jelovirt
Copy link
Member

jelovirt commented May 25, 2017

The goal of adding the new Java API to DITA-OT is to allow users to embed DITA-OT more easily to Java programs. When using the API, programmers don't need to know or care that DITA-OT uses Ant, they can just use Java. The ant shell script will handle the classpath setup for the user, but when using the API the classpath setup should be done as part of normal classpath configuration.

Example usage:

// Create reusable processor factory with DITA-OT base directory and temporary directory
ProcessorFactory pf = ProcessorFactory.newInstance(ditaDir);
pf.setBaseTempDir(tempDir);

// Create a processor using the factor and configure the processor
Processor p = pf.newProcessor("html5")
    .setInput(mapFile)
    .setOutputDir(outDir)
    .setProperty("nav-toc", "partial");

// Run conversion
p.run();

By default, running DITA-OT via the API will generate a debug log to temporary directory; a custom SLF4J logger can be used to access log.

By default, processor will clean the temporary directory, but this can be disabled for cases where the processor failed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New topic, feature or request
Projects
None yet
Development

No branches or pull requests

2 participants