h5p / h5p-drag-text

MIT License
7 stars 71 forks source link

Don't use html in xAPI language fields #10

Open garemoko opened 7 years ago

garemoko commented 7 years ago

The description.en-US field concatenates the Task Description and Text Field with a <br/> tag to separate them. HTML is not allowed in these fields however and will lead to formatting problems when the data is displayed in reports not specifically designed for H5P. Instead, I recommend separating these fields by a space or possibly even some text e.g.

<task description> Text Field: <text field>

thomasmars commented 7 years ago

Thanks. HTML is prohibited in all language fields ? What is the standard way of representing newlines ? I have created an issue for fixing this at: https://h5ptechnology.atlassian.net/browse/HFP-428

garemoko commented 7 years ago

Yes. Strictly speaking it's not probihited but the field is plain text so any html should be assumed to be part of the text, e.g. in an exam question about html: what does the <br/> tag mean?

See https://github.com/adlnet/xAPI-Spec/blob/master/xAPI-Data.md#42-language-maps

I don't think there's any good way to include new lines in those fields.

thomasmars commented 7 years ago

I see, thanks for the clarification. Is it okay to include html codes in custom fields, e.g. extensions or for instance a "long-fill-in" ?

garemoko commented 7 years ago

You can include html in extensions yes, but if you do that i recommend also including the plain text version in the normal field.

Can you give an example of what you mean for the long-fill-in?

thomasmars commented 7 years ago

Yes, i see.

An example of a long-fill-in would be several sentences that you would want to separate with line-breaks or other styling. A bad example:

Oslo is the capital of ______

The cow says _______

You don't want these to appear on the same line in a report.

garemoko commented 7 years ago

Is this for the object.definition.name.en field? I don't have a good solution for including line breaks in that field. Sorry!

thomasmars commented 7 years ago

I'm sorry. This is in the object.definition.description.en-US field as well, that was a bad example.I could not find any good examples where html was needed as part of a field other than language field. I suppose that is where it is most needed, at least in our use cases.

Do you have any suggestions for how to model an xAPI statement like H5P.DragText that has the 'matching' interaction type in between words. Or a 'long-fill-in' like H5P.Blanks that has multiple 'fill-in' mixed into the sentence. I could not find any examples of this use-case. Does it make sense to have the text with placeholders in object.definition.description and then a separate extension for the formatting ? Or should the object.definition.description be as small as possible, without the actual task text, e.g. just 'drag the words to the correct dropzones' and a separate extension for the actual task with the formatting ?

Anyway I suppose any additional (formatted) info needed for generating reports, and for providing metadata should be included as an extension ?

garemoko commented 7 years ago

My assumption is that you are just asking for examples of the description field rather than the complete statement. Is that right?

In that case, then i think that the approach H5P currently uses of inserting __ for blanks makes sense. e.g.

"definition": {
    "name": {
        "en-US": "Match the words to the blanks."
    },
    "description": {
        "en-US": "The sky is ______. The grass is ______."
    },
    "type": "http://adlnet.gov/expapi/activities/cmi.interaction",
    "interactionType": "matching",
    "correctResponsesPattern": [
        "green[.]1[,]blue[.]2"
    ],
    "source": [
        {
            "id": "blue",
            "description": {
                "en-US": "blue"
            }
        },
        {
            "id": "green",
            "description": {
                "en-US": "green"
            }
        }
    ],
    "target": [
        {
            "id": "1",
            "description": {
                "en-US": "Blank 1"
            }
        },
        {
            "id": "2",
            "description": {
                "en-US": "Blank 2"
            }
        }
    ],
    "extensions": {
        "https://h5p.org/xapi/extensions/activity-definition/html-description": "{
            "en-US": "The sky is ______.<br/>The grass is ______."
        }
    }
}
thomasmars commented 7 years ago

Yes, that's exactly what I was looking for. Thanks a lot.