Skip to content

Commit

Permalink
write.CorefHtml shows sent_id
Browse files Browse the repository at this point in the history
  • Loading branch information
martinpopel committed Feb 4, 2024
1 parent bb9e553 commit adc7255
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion udapi/block/write/corefhtml.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
.active {border: 1px solid red !important;}
.selected {background: red !important; text-shadow: 1px 1px 4px white, -1px 1px 4px white, 1px -1px 4px white, -1px -1px 4px white;}
.other {background: hsl(0, 0%, 85%);}
.sent_id {display: none; background: #ddd; border-radius: 3px;}
'''

SCRIPT_BASE = '''
Expand Down Expand Up @@ -133,7 +134,7 @@
add_show_tree_button = function(index, el){
var sent_id = el.id;
$(el).prepend(
$("<button>", {append: "🌲", id:"button-"+sent_id, title: "show dependency tree", class: "showtree"}).on("click", async function() {
$("<button>", {append: "🌲", id:"button-"+sent_id, title: "show dependency tree "+sent_id.substring(1), class: "showtree"}).on("click", async function() {
var tree_div = $("#tree-"+sent_id);
if (tree_div.length == 0){
$('#button-'+sent_id).attr('title', 'hide dependency tree');
Expand Down Expand Up @@ -247,6 +248,7 @@ def process_document(self, doc):
print('<div id="main-menu">Show<br><div>\n'
f' <input id="show-eid" type="checkbox" {"checked" if self.show_eid else ""} onclick="$(\'.eid\').toggle();"><label for="show-eid">eid</label><br>\n'
f' <input id="show-etype" type="checkbox" {"checked" if self.show_etype else ""} onclick="$(\'.etype\').toggle();"><label for="show-etype">etype</label><br>\n'
' <input id="show-sent_id" type="checkbox" onclick="$(\'.sent_id\').toggle();"><label for="show-sent_id">sent_id</label><br>\n'
' <input id="show-trees" type="checkbox" checked onclick="$(\'.showtree\').toggle();"><label for="show-trees">trees</label><br>\n'
' <input id="show-color" type="checkbox" checked onclick="$(\'.m\').toggleClass(\'nocolor\');"><label for="show-color">colors</label><br>\n'
' <input id="show-boxes" type="checkbox" checked onclick="$(\'.m\').toggleClass(\'nobox\');"><label for="show-boxes">boxes</label></div><div>\n'
Expand Down Expand Up @@ -330,6 +332,7 @@ def process_tree(self, tree):
print('<hr class="par">')
opened = []
print(f'<p class="sentence" id={_id(tree)}>')
print(f'<span class="sent_id">🆔{tree.sent_id}</span>')
for node in nodes_and_empty:
while subspans and subspans[-1].words[0] == node:
subspan = subspans.pop()
Expand Down

0 comments on commit adc7255

Please sign in to comment.