Skip to content

Commit

Permalink
fix minor bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
liuchaoss committed Sep 27, 2022
1 parent ba8bb3a commit 024b025
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,4 +235,4 @@ def search(self):
if __name__ == '__main__':
se = SearchEngine()
se.create_index()
se.fill_data('unzipdata')
se.fill_data('unzipdata/')
22 changes: 10 additions & 12 deletions templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,6 @@ <h1 class="jumbotron-heading">Code Search</h1>
</section>


<!-- <div id="resultSection" class="py-5 bg-light" style="position: absolute; width: 70%; left: 15%;">
<div class="container">
</div>
<div class="final" id="final">
</div>
</div>-->
<div id="resultSection" class="py-5 bg-light"
style="position: absolute; width: 70%; left: 15%;">
<div class="container">
Expand All @@ -89,7 +82,6 @@ <h1 class="jumbotron-heading">Code Search</h1>
</div>

</main>
<!-- <script src="static/js/highlight.pack.js"></script>-->
<script src="static/lib/jquery-3.3.1.min.js"></script>
<script src="static/js/prism.js"></script>

Expand Down Expand Up @@ -126,6 +118,16 @@ <h1 class="jumbotron-heading">Code Search</h1>
// 对每一个java源代码,执行函数中的操作,foo是res中的一个java源代码
res.forEach(function (foo) {
foo = $.trim(foo);
foo= foo.replace(/[<">']/g, (a) => {
return {
"&": "&amp",
"<": "&lt",
">": "&gt",
'"': '&quot',
"'": '&#39',
"/": '&#x2F'
}[a]
});
var i = 0;
var t = 0;
var ans = "";
Expand All @@ -151,12 +153,8 @@ <h1 class="jumbotron-heading">Code Search</h1>
line += " ".repeat(t) + ans + "\n";
ans = "";
}


}
// $("#final").append("<pre style='background-color: antiquewhite;'> result " + j + "\n" + "<code class= 'java' >" + line +"</></>");
$("#final").append("<pre class='line-numbers'><code class='language-java'>"+line+"</code></pre>");

});
//此时已经加载完毕,手动高亮所有代码块
Prism.highlightAll();
Expand Down

0 comments on commit 024b025

Please sign in to comment.