Create parsing for texvc.sty using texutil.js#46
Conversation
|
@notjagan please fix the failing tests |
|
@HowardCohl @notjagan what is the progess here? |
|
@physikerwelt It turns out that this was a pull request made by Claude, not @notjagan . Also, it has to do with the texvcjs repo, @notjagan is working on the texer repo. |
|
While I was getting the code to pass the tests, I noticed two possible inconsistencies between texvc.sty and the preexisting test cases. The first is that the test cases look for |
| @@ -0,0 +1,18 @@ | |||
| 0 info it worked if it ends with ok | |||
There was a problem hiding this comment.
Remove the log file, please.
| } | ||
| sections = sections.slice(0, sections.length - 1); | ||
| return sections; | ||
| return string.match(/\{[^\{\}]*?(([^\}]*)\}+)*?[^\{\}]*?\}|\[[^\[\]]*?(([^\]]*)\]+)*?[^\[\]]*?\]/g).map(function(s) { |
There was a problem hiding this comment.
In Germany one calls that "to reinvent the wheel".
How about using a well tested library for that like
https://www.npmjs.com/package/balanced-match
?
| "\\DeclareRobustCommand", | ||
| "\\defSpecFun"]; | ||
|
|
||
| // Returns a two dimensional array, where each element contains the body of a bracket section and the type of bracket |
There was a problem hiding this comment.
Use multiline comments here as in https://github.com/wikimedia/service-template-node/blob/master/routes/ex.js#L44-L49
|
I wrote tests for a majority of the methods within |
| cmds[commands[0]] = commands[1]; | ||
| break; | ||
| case 1: | ||
| var cmd = definition.replace(new RegExp(sections[0][0].replace(/\\/g, "\\\\"), 'g'), "").match(/\\[a-zA-Z]+/)[0]; |
There was a problem hiding this comment.
It's still not clear to me, what this line does. @HowardCohl do you understand that?
There was a problem hiding this comment.
Maybe it would make sense to introduce a a variable for sections[0] ?
Would that be \command1,'{' int the example below.
There was a problem hiding this comment.
@physikerwelt @notjagan says he fixed this in the latest pull request
|
Well done! The comments help to understand your code. However, there are some things that still are not clear to me. |
|
@notjagan each function should have at least one test case. But you can create different ways of testing your methods. |
| parseSty.newCommand("\\newcommand\\test\\test\\test", "\\newcommand", {}); | ||
| }, function(err) { return err instanceof Error; }); | ||
| }); | ||
| }); No newline at end of file |
There was a problem hiding this comment.
newline at the end of the file please
| lib/optionalFunctions.csv | ||
|
|
||
| # Node log | ||
| lib/npm-debug.log No newline at end of file |
There was a problem hiding this comment.
add a newline at the end of the file, please.
|
only one more newline and you are done ;-) |
It currently puts the parsed array into other_literals3.