Skip to content

Commit

Permalink
upgrade pegjs to 0.10.0, jasmine to 2.8.0, use umd
Browse files Browse the repository at this point in the history
  • Loading branch information
thoward committed Sep 26, 2017
1 parent d1c58fb commit e088085
Show file tree
Hide file tree
Showing 8 changed files with 688 additions and 571 deletions.
26 changes: 11 additions & 15 deletions examples/browser/index.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<!DOCTYPE html>
<html>
<head>
<!-- Load RequireJS -->
<script type="text/javascript" src="../../vendor/require.js"></script>
<!-- Load lucenequeryparser -->
<script type="text/javascript" src="../../lib/lucene-query-parser.js"></script>
</head>
<body>
<h3>Query Text</h3>
Expand All @@ -23,22 +23,18 @@ <h3>Parser Output</h3>

<script type="text/javascript">
function parse_query() {
// get query text
var query_text = document.getElementById('query_text').value;

require(['../../lib/lucene-query-parser.js'], function(parser) {
// parse query
var results = lucenequeryparser.parse(query_text);

// get query text
var query_text = document.getElementById('query_text').value;
// convert to pretty-printed JSON
results = JSON.stringify(results, undefined, 2);
results = results.replace(/\n/g, "<br>").replace(/[ ]/g, "&nbsp;");

// parse query
var results = parser.parse(query_text);

// convert to pretty-printed JSON
results = JSON.stringify(results, undefined, 2);
results = results.replace(/\n/g, "<br>").replace(/[ ]/g, "&nbsp;");

// display results
document.getElementById('parser_output').innerHTML = results
});
// display results
document.getElementById('parser_output').innerHTML = results
}

parse_query();
Expand Down
47 changes: 47 additions & 0 deletions examples/browser/require-example.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<!DOCTYPE html>
<html>
<head>
<!-- Load RequireJS -->
<script type="text/javascript" src="../../vendor/require.js"></script>
</head>
<body>
<h3>Query Text</h3>
<textarea
id="query_text"
placeholder="Enter query text here..."
rows="4"
cols="120"
onkeyup="parse_query()"
>title:"The Right Way" AND text:go</textarea>

<h3>Parser Output</h3>
<hr />
<p>
<code id="parser_output">
</code>
</p>

<script type="text/javascript">
function parse_query() {

require(['../../lib/lucene-query-parser.js'], function(lucenequeryparser) {

// get query text
var query_text = document.getElementById('query_text').value;

// parse query
var results = lucenequeryparser.parse(query_text);

// convert to pretty-printed JSON
results = JSON.stringify(results, undefined, 2);
results = results.replace(/\n/g, "<br>").replace(/[ ]/g, "&nbsp;");

// display results
document.getElementById('parser_output').innerHTML = results
});
}

parse_query();
</script>
</body>
</html>
Loading

0 comments on commit e088085

Please sign in to comment.