String s = scriptlet.getScriptletPart().getText(); //.trim();
if (s.equals("")) { return; }
int start = scriptlet.getScriptletPart().getInputRange().getStart();
CharArrayWriter w = (CharArrayWriter) gc.getOut();
SimpleTranslationMapping tm = (SimpleTranslationMapping) tc.getTranslationMapping();
LinedString l = new LinedString(s);
int firstLine = 0;
int lastLine = l.getLineCount() - 1;
if (l.getLine(firstLine).trim().equals("")) {
firstLine++;
}
if (l.getLine(lastLine).trim().equals("")) {
lastLine--;
}
if (firstLine > lastLine) {
return;
}
String[] lines = l.getLinesArray(firstLine, lastLine);
int ws = TranslationTools.getCommonLeadingWhitespace(lines).length();
for (int i=firstLine; i<=lastLine; i++) {
GenerationTools.print(gc, ""); // for indention
String line = l.getLine(i).substring(ws);
int templatePos = start + l.getPosition(i) + ws;
int generatorPos = w.size();
tm.addCheckpoint(templatePos, generatorPos, true);
GenerationTools.println(gc, line);
}
}