-
-
Notifications
You must be signed in to change notification settings - Fork 76
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
Initial checkin of sample problems and parsing script #811
Conversation
@pstaabp Here is my suggestion for the file format/parsing, somiaj@2f66491. The patch is very crude, I was mostly just testing out the fileParser, which to me is working like I envisioned. Also I think we need to remove all of those block comments from the code. I only updated a single problem for this, and won't spend more time on it unless you would like to go this direction. |
@somiaj I decided to have a marker that documentation blocks start with a Let me know what you think about this? All of the files in
creates a folder of html files. |
1fcf25c
to
6666f25
Compare
I can see a possible issue (I think) with your changes in which wasn't in my version. Your Another thought I have is a bit more tricky. I don't like the way the markdown blocks push against the
To me having that space at the start of |
Well if they don't have a
I don't think everything needs to be bumped up again the |
What I mean is something like this:
The second
The space being persevered is the issue that may arise (since spaces mean things to markdown). If you just remove
So every line has a space in front if it. I think these should be stripped (But maybe the markdown already nicely deals with this so this is a non-issue) |
Note, the first issue about non-continuous markdown blocks is not really an issue if we just make sure the files are formatted correctly to begin with, just something I noticed is all. |
d14fda2
to
f6db794
Compare
Added more problems and updated the script to crawl through the Added a list styling with bootstrap and code highlighting with highlight.js. Next step is to get this script working as a github action that will post to openwebwork.github.io/pg-docs Another goal is to automatically link POD documentation for non-standard macros. |
0fa3460
to
de21798
Compare
I have a working version of the sample problems in a GitHub page. TLDR: go to https://pstaabp.github.io/pg-docs/. Currently, I'm testing this on my repository, but the plan will be for this to go to openwebwork.github.io/pg-docs. I got this working by two GitHub actions in my pg-docs repository (right now in the
Additionally, I added a copy to clipboard for each of the code blocks. I will create a copy entire field to clipboard action as well. |
de1c2a0
to
8d31d62
Compare
b99b19f
to
35b8a8e
Compare
Added some more features. TLDR: https://pstaabp.github.io/pg-docs/
If this is looking reasonable, I'll move it to: https://openwebwork.github.io/pg-docs/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a couple of things I notice that should be changed.
The .mt
extension is not a standard extension for Mojolicious template files. Please change those to .html.ep
which is the standard for html Mojolicious template files. Otherwise syntax highlighters for Mojolicious template files are not active by default.
Please make the parse-prob-doc.pl file executable.
Also, clean up category_layout.mt (and rename it to category_layout.html.ep). The formatting in that file is inconsistent with the formatting of the other template files. |
I just noticed that the actual filename you used is |
I see where you got the |
@pstaabp looked around a bit, and looking good. Two things I noticed, first is I don't really like the syntax highlighting, it really isn't catered towards pg and PGML files. I wonder if there is a way we could use the PGCodeMirror syntax highlighting to match the webwork2 editor. Second lots of |
Even before considering pg and PGML syntax, highlight.js does not seem to do well even for syntax highlighting of Perl. It doesn't even have a different color for variables. Not to mention that the color scheme that highlight.js uses has low foreground/background contrast, and is far from accessible. |
@drgrice1 Will cleanup the templates. And remove I was wondering if codeMirror might be too heavyweight for this since we are not doing editing, but the advantage is that we have the PGML formatting for this. I'll try switching over to that. |
@pstaabp Seems CodeMirror5 has a runmode addon, https://codemirror.net/5/doc/manual.html#addon_runmode, which can use CodeMirror to use its tools to syntax highlight a text box, but not invoke any of the editor functionality. |
Looking closer, also check the option right under that one,
|
@pstaabp: I added a pull request to your branch with some improvements to the layout. The main change is instead of generating an index and another copy of that index for each of the categories, a single index file is generated in the root output location with all of it. Bootstrap tabs are used for the categories instead of separate pages. |
One issue that occurred to me with using CodeMirror is the |
@pstaabp: My pull request now also includes a switch from using highlight.js to using CodeMirror and its standalone runmode. For now I just copied the PG.js file from webwork2 into docs/js. |
Remove the CodeMirror eclipse theme, and just use the default. This is the same default used in the PGProblemEditor for webwork2, and is actually very similar to the eclipse theme. If you don't like the dark theme, then we should just use the default. Increase the width of the sidebar to fit the content. Make the dropdown show the correct label when the macros page is selected. Remove the "default" tab pane and hidden sidebar item. The instructions that were in the tab pane simply aren't needed. This is a straightforward page with not much else to do. In addition the hidden list-group-item completely messes up the sidebar appearance. Remove the duplicate "parserFormulaUpToConstant.pl" key in macro_pod.yml, and add the missing "parserAutoStrings.pl" macro that is referenced in "doc/sample-problems/problem-techniques/StringsInContext.pg". Since this was not in the yml file, this caused a use of uninitialized value in string concatenation warning, and obviously the link didn't work. Also fix several issues with the documentation in the graph tool problems.
Split the parsing to a separate module to prepare for using this as a viewer for webwork2
…le things more dynamically. Instead of reading macro files from the YAML file, use POD::Simple::Search to locate them. All macro files that contain POD will be in the list it creates. Instead of saving sample problem metadata in a YAML file, that is retrieved on the fly. Reading metadata is fast. pandoc is what slows parsing down. Since reading metadata doesn't do that part, it is fast. The module now only deals with the things that are shared by the parse-problem-doc.pl script (no more prob), and webwork2's rendering.
60a7446
to
ccefc16
Compare
4f6aff2
to
7c3a349
Compare
Updated with suggestions above and @drgrice1, I updated the exponential problem that uses CSS styling to format instead of niceTables.pl. |
@pstaabp: I added another pull request to this branch that updates one problem and fixes another. |
Update WeightedGrader.pg and fix DraggableSubsets.pg
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this pull request is looking pretty good now. I have not had a chance to look over and test the latest sample problems that were added, but I see that they aren't giving any errors at least when the parser-problem-doc.pl
script is run. So I will for now accept them as they are.
This branch provides sample problems originally in the OPL with embedded comments in a particular format that can be parsed with a provided script. This was originally discussed in openwebwork/webwork2#1936
The sample problems are in
doc/sample-problems
and there is README.md file with more information especially on the format of the the coding documentation. These problems originally came from the OPL in the directoryFortLewis/Authoring/Templates
. I only brought over the PGML versions and have updated the code and the comments that were originally on the WeBWorK wiki.There is a script
bin/parse-prob-doc.pl
that currently parses the file and outputs the resulting HTML file. This uses a Mojo::Template to do the formatting as HTML--I used this mainly because it lightweight, fast and is already an installed module. The template isbin/prob-template.mt
.This currently only takes a directory of pg files, parses and converts to HTML--outputting to a local directory. I plan to make this recursive to generate the files in an identical directory structure. I think it's quite crude now--perhaps just a proof of concept. Other things that are needed
Lastly, I think we should have the documentation automatically be moved to another repository (perhaps
pg-docs
) and use GitHub pages to serve the files. The POD could also live here. We should be able to have a GitHub action run to do this last step (perhaps not automatically, but somehow triggerable).