nl.dedicon.pipeline.braille.calabash.impl.ModifyPreviewStep Maven / Gradle / Ivy
package nl.dedicon.pipeline.braille.calabash.impl;
import com.xmlcalabash.core.XProcException;
import com.xmlcalabash.core.XProcRuntime;
import com.xmlcalabash.core.XProcStep;
import com.xmlcalabash.library.DefaultStep;
import com.xmlcalabash.runtime.XAtomicStep;
import java.io.File;
import java.net.URI;
import java.nio.file.Files;
import java.nio.file.Path;
import net.sf.saxon.s9api.Processor;
import net.sf.saxon.s9api.QName;
import net.sf.saxon.s9api.SaxonApiException;
import nl.dedicon.pipeline.braille.step.BrailleToText;
import nl.dedicon.pipeline.braille.step.Utils;
import org.daisy.common.xproc.calabash.XProcStepProvider;
import org.osgi.service.component.annotations.Component;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
/**
* XProc step for modifying the preview HTML
*
* The pipeline can generate a preview for the generated PEF,
* which is an HTML with a braille view and a text view.
* This step modifies the text view, such that digits,
* capitals and certain symbols are displayed correctly
* according to specifications of Dedicon.
*
* If the structure of the generated HTML preview changes,
* this step may have to be revised.
*
* This step is structured as follows:
*
* * The preview HTML is read as a string
* * The header (everything before "