Providing DITA plugins in an Oxygen project directory?
-
- Posts: 922
- Joined: Thu May 02, 2019 2:32 pm
Providing DITA plugins in an Oxygen project directory?
Post by chrispitude »
Is it possible to provide a DITA plugin in an Oxygen project directory?
From Radu's post in this thread (post53923.html?hilit=dita%20framework#p53824), the answer is currently no. But what would it take to make this work?
Our DITA books and PDF Chemistry publishing files are all stored in a Github repo that any writer can sync to their laptop. As we update the CSS files, all writers inherit the updates for the XML Author editor and the PDF output.
We would really like to have our DITA plugins (primarily the grammar plugin) also stored in the Git repo, so updates are synchronized to the writers' machines automatically -- without the need to manually copy them to modify the Oxygen XML Author installation directory.
On Windows, I wonder if an NTFS filesystem link could serve the purpose... It would still require a one-time creation, but then updates would be automatic. I'll try it and report back!
-
- Posts: 9439
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Providing DITA plugins in an Oxygen project directory?
In the DITA Open Toolkit there is a configuration file:
OXYGEN_INSTALL_DIR\frameworks\dita\DITA-OT3.x\config\configuration.properties
in which the paths to all plugin folders are specified:
Code: Select all
plugindirs = plugins;demo
This is all the publishing engine provides.
If your writers do not actually need to publish, you can just distribute your DITA OT specialization plugin inside the project and unconnected to a DITA OT.
Then in the Oxygen Preferences->"XML / XML Catalog" page you can add a reference to the catalog.xml from the plugin folder. The reference can use the ${pdu} editor variable and you can switch the entire "XML Catalog" page to "Project options" so that once they open the "project.xpr" in Oxygen they get this already set up.
This will make validation and content completion work, the publishing will not work unless the publishing engine knows about this plugin.
Another approach:
Take an entire DITA OT distribution and include it in the Git Project. Change the Oxygen Preferences->"DITA" page to point to that custom DITA OT distribution from the project, save the page at project level.
Regards,
Radu
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 922
- Joined: Thu May 02, 2019 2:32 pm
Re: Providing DITA plugins in an Oxygen project directory?
Post by chrispitude »
I was able to get NTFS filesystem links to work! (And linux filesystem works should work equally well.)
I created a
Code: Select all
link_to_oxygen.bat
Code: Select all
${pd}/prj/
The batch file (1) makes a filesystem link from the plugin to the Oxygen installation's DITA-OT directory, then (2) integrates it into Oxygen's DITA-OT:
Code: Select all
mklink /J "c:\Program Files\Oxygen XML Author 21\frameworks\dita\DITA-OT3.x\plugins\com.synopsys.docshell" "dita_plugins\com.synopsys.docshell"
"c:\program files\oxygen xml author 21\jre/bin/java" -Dfile.encoding=UTF-8 -Xmx256m -classpath "C:\Program Files\Oxygen XML Author 21\tools\ant/lib/ant-launcher.jar" "-Dant.home=C:\Program Files\Oxygen XML Author 21\tools\ant" org.apache.tools.ant.launch.Launcher -lib "C:\Program Files\Oxygen XML Author 21\frameworks\dita\DITA-OT3.x\config" -lib "C:\Program Files\Oxygen XML Author 21\classes" -lib "C:\Program Files\Oxygen XML Author 21\lib\oxygen.jar" -lib "C:\Program Files\Oxygen XML Author 21\lib\oxygenAuthor.jar" -lib "C:\Program Files\Oxygen XML Author 21\lib\oxygenDeveloper.jar" -lib "C:\Program Files\Oxygen XML Author 21\lib\oxygenEclipse.jar" -lib "C:\Program Files\Oxygen XML Author 21\lib\oxygenAuthorEclipse.jar" -lib "C:\Program Files\Oxygen XML Author 21\lib\oxygenDeveloperEclipse.jar" -lib "C:\Program Files\Oxygen XML Author 21\lib\oxygen-basic-utilities.jar" -lib "C:\Program Files\Oxygen XML Author 21\lib\oxygen-editor-variables-parser.jar" -lib "C:\Program Files\Oxygen XML Author 21\lib\oxygen-patched-resolver.jar" -lib "C:\Program Files\Oxygen XML Author 21\lib\xml-apis.jar" -lib "C:\Program Files\Oxygen XML Author 21\lib\oxygen-patched-xerces.jar" -lib "C:\Program Files\Oxygen XML Author 21\lib\oxygen-patched-saxon-9.jar" -lib "C:\Program Files\Oxygen XML Author 21\lib\saxon9-sql.jar" -lib "C:\Program Files\Oxygen XML Author 21\lib\log4j.jar" -lib "C:\Program Files\Oxygen XML Author 21\frameworks\dita\DITA-OT3.x\plugins\com.oxygenxml.dost.patches\lib\oxygen-dost-patches.jar" -lib "C:\Program Files\Oxygen XML Author 21\frameworks\dita\DITA-OT3.x\lib\ant-apache-resolver-1.10.5.jar" -lib "C:\Program Files\Oxygen XML Author 21\frameworks\dita\DITA-OT3.x\lib\ant-launcher.jar" -lib "C:\Program Files\Oxygen XML Author 21\frameworks\dita\DITA-OT3.x\lib\ant.jar" -lib "C:\Program Files\Oxygen XML Author 21\frameworks\dita\DITA-OT3.x\lib\commons-io-2.6.jar" -lib "C:\Program Files\Oxygen XML Author 21\frameworks\dita\DITA-OT3.x\lib\dost-configuration.jar" -lib "C:\Program Files\Oxygen XML Author 21\frameworks\dita\DITA-OT3.x\lib\dost.jar" -lib "C:\Program Files\Oxygen XML Author 21\frameworks\dita\DITA-OT3.x\lib\guava-25.1-jre.jar" -lib "C:\Program Files\Oxygen XML Author 21\frameworks\dita\DITA-OT3.x\lib\icu4j-61.1.jar" -lib "C:\Program Files\Oxygen XML Author 21\frameworks\dita\DITA-OT3.x\lib\isorelax-20030108.jar" -lib "C:\Program Files\Oxygen XML Author 21\frameworks\dita\DITA-OT3.x\lib\jackson-annotations-2.9.0.jar" -lib "C:\Program Files\Oxygen XML Author 21\frameworks\dita\DITA-OT3.x\lib\jackson-core-2.9.8.jar" -lib "C:\Program Files\Oxygen XML Author 21\frameworks\dita\DITA-OT3.x\lib\jackson-databind-2.9.8.jar" -lib "C:\Program Files\Oxygen XML Author 21\frameworks\dita\DITA-OT3.x\lib\jing-20181222.jar" -lib "C:\Program Files\Oxygen XML Author 21\frameworks\dita\DITA-OT3.x\lib\logback-classic-1.2.3.jar" -lib "C:\Program Files\Oxygen XML Author 21\frameworks\dita\DITA-OT3.x\lib\logback-core-1.2.3.jar" -lib "C:\Program Files\Oxygen XML Author 21\frameworks\dita\DITA-OT3.x\lib\Saxon-HE-9.8.0-14.jar" -lib "C:\Program Files\Oxygen XML Author 21\frameworks\dita\DITA-OT3.x\lib\slf4j-api-1.7.25.jar" -lib "C:\Program Files\Oxygen XML Author 21\frameworks\dita\DITA-OT3.x\lib\xercesImpl-2.12.0.jar" -lib "C:\Program Files\Oxygen XML Author 21\frameworks\dita\DITA-OT3.x\lib\xml-apis-1.4.01.jar" -lib "C:\Program Files\Oxygen XML Author 21\frameworks\dita\DITA-OT3.x\lib\xml-resolver-1.2.jar" -f "C:\Program Files\Oxygen XML Author 21\frameworks/dita/DITA-OT3.x/integrator.xml" "-Dstrict=true" "-Dwebhelp.trial.license=no"
I don't like how long the integration command line is; I just copied it from a log window in Oxygen XML Author. I tried using the startcmd.bat script but it couldn't find java.exe, and I'm not very good with CMD.exe scripting.
-
- Posts: 9439
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Providing DITA plugins in an Oxygen project directory?
One problem I see is that on most computers the path "C:\Program Files\Oxygen XML Author 21\" is a read-only folder path, editable only if somebody runs the script with administrative privileges. This means that running the DITA OT integrator would fail.
So you would need to instruct the end users to install Oxygen in a folder path where they have full write access (like in their user home).
Regards,
Radu
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 922
- Joined: Thu May 02, 2019 2:32 pm
Re: Providing DITA plugins in an Oxygen project directory?
Post by chrispitude »
I removed the plugin link and integrated to remove it, then removed my user permissions from the DITA-OT, then right-clicked the batch file and chose "Run as Administrator." It still worked - both the link and the plugin catalog update! And to prove that it overcame the permissions, Windows now won't let me delete the plugin link in the plugins/ folder without Administrator privileges.

-
- Posts: 922
- Joined: Thu May 02, 2019 2:32 pm
Re: Providing DITA plugins in an Oxygen project directory?
Post by chrispitude »
Code: Select all
pushd %~dp0
rmdir "c:\Program Files\Oxygen XML Author 21\frameworks\dita\DITA-OT3.x\plugins\com.synopsys.docshell" 2> nul
mklink /J "c:\Program Files\Oxygen XML Author 21\frameworks\dita\DITA-OT3.x\plugins\com.synopsys.docshell" "dita_plugins\com.synopsys.docshell"
popd
"c:\program files\oxygen xml author 21\jre/bin/java" -Dfile.encoding=UTF-8 -Xmx256m -classpath "C:\Program Files\Oxygen XML Author 21\tools\ant/lib/ant-launcher.jar" "-Dant.home=C:\Program Files\Oxygen XML Author 21\tools\ant" org.apache.tools.ant.launch.Launcher -lib "C:\Program Files\Oxygen XML Author 21\frameworks\dita\DITA-OT3.x\config" -lib "C:\Program Files\Oxygen XML Author 21\classes" -lib "C:\Program Files\Oxygen XML Author 21\lib\oxygen.jar" -lib "C:\Program Files\Oxygen XML Author 21\lib\oxygenAuthor.jar" -lib "C:\Program Files\Oxygen XML Author 21\lib\oxygenDeveloper.jar" -lib "C:\Program Files\Oxygen XML Author 21\lib\oxygenEclipse.jar" -lib "C:\Program Files\Oxygen XML Author 21\lib\oxygenAuthorEclipse.jar" -lib "C:\Program Files\Oxygen XML Author 21\lib\oxygenDeveloperEclipse.jar" -lib "C:\Program Files\Oxygen XML Author 21\lib\oxygen-basic-utilities.jar" -lib "C:\Program Files\Oxygen XML Author 21\lib\oxygen-editor-variables-parser.jar" -lib "C:\Program Files\Oxygen XML Author 21\lib\oxygen-patched-resolver.jar" -lib "C:\Program Files\Oxygen XML Author 21\lib\xml-apis.jar" -lib "C:\Program Files\Oxygen XML Author 21\lib\oxygen-patched-xerces.jar" -lib "C:\Program Files\Oxygen XML Author 21\lib\oxygen-patched-saxon-9.jar" -lib "C:\Program Files\Oxygen XML Author 21\lib\saxon9-sql.jar" -lib "C:\Program Files\Oxygen XML Author 21\lib\log4j.jar" -lib "C:\Program Files\Oxygen XML Author 21\frameworks\dita\DITA-OT3.x\plugins\com.oxygenxml.dost.patches\lib\oxygen-dost-patches.jar" -lib "C:\Program Files\Oxygen XML Author 21\frameworks\dita\DITA-OT3.x\lib\ant-apache-resolver-1.10.5.jar" -lib "C:\Program Files\Oxygen XML Author 21\frameworks\dita\DITA-OT3.x\lib\ant-launcher.jar" -lib "C:\Program Files\Oxygen XML Author 21\frameworks\dita\DITA-OT3.x\lib\ant.jar" -lib "C:\Program Files\Oxygen XML Author 21\frameworks\dita\DITA-OT3.x\lib\commons-io-2.6.jar" -lib "C:\Program Files\Oxygen XML Author 21\frameworks\dita\DITA-OT3.x\lib\dost-configuration.jar" -lib "C:\Program Files\Oxygen XML Author 21\frameworks\dita\DITA-OT3.x\lib\dost.jar" -lib "C:\Program Files\Oxygen XML Author 21\frameworks\dita\DITA-OT3.x\lib\guava-25.1-jre.jar" -lib "C:\Program Files\Oxygen XML Author 21\frameworks\dita\DITA-OT3.x\lib\icu4j-61.1.jar" -lib "C:\Program Files\Oxygen XML Author 21\frameworks\dita\DITA-OT3.x\lib\isorelax-20030108.jar" -lib "C:\Program Files\Oxygen XML Author 21\frameworks\dita\DITA-OT3.x\lib\jackson-annotations-2.9.0.jar" -lib "C:\Program Files\Oxygen XML Author 21\frameworks\dita\DITA-OT3.x\lib\jackson-core-2.9.8.jar" -lib "C:\Program Files\Oxygen XML Author 21\frameworks\dita\DITA-OT3.x\lib\jackson-databind-2.9.8.jar" -lib "C:\Program Files\Oxygen XML Author 21\frameworks\dita\DITA-OT3.x\lib\jing-20181222.jar" -lib "C:\Program Files\Oxygen XML Author 21\frameworks\dita\DITA-OT3.x\lib\logback-classic-1.2.3.jar" -lib "C:\Program Files\Oxygen XML Author 21\frameworks\dita\DITA-OT3.x\lib\logback-core-1.2.3.jar" -lib "C:\Program Files\Oxygen XML Author 21\frameworks\dita\DITA-OT3.x\lib\Saxon-HE-9.8.0-14.jar" -lib "C:\Program Files\Oxygen XML Author 21\frameworks\dita\DITA-OT3.x\lib\slf4j-api-1.7.25.jar" -lib "C:\Program Files\Oxygen XML Author 21\frameworks\dita\DITA-OT3.x\lib\xercesImpl-2.12.0.jar" -lib "C:\Program Files\Oxygen XML Author 21\frameworks\dita\DITA-OT3.x\lib\xml-apis-1.4.01.jar" -lib "C:\Program Files\Oxygen XML Author 21\frameworks\dita\DITA-OT3.x\lib\xml-resolver-1.2.jar" -f "C:\Program Files\Oxygen XML Author 21\frameworks/dita/DITA-OT3.x/integrator.xml" "-Dstrict=true" "-Dwebhelp.trial.license=no"
timeout 20

-
- Posts: 9439
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Providing DITA plugins in an Oxygen project directory?
This should also work:
OXYGEN_INSTALL_DIR\frameworks\dita\DITA-OT3.x\bin\dita --install
https://www.dita-ot.org/dev/topics/plug ... lling.html
As the "dita.bat" will by default use the JAVA_HOME editor variable maybe you can set that in your script to the Java bundled with Oxygen so that even if people do not have Java installed separately the bat will still work.
Regards,
Radu
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 922
- Joined: Thu May 02, 2019 2:32 pm
Re: Providing DITA plugins in an Oxygen project directory?
Post by chrispitude »
Good suggestion! This works much better:
Code: Select all
set OXYGEN_HOME=c:\Program Files\Oxygen XML Author 21
pushd %~dp0
rmdir "%OXYGEN_HOME%\frameworks\dita\DITA-OT3.x\plugins\com.synopsys.docshell" 2> nul
mklink /J "%OXYGEN_HOME%\frameworks\dita\DITA-OT3.x\plugins\com.synopsys.docshell" "dita_plugins\com.synopsys.docshell"
popd
set JAVA_HOME=%OXYGEN_HOME%\jre
call "%OXYGEN_HOME%\frameworks\dita\DITA-OT3.x\bin\dita.bat" --install
timeout 20
-
- Posts: 922
- Joined: Thu May 02, 2019 2:32 pm
Re: Providing DITA plugins in an Oxygen project directory?
Post by chrispitude »
Code: Select all
@rem chrispy - 2/13/2020
@echo off
net session >nul 2>&1
if %ERRORLEVEL% neq 0 (
echo Error: You must run this script by right-clicking and choosing "Run as administrator".
timeout 20
EXIT /b 1
)
if exist "c:\Program Files\Oxygen XML Author 22\oxygenAuthor22.0.exe" (
call :install_plugin "c:\Program Files\Oxygen XML Author 22"
)
if exist "c:\Program Files\Oxygen XML Editor 22" (
call :install_plugin "c:\Program Files\Oxygen XML Editor 22"
)
if not exist "c:\Program Files\Oxygen XML Author 22\oxygenAuthor22.0.exe"
if not exist "c:\Program Files\Oxygen XML Editor 22" (
echo No Oxygen XML Author or Oxygen XML Editor installations found.
)
timeout 20
exit /b
:install_plugin
set OXYGEN_HOME=%1
set OXYGEN_HOME=%OXYGEN_HOME:"=%
echo Installing DITA-OT plugins in %OXYGEN_HOME%...
echo (ignore the "no tools.jar found" message)^
pushd %~dp0
rmdir "%OXYGEN_HOME%\frameworks\dita\DITA-OT3.x\plugins\com.synopsys.plugin1" 2> nul
rmdir "%OXYGEN_HOME%\frameworks\dita\DITA-OT3.x\plugins\com.synopsys.plugin2" 2> nul
mklink /J "%OXYGEN_HOME%\frameworks\dita\DITA-OT3.x\plugins\com.synopsys.plugin1" "dita_plugins\com.synopsys.plugin1"
mklink /J "%OXYGEN_HOME%\frameworks\dita\DITA-OT3.x\plugins\com.synopsys.plugin2" "dita_plugins\com.synopsys.plugin2"
popd
set JAVA_HOME=%OXYGEN_HOME%\jre
call "%OXYGEN_HOME%\frameworks\dita\DITA-OT3.x\bin\dita.bat" --install
-
- Posts: 922
- Joined: Thu May 02, 2019 2:32 pm
Re: Providing DITA plugins in an Oxygen project directory?
Post by chrispitude »
Here is an updated script that
- installs all plugins matching a pattern ("com.synopsys.*" in our case) instead of using a hardcoded list
- installs/updates the plugins in all "C:\Program Files\Oxygen XML *" installations, instead of using hardcoded versions/paths
Code: Select all
@rem chrispy - 2/24/2021
@echo off
net session >nul 2>&1
if %ERRORLEVEL% neq 0 (
echo Error: You must run this script by right-clicking and choosing "Run as administrator".
timeout 20
EXIT /b 1
)
rem loop through Oxygen installations
@echo off
pushd %~dp0
for /d %%f in ("C:\Program Files\Oxygen XML *") do (
call :install_plugins "%%f"
)
popd
timeout 20
exit /b
:install_plugins
set OXYGEN_HOME=%1
set OXYGEN_HOME=%OXYGEN_HOME:"=%
echo Installing DITA-OT plugins in %OXYGEN_HOME%...
rem loop through plugin directories
for /d %%P in ("dita_plugins\com.synopsys.*") do (
rem pass only final directory name of %P%
call :link_plugin "%OXYGEN_HOME%" "%%~nxP"
)
set JAVA_HOME=%OXYGEN_HOME%\jre
call "%OXYGEN_HOME%\frameworks\dita\DITA-OT3.x\bin\dita.bat" --install
echo.
exit /b
:link_plugin
set OXYGEN_HOME=%1
set PLUGIN_DIR=%2
set OXYGEN_HOME=%OXYGEN_HOME:"=%
set PLUGIN_DIR=%PLUGIN_DIR:"=%
set SOURCE=dita_plugins\%PLUGIN_DIR%
set DEST=%OXYGEN_HOME%\frameworks\dita\DITA-OT3.x\plugins\%PLUGIN_DIR%
rmdir /S /Q "%DEST%" 2> nul
rm "%DEST%" 2> nul
mklink /J "%DEST%" "%SOURCE%"
exit /b
-
- Posts: 1016
- Joined: Wed Nov 16, 2005 11:11 am
Re: Providing DITA plugins in an Oxygen project directory?
Post by alex_jitianu »
Thank you for sharing it with the community!
Best regards,
Alex
-
- Posts: 922
- Joined: Thu May 02, 2019 2:32 pm
Re: Providing DITA plugins in an Oxygen project directory?
Post by chrispitude »
Note the new "quietly remove existing plugin links/directories" loop below:
Code: Select all
@rem chrispy - 12/14/2021
@echo off
net session >nul 2>&1
if %ERRORLEVEL% neq 0 (
echo Error: You must run this script by right-clicking and choosing "Run as administrator".
timeout 20
EXIT /b 1
)
rem loop through Oxygen installations
@echo off
pushd %~dp0
for /d %%f in ("C:\Program Files\Oxygen XML *") do (
call :install_plugins "%%f"
)
popd
timeout 20
exit /b
:install_plugins
set OXYGEN_HOME=%1
set OXYGEN_HOME=%OXYGEN_HOME:"=%
echo Installing DITA-OT plugins in %OXYGEN_HOME%...
rem quietly remove existing plugin links/directories
for /d %%P in ("%OXYGEN_HOME%\frameworks\dita\DITA-OT3.x\plugins\com.synopsys.*") do (
rmdir /S /Q "%%P" 2> nul
rm "%%P" 2> nul
)
rem make new links for plugin directories
for /d %%P in ("dita_plugins\com.synopsys.*") do (
rem pass only final directory name of %P%
call :link_plugin "%OXYGEN_HOME%" "%%~nxP"
)
set JAVA_HOME=%OXYGEN_HOME%\jre
call "%OXYGEN_HOME%\frameworks\dita\DITA-OT3.x\bin\dita.bat" --install
echo.
exit /b
:link_plugin
set OXYGEN_HOME=%1
set PLUGIN_DIR=%2
set OXYGEN_HOME=%OXYGEN_HOME:"=%
set PLUGIN_DIR=%PLUGIN_DIR:"=%
set SOURCE=dita_plugins\%PLUGIN_DIR%
set DEST=%OXYGEN_HOME%\frameworks\dita\DITA-OT3.x\plugins\%PLUGIN_DIR%
mklink /J "%DEST%" "%SOURCE%"
exit /b
-
- Posts: 922
- Joined: Thu May 02, 2019 2:32 pm
Re: Providing DITA plugins in an Oxygen project directory?
Post by chrispitude »
Code: Select all
@rem chrispy - 5/9/2023
@echo off
net session >nul 2>&1
if %ERRORLEVEL% neq 0 (
echo Error: You must run this script by right-clicking and choosing "Run as administrator".
timeout 20
exit /b 1
)
rem loop through Oxygen installations
@echo off
pushd %~dp0
for /d %%f in ("%ProgramFiles%\Oxygen XML *", "%LOCALAPPDATA%\Oxygen XML *") do (
call :install_plugins "%%f"
)
popd
timeout 20
exit /b
:install_plugins
set OXYGEN_HOME=%1
set OXYGEN_HOME=%OXYGEN_HOME:"=%
if exist "%OXYGEN_HOME%\frameworks" (
if exist "%OXYGEN_HOME%\frameworks\dita\DITA-OT3.x\bin\dita.bat" (
echo Installing DITA-OT plugins in %OXYGEN_HOME%...
rem quietly remove existing plugin links/directories
for /d %%P in ("%OXYGEN_HOME%\frameworks\dita\DITA-OT3.x\plugins\com.synopsys.*") do (
rmdir /S /Q "%%P" 2> nul
rm "%%P" 2> nul
)
rem make new links for plugin directories
for /d %%P in ("dita_plugins\com.synopsys.*") do (
rem pass only final directory name of %P%
call :link_plugin "%OXYGEN_HOME%" "%%~nxP"
)
set JAVA_HOME=%OXYGEN_HOME%\jre
call "%OXYGEN_HOME%\frameworks\dita\DITA-OT3.x\bin\dita.bat" --install
echo.
) else (
rem check for an obsolete Oxygen installation directory
rem (only a "frameworks" directory containing DITA-OT plugin links, but nothing else)
dir /B "%OXYGEN_HOME%" | findstr /V /R "^frameworks$" > nul
if errorlevel 1 (
echo Deleting obsolete installation directory "%OXYGEN_HOME%"...
rmdir /S /Q "%OXYGEN_HOME%"
)
)
)
exit /b
:link_plugin
set OXYGEN_HOME=%1
set PLUGIN_DIR=%2
set OXYGEN_HOME=%OXYGEN_HOME:"=%
set PLUGIN_DIR=%PLUGIN_DIR:"=%
set SOURCE=dita_plugins\%PLUGIN_DIR%
set DEST=%OXYGEN_HOME%\frameworks\dita\DITA-OT3.x\plugins\%PLUGIN_DIR%
mklink /J "%DEST%" "%SOURCE%"
exit /b
-
- Posts: 922
- Joined: Thu May 02, 2019 2:32 pm
Re: Providing DITA plugins in an Oxygen project directory?
Post by chrispitude »
Code: Select all
@rem chrispy - 7/28/2023
@echo off
net session >nul 2>&1
if %ERRORLEVEL% neq 0 (
echo Error: You must run this script by right-clicking and choosing "Run as administrator".
timeout 20
exit /b 1
)
rem loop through Oxygen installations
@echo off
pushd %~dp0
for /d %%f in ("%ProgramFiles%\Oxygen XML *", "%LOCALAPPDATA%\Oxygen XML *") do (
call :install_plugins "%%f"
)
popd
timeout 20
exit /b
:install_plugins
set OXYGEN_HOME=%1
set OXYGEN_HOME=%OXYGEN_HOME:"=%
if exist "%OXYGEN_HOME%\frameworks" (
rem for Oxygen versions prior to v26.0, link the old location (DITA-OT3.x) to the new location (DITA-OT\)
if exist "%OXYGEN_HOME%\frameworks\dita\DITA-OT3.x\" (
if not exist "%OXYGEN_HOME%\frameworks\dita\DITA-OT\" (
mklink /J "%OXYGEN_HOME%\frameworks\dita\DITA-OT\" "%OXYGEN_HOME%\frameworks\dita\DITA-OT3.x\"
)
)
if exist "%OXYGEN_HOME%\frameworks\dita\DITA-OT\bin\dita.bat" (
echo Installing DITA-OT plugins in %OXYGEN_HOME%...
rem quietly remove existing plugin links/directories
for /d %%P in ("%OXYGEN_HOME%\frameworks\dita\DITA-OT\plugins\com.synopsys.*") do (
rmdir /S /Q "%%P" 2> nul
rm "%%P" 2> nul
)
rem make new links for plugin directories
for /d %%P in ("dita_plugins\com.synopsys.*") do (
rem pass only final directory name of %P%
call :link_plugin "%OXYGEN_HOME%" "%%~nxP"
)
set JAVA_HOME=%OXYGEN_HOME%\jre
call "%OXYGEN_HOME%\frameworks\dita\DITA-OT\bin\dita.bat" --install
echo.
) else (
rem check for an obsolete Oxygen installation directory
rem (only a "frameworks" directory containing DITA-OT plugin links, but nothing else)
dir /B "%OXYGEN_HOME%" | findstr /V /R "^frameworks$" > nul
if errorlevel 1 (
echo Deleting obsolete installation directory "%OXYGEN_HOME%"...
rmdir /S /Q "%OXYGEN_HOME%"
echo.
)
)
)
exit /b
:link_plugin
set OXYGEN_HOME=%1
set PLUGIN_DIR=%2
set OXYGEN_HOME=%OXYGEN_HOME:"=%
set PLUGIN_DIR=%PLUGIN_DIR:"=%
set SOURCE=dita_plugins\%PLUGIN_DIR%
set DEST=%OXYGEN_HOME%\frameworks\dita\DITA-OT\plugins\%PLUGIN_DIR%
mklink /J "%DEST%" "%SOURCE%"
exit /b
Return to “DITA (Editing and Publishing DITA Content)”
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service