Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comments in source file #2

Closed
andreasmhallberg opened this issue May 5, 2020 · 7 comments
Closed

Comments in source file #2

andreasmhallberg opened this issue May 5, 2020 · 7 comments
Labels
enhancement New feature or request

Comments

@andreasmhallberg
Copy link

andreasmhallberg commented May 5, 2020

Is it possible to add comments to the source file that are not rendered in the QTI output? If so, what is the comment format?

@andreasmhallberg andreasmhallberg changed the title Is it possible to add comments to the source file that are not rendered in the QTI output? If so, what is the comment forma? Comments in source file May 5, 2020
@gpoore
Copy link
Owner

gpoore commented May 5, 2020

You can use HTML comments <!-- comment --> within the Markdown for a question or a choice. Those shouldn't be rendered in the QTI output but probably would be visible in the HTML source if someone looked at it while taking a quiz--I haven't tried this yet.

I am interested in adding support for comments at the top level of a file (outside individual paragraphs etc.), so that anything can be commented out. One possibility would be to support HTML comments anywhere and then strip them out during processing. Another option would be a special top-level comment syntax. Perhaps something like COMMENT...END_COMMENT like the question group syntax, or maybe line comments like % comment. Do you have any thoughts about those options? Any of these should be relatively easy to add.

@gpoore gpoore added the enhancement New feature or request label May 5, 2020
@jmb275
Copy link

jmb275 commented May 5, 2020

I really like this idea. I just tried the and it doesn't seem to work. I get:

Traceback (most recent call last):
  File "/.pyenv/versions/3.7.7/lib/python3.7/site-packages/text2qti/quiz.py", line 450, in __init__
    parse_actions[action](text)
  File "/.pyenv/versions/3.7.7/lib/python3.7/site-packages/text2qti/quiz.py", line 657, in append_unknown
    raise Text2qtiError(f'Syntax error; unexpected text, or incorrect indentation for a wrapped paragraph:\n"{text}"')
text2qti.err.Text2qtiError: Syntax error; unexpected text, or incorrect indentation for a wrapped paragraph:
<!-- Ch 3 Easy -->

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "//.pyenv/versions/3.7.7/bin/text2qti", line 8, in <module>
    sys.exit(main())
  File "/.pyenv/versions/3.7.7/lib/python3.7/site-packages/text2qti/cmdline.py", line 82, in main
    quiz = Quiz(text, config=config, source_name=file_path.as_posix())
  File "/.pyenv/versions/3.7.7/lib/python3.7/site-packages/text2qti/quiz.py", line 454, in __init__
    raise Text2qtiError(f'In {self.source_name} on line {n+1}:\n{e}')
text2qti.err.Text2qtiError: In "final.md" on line 4:
Syntax error; unexpected text, or incorrect indentation for a wrapped paragraph:
<!-- Ch 3 Easy -->

@lmaibaum
Copy link

lmaibaum commented May 5, 2020

Being able to have comments in the source file would be great. I think it's important that those comments to not make it into the QTI file. My personal preference would be for line comments, for example treating all lines that start with a # character as a comment.

@jmb275
Copy link

jmb275 commented May 5, 2020

I agree. In fact, as I'm making my first quiz using this I'm finding it very difficult to keep track of the different groups I have, their total points, etc. Comments would be really nice.

gpoore added a commit that referenced this issue May 19, 2020
@gpoore
Copy link
Owner

gpoore commented May 19, 2020

In the last commit, I've added two types of comments at the top level of a document (not indented, outside all Markdown):

  • % line comments
  • COMMENT...END_COMMENT multiline comments (delimiters on separate lines by themselves), which parallel the syntax used for question groups

I've also modified the handling of HTML comments within Markdown content, so they are now stripped and no longer appear in QTI output in any form.

@jmb275
Copy link

jmb275 commented May 19, 2020

Thanks so much @gpoore! I'm very grateful for your efforts in building this tool. I've created tools before and it's hard to maintain a decent tool without compensation. Your efforts are really appreciated!

@PrimeMogul
Copy link

PrimeMogul commented May 20, 2020 via email

@gpoore gpoore closed this as completed May 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants