Skip to content

Commit

Permalink
Merge branch 'internship-2016' into integration_autocomplete
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitry Barashev committed Sep 26, 2016
2 parents 3964bdf + fa8a8b3 commit 411090c
Show file tree
Hide file tree
Showing 6 changed files with 230 additions and 317 deletions.
18 changes: 14 additions & 4 deletions demo/summer-2016.html
Expand Up @@ -184,6 +184,8 @@

\[\alpha\]

$x^2$

$\beta$

$$\gamma$$
Expand Down Expand Up @@ -246,6 +248,7 @@

<script>
// var editor;
// TODO: delete TODOs
require.config({ paths : { "ace" : "../lib/ace" } });
require([
"ace/ace",
Expand All @@ -254,10 +257,17 @@
"ace/ext/papeeria/highlighter",
"ace/ext/papeeria/tex_completer",
"ace/ext/papeeria/spellchecker_popup"
, "ace/tokenizer" // TODO: delete
, "ace/ext/papeeria/papeeria_latex_highlight_rules" // TODO: delete
],
function(ace, langTools, katexPreviewer, highlighter, TexCompleter, spellCheckerPopup) {
var editor = ace.edit("editor");
var session = editor.getSession();
function(ace, langTools, katexPreviewer, highlighter, TexCompleter, spellCheckerPopup
, TokenizerModule, PLHR // TODO: delete
) {
/* var */ editor = ace.edit("editor"); // TODO: uncomment
/* var */ session = editor.getSession(); // TODO: uncomment
Tokenizer = TokenizerModule.Tokenizer; // TODO: delete
rules = (new PLHR.PapeeriaLatexHighlightRules()).getRules();
tokenizer = new Tokenizer((new PLHR.PapeeriaLatexHighlightRules()).getRules()); // TODO: delete
session.setMode("ace/mode/papeeria_latex");
session.setUseWorker(true);

Expand Down Expand Up @@ -309,8 +319,8 @@
$("#highlightInfo").popover("destroy");
};

TexCompleter.init(editor)
var texCompleter = new TexCompleter();
texCompleter.init(editor);
langTools.addCompleter(texCompleter);
texCompleter.setReferencesUrl("/demo/example.json")
texCompleter.setCitationsUrl("/demo/biblio.json")
Expand Down
8 changes: 4 additions & 4 deletions lib/ace/autocomplete/text_completer.js
Expand Up @@ -3,7 +3,7 @@
*
* Copyright (c) 2012, Ajax.org B.V.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
Expand All @@ -14,7 +14,7 @@
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
*
* 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
Expand All @@ -30,7 +30,7 @@

define(function(require, exports, module) {
var Range = require("../range").Range;

var splitRegex = /[^a-zA-Z_0-9\$\-\u00C0-\u1FFF\u2C00-\uD7FF\w]+/;

function getWordIndex(doc, pos) {
Expand All @@ -46,7 +46,7 @@ define(function(require, exports, module) {
var prefixPos = getWordIndex(doc, pos);
var words = doc.getValue().split(splitRegex);
var wordScores = Object.create(null);

var currentWord = words[prefixPos];

words.forEach(function(word, idx) {
Expand Down
3 changes: 1 addition & 2 deletions lib/ace/ext/papeeria/latex_parsing_context.coffee
Expand Up @@ -16,7 +16,6 @@ define((require, exports, module) ->
FIGURE_TOKENTYPE = PapeeriaLatexHighlightRules.FIGURE_TOKENTYPE
TABLE_TOKENTYPE = PapeeriaLatexHighlightRules.TABLE_TOKENTYPE

#order if importance
TOKEN_TYPES = [EQUATION_TOKENTYPE, LIST_TOKENTYPE, FIGURE_TOKENTYPE, ENVIRONMENT_TOKENTYPE, TABLE_TOKENTYPE]
STATES = [EQUATION_STATE, LIST_STATE, FIGURE_STATE, ENVIRONMENT_STATE, TABLE_STATE]

Expand Down Expand Up @@ -49,4 +48,4 @@ define((require, exports, module) ->
exports.getContext = getContext
exports.isType = isType
return
)
)

0 comments on commit 411090c

Please sign in to comment.