Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/keenwrite.git

Remove 'bout from unambiguous contractions, set UTF8 charset upon XHTML export

AuthorDaveJarvis <email>
Date2021-08-01 18:53:47 GMT-0700
Commitd4f5b7e4affef2d88402288404d3e77b94968788
Parent22105fd
Delta15 lines added, 3 lines removed, 12-line increase
src/main/java/com/keenwrite/processors/XhtmlProcessor.java
import com.keenwrite.preferences.Workspace;
import com.keenwrite.ui.heuristics.WordCounter;
+import com.whitemagicsoftware.keenquotes.Contractions;
import com.whitemagicsoftware.keenquotes.Converter;
import javafx.beans.property.StringProperty;
import org.w3c.dom.Document;
import java.io.FileNotFoundException;
import java.nio.file.Path;
+import java.util.List;
import java.util.Locale;
import java.util.Map;
compile( "\\p{Blank}", UNICODE_CHARACTER_CLASS );
- private final static Converter sTypographer =
- new Converter( lex -> clue( lex.toString() ), CHARS, PARSER_XML );
+ private final static Converter sTypographer = new Converter(
+ lex -> clue( lex.toString() ), contractions(), CHARS, PARSER_XML );
private final ProcessorContext mContext;
}
- private Locale locale() { return getWorkspace().getLocale(); }
+ private Locale locale() {return getWorkspace().getLocale();}
private String title() {
private StringProperty stringProperty( final Key key ) {
return getWorkspace().stringProperty( key );
+ }
+
+ /**
+ * Creates contracts with a custom set of unambiguous strings.
+ *
+ * @return List of contractions to use for curling straight quotes.
+ */
+ private static Contractions contractions() {
+ final var builder = new Contractions.Builder();
+ return builder.withBeganUnambiguous( List.of( "bout" ) ).build();
}
}