Skip to content

Commit

Permalink
fix (translator): linefeed presentation for output
Browse files Browse the repository at this point in the history
  • Loading branch information
santanche committed Sep 7, 2020
1 parent 9908994 commit cc233d1
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 29 deletions.
17 changes: 1 addition & 16 deletions src/adonisjs/public/dccs/components/dcc-expression.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,9 @@ class DCCExpression extends DCCVisual {
}

const compiled = DCCExpression.compileStatementSet(this.expression)
console.log('=== compiled:')
console.log(compiled)
for (const c of compiled) { console.log('=== result: ' + DCCExpression.computeExpression(c[1])) }
// for (const c of compiled) { console.log('=== result: ' + DCCExpression.computeExpression(c[1])) }

let result = await MessageBus.ext.request('var/' + this._variable + '/get')
console.log('=== result field')
console.log(result.message)
if (result.message == null) { result = '' } else {
if (this._index == null) {
// <TODO> provisory unfold
Expand All @@ -60,19 +56,13 @@ class DCCExpression extends DCCVisual {
}

static compileStatementSet (statementSet) {
console.log('=== statement set')
console.log(statementSet)
const statementLines = statementSet.split(/;\r?\n?|\r?\n/)
console.log('=== statement lines')
console.log(statementLines)
const compiledSet = []
for (const l of statementLines) { compiledSet.push(DCCExpression.compileStatement(l)) }
return compiledSet
}

static compileStatement (statement) {
console.log('=== compile')
console.log(statement)
const compiled = []
const assign = statement.match(DCCExpression.assignment)
if (assign != null) {
Expand All @@ -92,8 +82,6 @@ class DCCExpression extends DCCVisual {
* (avoid transformations during its execution)
*/
static compileExpression (expression) {
console.log('=== expression')
console.log(expression)
const compiled = []
const stack = []
let mdfocus = expression
Expand All @@ -110,7 +98,6 @@ class DCCExpression extends DCCVisual {
}
if (matchStart > -1) {
const matchContent = mdfocus.match(DCCExpression.element[selected])[0]
console.log('=== ' + selected + ': ' + matchContent)

switch (selected) {
case 'number':
Expand Down Expand Up @@ -158,8 +145,6 @@ class DCCExpression extends DCCVisual {
compiled.push([(op[1] == DCCExpression.precedence.function)
? DCCExpression.role.function : DCCExpression.role.arithmetic, op[0]])
}
console.log('=== compiled')
console.log(compiled)
return compiled
}

Expand Down
6 changes: 0 additions & 6 deletions src/adonisjs/public/infra/dcc-common-server-proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,6 @@ class DCCCommonServer {
const response = await fetch(
DCCCommonServer.managerAddressAPI + "case/list", header);
*/
console.log('=== cases list request')
console.log(header)
// console.log(DCCCommonServer.managerAddressAPI);
/*
const response = await fetch(
Expand All @@ -122,8 +120,6 @@ class DCCCommonServer {
*/
const response = await fetch(
DCCCommonServer.managerAddressAPI + 'user/cases', header)
console.log('=== cases list response')
console.log(response)
const jsonResponse = await response.json()
const busResponse = []
for (const c in jsonResponse) {
Expand Down Expand Up @@ -154,7 +150,6 @@ class DCCCommonServer {
} else {
const caseId = MessageBus.extractLevel(topic, 3)
if (document.querySelector("#settings-modal") == null) {
console.log('=== collecting from REST')
let header = {
"async": true,
"crossDomain": true,
Expand All @@ -179,7 +174,6 @@ class DCCCommonServer {
keywords: jsonResponse.keywords,
source: jsonResponse.source};
} else {
console.log('=== collecting from modal')
caseObj = {
title: document.getElementById('case_title').value,
description: document.getElementById('description').value,
Expand Down
3 changes: 0 additions & 3 deletions src/adonisjs/public/player/js/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,6 @@ class PlayState {
}

if (id != null) {
console.log('=== variable get')
console.log(id)
console.log(this._state.variables[id])
MessageBus.ext.publish(MessageBus.buildResponseTopic(topic, message),
this._state.variables[id])
}
Expand Down
8 changes: 6 additions & 2 deletions src/adonisjs/public/templates/simple/case/quiz_short.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,17 @@ Write here the **stem** of your quiz.
# Note (note)

**You answered:** ^Previous.input1^.
<br>



^parameter^

# Presentation References (note)

**You answered:** ^Previous.input1^.
<br>



^parameter^

References <-> References
Expand Down
5 changes: 3 additions & 2 deletions src/adonisjs/public/translator/translator.js
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ class Translator {
compiled[c] = tblock
}
} else if (c > 0 &&
this._equivalentSubQuote(compiled[c], compiled[pr])) {
this._equivalentSubQuote(compiled[c], compiled[pr])) {
// adds element and previous linefeed (if exists)
for (let e = pr + 1; e <= c; e++) {
tblockSeq++
Expand Down Expand Up @@ -2231,7 +2231,8 @@ class Translator {
Translator.subordinatorElement = ['entity']
Translator.isLine = ['knot', 'field', 'item', 'option', 'divert-script', 'entity', 'input',
'compute', 'context-open']
Translator.textBlockCandidate = ['select', 'annotation', 'text', 'mention', 'image']
Translator.textBlockCandidate = ['select', 'annotation', 'text', 'mention', 'image',
'output']
Translator.scriptable = ['compute', 'divert-script']

Translator.fieldSet = ['vocabularies', 'answers', 'states', 'labels']
Expand Down

0 comments on commit cc233d1

Please sign in to comment.