1 package org.simantics.scl.compiler.internal.parsing.documentation;
3 public class Preformatted extends DocumentationElement {
7 public Preformatted(String content) {
8 lines = content.split("\n");
9 int indentation = Integer.MAX_VALUE;
10 for(int i=0;i<lines.length;++i) {
11 String line = lines[i];
12 for(int j=line.length();j>0;--j) {
13 char c = line.charAt(j-1);
14 if(c != '\n' && c != '\r' && c != ' ') {
15 line = line.substring(0, j);
21 for(String line : lines) {
22 for(int i=1;i<line.length()&&i<indentation;++i)
23 if(line.charAt(i) != ' ') {
28 for(int i=0;i<lines.length;++i) {
29 String line = lines[i];
30 lines[i] = indentation > line.length() ? "" : line.substring(indentation);
35 public void toHtml(HtmlUnparsingContext context) {
37 StringBuilder b = context.getStringBuilder();
39 for(String line : lines)
40 b.append(line).append('\n');