Skip to content

Commit adc7255

Browse files
committed
write.CorefHtml shows sent_id
1 parent bb9e553 commit adc7255

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

udapi/block/write/corefhtml.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
.active {border: 1px solid red !important;}
6262
.selected {background: red !important; text-shadow: 1px 1px 4px white, -1px 1px 4px white, 1px -1px 4px white, -1px -1px 4px white;}
6363
.other {background: hsl(0, 0%, 85%);}
64+
.sent_id {display: none; background: #ddd; border-radius: 3px;}
6465
'''
6566

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

0 commit comments

Comments
 (0)