Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/keenwrite.git
M src/main/java/com/keenwrite/dom/DocumentParser.java
6767
      sTransformer.setOutputProperty( OMIT_XML_DECLARATION, "yes" );
6868
      sTransformer.setOutputProperty( METHOD, "xml" );
69
      sTransformer.setOutputProperty( INDENT, "yes" );
69
      sTransformer.setOutputProperty( INDENT, "no" );
7070
      sTransformer.setOutputProperty( INDENT_AMOUNT, "2" );
7171
    } catch( final Exception ex ) {
...
182182
183183
    try( final var writer = new StringWriter() ) {
184
      final var domSource = new DOMSource( xhtml );
185184
      final var result = new StreamResult( writer );
186185
187
      sTransformer.transform( domSource, result );
186
      transform( xhtml, result );
188187
189188
      return writer.toString();
...
199198
200199
    try( final var writer = new StringWriter() ) {
201
      sTransformer.transform(
202
        new DOMSource( root ), new StreamResult( writer )
203
      );
200
      transform( root.getOwnerDocument(), new StreamResult( writer ) );
204201
205202
      return writer.toString();
...
219216
    final var file = path.toFile();
220217
221
    sTransformer.transform(
222
      new DOMSource( sDocumentBuilder.parse( file ) ), new StreamResult( file )
223
    );
218
    transform( sDocumentBuilder.parse( file ), new StreamResult( file ) );
224219
  }
225220
...
244239
      }
245240
    } );
241
  }
242
243
  /**
244
   * Streams an instance of {@link Document} as a plain text XML document.
245
   *
246
   * @param src The source document to transform.
247
   * @param dst The destination location to write the transformed version.
248
   * @throws TransformerException Could not transform the document.
249
   */
250
  private static void transform( final Document src, final StreamResult dst )
251
    throws TransformerException {
252
    sTransformer.transform( new DOMSource( src ), dst );
246253
  }
247254
M src/main/java/com/keenwrite/editors/markdown/MarkdownEditor.java
5252
import static org.apache.commons.lang3.StringUtils.stripEnd;
5353
import static org.apache.commons.lang3.StringUtils.stripStart;
54
import static org.fxmisc.richtext.Caret.CaretVisibility.*;
5455
import static org.fxmisc.richtext.model.StyleSpans.singleton;
5556
import static org.fxmisc.wellbehaved.event.EventPattern.keyPressed;
...
132133
133134
  private void initTextArea( final StyleClassedTextArea textArea ) {
135
    textArea.setShowCaret( ON );
134136
    textArea.setWrapText( true );
135137
    textArea.requestFollowCaret();
D src/main/java/com/keenwrite/io/SilentPrintStream.java
1
package com.keenwrite.io;
2
3
import java.io.OutputStream;
4
import java.io.PrintStream;
5
6
/**
7
 * Responsible for silently discarding all data written to the stream.
8
 */
9
public final class SilentPrintStream extends PrintStream {
10
11
  private final static class SilentOutputStream extends OutputStream {
12
    public void write( final int b ) {}
13
  }
14
15
  public SilentPrintStream() {
16
    super( new SilentOutputStream() );
17
  }
18
}
191