Skip to content

Commit

Permalink
reenabled Markdown for quiz descriptions, since HTML does work for de…
Browse files Browse the repository at this point in the history
…scriptions
  • Loading branch information
gpoore committed Apr 23, 2020
1 parent c20c603 commit 1eb93fa
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 17 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
questions automatically. This feature requires the command-line flag
`--run-code-blocks` or setting `run_code_blocks = true` in the config
file.
* Quiz titles and descriptions are now processed as plain text, rather than as
Markdown, because QTI does not support HTML titles and descriptions.
* Quiz titles are now processed as plain text, rather than as Markdown,
because QTI does not support HTML titles.
* Fixed a bug that prevented source file names from appearing in error
messages.

Expand Down
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ be ordered or unique. The **correct** choice is designated with an asterisk
[Markdown](https://daringfireball.net/projects/markdown/).

There is also support for a quiz title, a quiz description, and feedback.
Note that unlike all other text, the title and description are treated as
plain text, not Markdown, due to the QTI format.
Note that unlike all other text, the title is treated as plain text, not
Markdown, due to the QTI format.

```
Quiz title: Addition
Expand Down Expand Up @@ -192,7 +192,8 @@ Quiz title: Title here
```
Otherwise, all quizzes will have the default title "Quiz", so it will be
difficult to tell them apart. Another option is to rename quizzes after
importing them.
importing them. Note that unlike all other text, the title is treated as
plain text, not Markdown, due to the QTI format.
When you run `text2qti` for the first time, it will attempt to create a
configuration file called `.text2qti.bespon` in your home or user directory.
Expand Down Expand Up @@ -304,11 +305,11 @@ versus `Answer`).
text2qti processes almost all text as
[Markdown](https://daringfireball.net/projects/markdown/), using
[Python-Markdown](https://python-markdown.github.io/). (The only exception is
the quiz title and quiz description, which are processed as plain text due to
the QTI format.) For example, `*emphasized*` produces emphasized text, which
typically appears as italics. Text can be styled using Markdown notation, or
with HTML. Remember to preview quizzes after conversion to QTI, especially
when using any significant amount of HTML.
the quiz title, which is processed as plain text due to the QTI format.) For
example, `*emphasized*` produces emphasized text, which typically appears as
italics. Text can be styled using Markdown notation, or with HTML. Remember
to preview quizzes after conversion to QTI, especially when using any
significant amount of HTML.
All titles, descriptions, questions, choices, and feedback are limited to a
single paragraph each. If this paragraph is wrapped over multiple lines, all
Expand Down
4 changes: 2 additions & 2 deletions text2qti/qti.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def __init__(self, quiz: Quiz, *, config: Config):
self.title_raw = quiz.title_raw
self.title_xml = quiz.title_xml
self.description_raw = quiz.description_raw
self.description_xml = quiz.description_xml
self.description_html_xml = quiz.description_html_xml
self.points_possible = quiz.points_possible

self.imsmanifest_xml = imsmanifest(manifest_identifier=self.manifest_identifier,
Expand All @@ -43,7 +43,7 @@ def __init__(self, quiz: Quiz, *, config: Config):
assignment_identifier=self.assessment_identifier,
assignment_group_identifier=self.assignment_group_identifier,
title_xml=self.title_xml,
description_xml=self.description_xml,
description_html_xml=self.description_html_xml,
points_possible=self.points_possible)
self.assessment = assessment(quiz=quiz,
assessment_identifier=self.assignment_identifier,
Expand Down
4 changes: 2 additions & 2 deletions text2qti/quiz.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ def __init__(self, string: str, *, config: Config,
self.title_raw = None
self.title_xml = 'Quiz'
self.description_raw = None
self.description_xml = ''
self.description_html_xml = ''
self.questions_and_delims: List[Union[Question, GroupStart, GroupEnd]] = []
self._current_group: Optional[Group] = None
# The set for detecting duplicate questions uses the XML version of
Expand Down Expand Up @@ -521,7 +521,7 @@ def append_quiz_description(self, text: str):
if self.questions_and_delims:
raise Text2qtiError('Must give quiz description before questions')
self.description_raw = text
self.description_xml = self.md.xml_escape(text)
self.description_html_xml = self.md.md_to_xml(text)

def append_question(self, text: str):
if self.questions_and_delims:
Expand Down
2 changes: 1 addition & 1 deletion text2qti/version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-

from .fmtversion import get_version_plus_info
__version__, __version_info__ = get_version_plus_info(0, 2, 0, 'dev', 5)
__version__, __version_info__ = get_version_plus_info(0, 2, 0, 'dev', 6)
4 changes: 2 additions & 2 deletions text2qti/xml_assessment_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def assessment_meta(*,
assignment_group_identifier: str,
assignment_identifier: str,
title_xml: str,
description_xml: str,
description_html_xml: str,
points_possible: int) -> str:
'''
Generate `assessment_meta.xml`.
Expand All @@ -94,5 +94,5 @@ def assessment_meta(*,
assignment_identifier=assignment_identifier,
assignment_group_identifier=assignment_group_identifier,
title=title_xml,
description=description_xml,
description=description_html_xml,
points_possible=points_possible)

0 comments on commit 1eb93fa

Please sign in to comment.