%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page trimDirectiveWhitespaces="true" %>
<%@ page import="org.crosswire.community.projects.ntmss.data.Document" %>
<%@ page import="org.crosswire.community.projects.ntmss.data.Page" %>
<%@ page import="org.crosswire.community.projects.ntmss.data.Transcription" %>
<%@ page import="org.crosswire.community.projects.ntmss.data.Transcription.Convert" %>
<%@ page import="org.crosswire.community.projects.ntmss.data.Transcription.Convert.VerseTranscription" %>
<%@ page import="org.crosswire.xml.XMLBlock" %>
<%@ page import="org.crosswire.webtools.annotation.*" %>
<%@ page import="javax.validation.constraints.NotNull" %>
<%@ page import="org.crosswire.webtools.*" %>
<%!
@Description(value = "Clean TEI, removing unwanted break information and other cruft.", name = "transcript/clean")
public static class MyParameters extends Parameters {
@NotNull
@Description(value = "text of transcription", example = "")
public String text;
@Description(value = "only echo as mime-type xml", defaultValue="false", example = "true")
public Boolean echo = false;
@Description(value = "manuscript id to which this transcript belongs", example = "10046")
public Integer docID;
@Description(value = "manscript page id to which this transcript belongs", example = "10")
public Integer pageID;
@Override
protected void afterLoad() {
text = Transcription.assureUnicode(text);
}
}
%>
<%
MyParameters params = new MyParameters().loadFromRequest(request, response, false);
if (params.getErrors().size() == 0) {
try {
if (params.echo) {
response.setContentType("text/xml");
out.print(params.text);
try {
XMLBlock b = XMLBlock.createXMLBlock(params.text);
}
catch (Exception e) {
// out.print(e);
}
return;
}
Page p = null;
if (params.docID != null && params.pageID != null) p = Page.getPage(params.docID, params.pageID);
params.text = Transcription.renumberBreaks(params.text, p);
params.text = Transcription.fixTranscription(params.text, p);
Serializer.output(response, out, params, XMLBlock.createXMLBlock(params.text));
return;
} catch (Exception e) { e.printStackTrace(); return; }
}
else params.format = "html";
Serializer.reportErrors(request, response, out, params, true);
%>