Skip to content

Commit

Permalink
improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Mte90 committed May 17, 2016
1 parent cea5914 commit ed53ddd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Fix: Support multiple definitions for the same term
* Enhancement: Alert with hotkeys when the string is not visible
* Enhancement: New glossaries: ast
* Feature: Shortcut on Ctrl+Shift+F to replace space near symbols by casiopa
* Feature: Shortcut on Ctrl+Shift+F to replace space near symbols by ePascalC

#1.0.7
* Glossaries generated with GLotDictJSON now contain also the `pos` value
Expand Down
9 changes: 5 additions & 4 deletions glotdict.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ jQuery(document).ready(function () {
if (item !== '') {
var rgxp = new RegExp('\\b(' + word + ')\\b(?![^<>()\"]*>|[^<]*<\/span>)', 'gi');
var print = JSON.stringify(item);
if( !item.length ){
if (!item.length) {
print = '[' + print + ']';
}
}
var repl = '<span class="glossary-word-glotdict" data-translations=\'' + print + '\'>$1</span>';
jQuery(element).html(jQuery(element).html().replace(rgxp, repl));
}
Expand Down Expand Up @@ -154,9 +154,8 @@ jQuery(document).ready(function () {
});
jQuery.multipress([17, 16, 70], function () {
jQuery('textarea.foreign-text').filter(':visible:first').val(function (index, text) {
var s;
// Replace space-colon or nbsp-colon with just colon, then replace colons with nbsp-colon
s = text.replace(/( :|&nbsp;:)/g, ':').replace(/:/g, '&nbsp;:');
var s = text.replace(/( :|&nbsp;:)/g, ':').replace(/:/g, '&nbsp;:');
// Replace space-question or nbsp-question with just question, then replace question with nbsp-question
s = s.replace(/( \?|&nbsp;\?)/g, '?').replace(/\?/g, '&nbsp;?');
// Replace space-exclamation or nbsp-exclamation with just exclamation, then replace exclamation with nbsp-exclamation
Expand All @@ -167,6 +166,8 @@ jQuery(document).ready(function () {
s = s.replace(/( \. | \.)/g, '. ').replace(/( , | ,)/g, ', ');
// Replace space-closebracket-space or space-closebracket with just closebracket-space, same for squarebracket
s = s.replace(/( \) | \))/g, ') ').replace(/( ] | ])/g, '] ');
// Replace space-openbracket-space or openbracket-space with just space-openbracket, same for squarebracket
s = s.replace(/( \( |\( )/g, ' (').replace(/( \[ |\[ )/g, ' [');
return s;
});
});
Expand Down

0 comments on commit ed53ddd

Please sign in to comment.