Dave Jarvis' Repositories

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

Added hyperlink model for inserting hyperlinks and selecting hyperlinks in text. Replaced commonmark with flexmark to get markdown AST nodes with relative offsets.

Authordjarvis <email>
Date2016-12-03 21:51:03 GMT-0800
Commitfd95319f7a335a3782c75c1c43ab2a294593df42
Parent9d5f352
Delta110 lines added, 12 lines removed, 98-line increase
src/main/resources/com/scrivenvar/messages.properties
Dialog.file.choose.filter.title.markdown=Markdown Files
Dialog.file.choose.filter.title.definition=Definition Files
+Dialog.file.choose.filter.title.xml=XML Files
Dialog.file.choose.filter.title.all=All Files
src/main/resources/com/scrivenvar/settings.properties
Dialog.file.choose.filter.ext.markdown=*.Rmd,*.md,*.markdown,*.mkdown,*.mdown,*.mkdn,*.mkd,*.mdwn,*.mdtxt,*.mdtext,*.text,*.txt
Dialog.file.choose.filter.ext.definition=*.yml,*.yaml,*.properties,*.props
-Dialog.file.choose.filter.ext.xml=*.xml
+Dialog.file.choose.filter.ext.xml=*.xml,*.Rxml
Dialog.file.choose.filter.ext.all=*.*
# Maximum number of characters for a variable name. A variable is defined
# as one or more non-whitespace characters up to this maximum length.
-editor.variable.maxLength=512
-
+editor.variable.maxLength=256
# ########################################################################
src/main/java/com/scrivenvar/predicates/strings/StartsPredicate.java
+/*
+ * Copyright 2016 White Magic Software, Ltd.
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * o Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * o Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package com.scrivenvar.predicates.strings;
+
+/**
+ * Determines if a string starts with another.
+ *
+ * @author White Magic Software, Ltd.
+ */
+public class StartsPredicate extends StringPredicate {
+
+ /**
+ * Calls the superclass to construct the instance.
+ *
+ * @param comparate Not null.
+ */
+ public StartsPredicate( final String comparate ) {
+ super( comparate );
+ }
+
+ /**
+ * Compares two strings.
+ *
+ * @param comparator A non-null string, possibly empty.
+ *
+ * @return true The strings are equal, ignoring case.
+ */
+ @Override
+ public boolean test( final String comparator ) {
+ final String comparate = getComparate().toLowerCase();
+ return comparator.startsWith( comparate.toLowerCase() );
+ }
+}
src/main/java/com/scrivenvar/predicates/strings/StringPredicate.java
+/*
+ * Copyright 2016 White Magic Software, Ltd.
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * o Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * o Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package com.scrivenvar.predicates.strings;
+
+import java.util.function.Predicate;
+
+/**
+ * General predicate for different types of string comparisons.
+ *
+ * @author White Magic Software, Ltd.
+ */
+public abstract class StringPredicate implements Predicate<String> {
+
+ private final String comparate;
+
+ public StringPredicate( final String comparate ) {
+ this.comparate = comparate;
+ }
+
+ protected String getComparate() {
+ return this.comparate;
+ }
+}
src/main/java/com/scrivenvar/editor/VariableNameInjector.java
import com.scrivenvar.FileEditorPane;
import com.scrivenvar.Services;
-import com.scrivenvar.decorators.YamlVariableDecorator;
import com.scrivenvar.decorators.VariableDecorator;
+import com.scrivenvar.decorators.YamlVariableDecorator;
import com.scrivenvar.definition.DefinitionPane;
import static com.scrivenvar.definition.Lists.getFirst;
import static org.fxmisc.wellbehaved.event.InputMap.consume;
import static org.fxmisc.wellbehaved.event.InputMap.sequence;
-import static com.scrivenvar.definition.Lists.getFirst;
-import static com.scrivenvar.definition.Lists.getLast;
-import static java.lang.Character.isSpaceChar;
-import static java.lang.Character.isWhitespace;
-import static java.lang.Math.min;
-import static org.fxmisc.wellbehaved.event.EventPattern.keyPressed;
-import static org.fxmisc.wellbehaved.event.EventPattern.keyTyped;
-import static org.fxmisc.wellbehaved.event.InputMap.consume;
/**