diff options
| author | hallgren <hallgren@chalmers.se> | 2015-03-18 16:23:04 +0000 |
|---|---|---|
| committer | hallgren <hallgren@chalmers.se> | 2015-03-18 16:23:04 +0000 |
| commit | a120ed1e22c1fbeb7d8e2245e3b2355b051ce2f2 (patch) | |
| tree | c02096ee0f6a617f9fd0b3a24cd34f9b906f1eb4 /src | |
| parent | 1c1e6bf00583534d9cdf98883316e1aa8c20cd3d (diff) | |
Wide Coverage Translation Demo: draw syntax trees
The trees are drawn by using the Haskell run-time request
AppEng.pgf?command=abstrtree&tree=...
Thus AppEng.pgf has to be installed on the server and in sync with App14.pgf.
This is to avoid loading the huge App14.pgf in the Haskell run-time system, and
is enough since we only need the abstract syntax.
Diffstat (limited to 'src')
| -rw-r--r-- | src/www/js/wc.js | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/www/js/wc.js b/src/www/js/wc.js index 2a9f1624c..a858ada0a 100644 --- a/src/www/js/wc.js +++ b/src/www/js/wc.js @@ -110,7 +110,17 @@ wc.translate=function() { wc.selected=so var r=so.rs[so.current_pick] var prob=r.prob<=0 ? "" : r.prob || "" - if(e) e.innerHTML=prob+"<br>"+(r.tree||"") + if(e) { + e.innerHTML=prob+"<br>" + if(r.tree) { + var t=wrap("span",text(r.tree)) + var imgurl="/robust/AppEng.pgf?command=abstrtree&tree="+encodeURIComponent(r.tree)+"&format=svg" + e.appendChild(t) + if(!r.img) r.img=node("img",{src:imgurl},[]) + e.appendChild(empty("br")) + e.appendChild(r.img) + } + } if(wc.p /*&& so.rs.length>1*/) show_picks() //if(f.speak.checked) wc.speak(t.text,f.to.value) if(!so.got_more) { |
