open-resources / scripts

Repo of converter scripts to and from MD files to various platform file formats.
3 stars 0 forks source link

Webwork Script - Modify output for PL script #42

Closed Parsa-Rajabi closed 2 years ago

Parsa-Rajabi commented 2 years ago

There are currently some errors when PL script is ran on the .md files:

There is an error in this problem:
    - File path: source_ww/output_md/College_Physics_Urone/5.Friction_Drag_and_Elasticity/5-01.Friction/NU_U17_05_01_002.md
    - Error: string indices must be integers
source_ww/output_md/College_Physics_Urone/5.Friction_Drag_and_Elasticity/5-01.Friction/NU_U17_05_01_006.md
Check the heading levels, is there one that doesn't belong? Or is the heading level incorrect? For e.g., it should be ### Answer Section (this is not necessarily where the issue is).
There is an error in this problem:
    - File path: source_ww/output_md/College_Physics_Urone/5.Friction_Drag_and_Elasticity/5-01.Friction/NU_U17_05_01_006.md
    - Error: list index out of range
source_ww/output_md/College_Physics_Urone/5.Friction_Drag_and_Elasticity/5-01.Friction/NU_U17_05_01_016.md
Check the heading levels, is there one that doesn't belong? Or is the heading level incorrect? For e.g., it should be ### Answer Section (this is not necessarily where the issue is).

Errors:

Look into the root cause of the errors and resolve them

firasm commented 2 years ago

I just did some quick hacking and I think I see the issue:

In the file NU_U17-33-02-002.md, the level two heading doesn't look formatted correctly:

# {{ params.vars.title }}## Part 1 
The ratio of the strong to the weak force and the ratio of the strong force to theelectromagnetic force become (1) under circumstances where they are unified. Whatare the ratios of the strong force to those two forces under normal circumstances? 

It should be:

# {{ params.vars.title }}

## Part 1 
The ratio of the strong to the weak force and the ratio of the strong force to theelectromagnetic force become (1) under circumstances where they are unified. Whatare the ratios of the strong force to those two forces under normal circumstances? 
firasm commented 2 years ago

Also in the same file I can see in Lines 39 and 40:

      # Randomize Variables
      $SE = 1/(10**-2);
      $SW = 1/(10**-13);

I think those $ aren't valid python names

We also probably should replace all ** to E

Screen Shot 2021-09-23 at 7 25 47 AM
firasm commented 2 years ago

Ok I think the largest issue is the YAML export.

Remember that |- means that "everything after it should be interpreted as a multi-line string" so we only want that for things like imports and generate.

If we do it for server, it will not parse the sub-levels as separate dictionary keys:

Screen Shot 2021-09-23 at 7 42 59 AM

So we need to get rid of |- in server and in the parts:

Screen Shot 2021-09-23 at 7 53 04 AM
firasm commented 2 years ago

TBD needs to be commented out as anything in generate will get run

Screen Shot 2021-09-23 at 7 49 50 AM
firasm commented 2 years ago

One other oddity: it looks like the YAML section starts with part2 rather than part1

Screen Shot 2021-09-23 at 8 08 02 AM
firasm commented 2 years ago

For the problem type, type: Numerical should be: type: number-input

firasm commented 2 years ago

After I fix those relatively minor issues, IT WORKS!!!

Screen Shot 2021-09-23 at 8 11 56 AM

I'm so excited! 🎉

firasm commented 2 years ago

P.S. I've logged all the changes I had to make to the md file in this commit

Parsa-Rajabi commented 2 years ago

I just did some quick hacking and I think I see the issue:

In the file NU_U17-33-02-002.md, the level two heading doesn't look formatted correctly:

# {{ params.vars.title }}## Part 1 
The ratio of the strong to the weak force and the ratio of the strong force to theelectromagnetic force become (1) under circumstances where they are unified. Whatare the ratios of the strong force to those two forces under normal circumstances? 

It should be:

# {{ params.vars.title }}

## Part 1 
The ratio of the strong to the weak force and the ratio of the strong force to theelectromagnetic force become (1) under circumstances where they are unified. Whatare the ratios of the strong force to those two forces under normal circumstances? 

Fixed

Parsa-Rajabi commented 2 years ago

For the problem type, type: Numerical should be: type: number-input

Fixed

Parsa-Rajabi commented 2 years ago

Also in the same file I can see in Lines 39 and 40:

      # Randomize Variables
      $SE = 1/(10**-2);
      $SW = 1/(10**-13);

I think those $ aren't valid python names

We also probably should replace all ** to E

Screen Shot 2021-09-23 at 7 25 47 AM

Fixed. Removed $ and replaced ** with E

Parsa-Rajabi commented 2 years ago

TBD needs to be commented out as anything in generate will get run

Screen Shot 2021-09-23 at 7 49 50 AM

already completed

Parsa-Rajabi commented 2 years ago

Sever in YAML

Ok I think the largest issue is the YAML export.

Remember that |- means that "everything after it should be interpreted as a multi-line string" so we only want that for things like imports and generate.

If we do it for server, it will not parse the sub-levels as separate dictionary keys:

Screen Shot 2021-09-23 at 7 42 59 AM
Parsa-Rajabi commented 2 years ago

Part Subsections

So we need to get rid of |- in server and in the parts:

Screen Shot 2021-09-23 at 7 53 04 AM

One other oddity: it looks like the YAML section starts with part2 rather than part1

Screen Shot 2021-09-23 at 8 08 02 AM
Parsa-Rajabi commented 2 years ago

All items are complete now!

Latest changes include: https://github.com/open-resources/scripts/commit/67ae7f02e2cb2b2e98d00d9e0a7262e752183ddc