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

Add pre- and post- code inclusion to fppgen #31

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

nelson-lojo
Copy link
Contributor

Dependent on #30. Can be marked as "not draft" once that is closed

Added logic to include pre_code and post_code regions into the generator. Below is an example source file:

example_question.fpp

"""
This is an example question. Write a function that determines if its argument is an even number. 
"""

## prefix_code ##
def is_even?(n)
## prefix_code ##
  return n ?%? 2 ?==? 0
## suffix_code ##
end
## suffix_code ##

## metadata ##
{
    "autograder" : "ruby"
}
## metadata ##

## test ##
describe is_even? do
  it "is true for even numbers" do
    expect(is_even?(2)).to be_truthy
  end
  it "is false for odd numbers" do
    expect(is_even?(3)).to be_falsy
  end
end
## test ##

@nelson-lojo nelson-lojo self-assigned this May 31, 2024
@nelson-lojo nelson-lojo marked this pull request as ready for review June 12, 2024 00:06
@SybelBlue
Copy link
Contributor

Would you mind squashing all these down (or whatever dance git requires of you to make this a single commit merge)?

Copy link
Contributor

@SybelBlue SybelBlue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only one small question, maybe a no-code answer.

@@ -23,7 +23,7 @@
</div>
{{/scrambled}}
{{#pre_text}}
<pre class="prettyprint" language="{{{language}}}"> {{{text}}} </pre>
<pre class="prettyprint" {{#language}}language="{{{language}}}"{{/language}}> {{{text}}} </pre>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

have we checked this works? Inner "{{{language}}}" might need be to "{{..}}" or something like it

fppgen/lib/autograde.py Show resolved Hide resolved
@nelson-lojo
Copy link
Contributor Author

Would you mind squashing all these down (or whatever dance git requires of you to make this a single commit merge)?

Doesn't "Squash and merge" only create one commit on the base branch?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add pre-/post- text capabilities to problem generation
2 participants