-
Notifications
You must be signed in to change notification settings - Fork 38
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
Tutorials: Simplify file validation (xpath / relaxNG ) #65
Comments
At the moment writing, the user input in the tutorials is validated via xpath expressions predefined by the tutorial authors like so:
|
After having written about 390 of these rules for the march tutorial, I can tell that on the one hand this is
On the other hand, it gives you
|
I wouldn't remove the current xpath setup, I would just add the RNG to get rid of pure structural checks (make sure that staffDef is nested inside staffGrp is nested inside scoreDef). If that's helpful for a given tutorial, there could still be such xpath rules to guide the user as you just said, but in most cases, they would only be necessary to check if the user's encoding goes in the right direction. So RNG should not replace XPath, but join it. |
Validating against RelaxNG on the client as mentioned by you and @lpugin would be great. As you said, it could reduce the sheer amount of rules to write. Totally agree with you to see it not as alternative but joined options that would give the possibility and flexibility to use both of it (according to the specific situation). [Surely it should be RNG validated at the latest right before Verovio tries to render.] |
From a didactic and pedagogical perspective regarding the user, I really like the approach of xpath rules. Regarding tutorial authors, this is not very "authorfriendly". The question that comes to my mind is: Can we keep such a granular control over the single encoding steps and simplify the rules part at the same time? An option could be to "automatically" generate the xpath rules for the tutorial authors who can instead write predefined "self-explaining" functions. Thinking of something like:
(I played this through for one of the longer march tutorial steps and it turned out that there aren't any checks, at least at the moment, that could not be generated by the use of 4 or 5 such predefined functions) Of course, anyone who wants to write pure xpath rules should not be prevented from doing so. But to have additionally some autogenerated standard functions could help to reduce the obstacles for people not in a massively deep relationship with XPath ;) What do you think? |
I like it, but I can already hear @lpugin complaining about an over-engineered solution ;-) Another idea I had was to somehow parse the sample solution in the XML files and create some kind of validation for the user input out of that. Besides all questions about the technical procedure for that, this approach seems to more complicated when it comes to giving human-readable hints on what is wrong. We surely don't want to write a complete validation engine by ourselves ;-) |
I am not saying anything... However, we should not loose focus indeed. I can understand that writing the rules is time consuming, but I assume it would remain quite time consuming to write the pseudo-rules once the translation infrastructure is in place. But of course I do not want to through water on the fire and all this tutorial developments are great! |
On the side of the RelaxNG schema side, one advantage is that it provides auto-completion. This is quite helpful, however it is also a double edged sword at the tutorial level because it shows the all list of options, which as we know can be quite long in MEI. |
But you're using CodeMirror, right? Right now, the tutorials are built around Ace. How strong is your setup tied to CodeMirror, and do you think we could (more or less) easily achieve the same with Ace? |
@kepper yes. Basically the main features used are asynchronous validation and autocomplete. I could not get the autocomplete for XML working with Ace, which is the reason I tried CodeMirror (https://codemirror.net/demo/xmlcomplete.html). I assume it must be possible to have the same with Ace but I am not sure how much work this is. Do you have an example? |
The reason to use Ace in the first place was mostly that I'm familiar with that already. I remember having tried CodeMirror a couple of years ago, where I ran into restrictions (but I don't remember whether these restrictions were on CodeMirror or my skills…). It's definitely possible to do auto-completion in Ace as well, but I have no experience with that. We may have to build some "bridge" between the RNG and the autocompletion code – but I guess you had to do the same for CodeMirror, right? At this point, I wonder which way requires more work – switching to CodeMirror, and enabling autocompletion in Ace. Since you already said that autocompletion might contradict pedagogical concepts, I'm inclined to ignore that for now and stick with Ace… |
Sounds good. |
Leaving this open for now as this is still open to discussion. To keep in mind: For some more complex tutorials, it could be interesting to think about embedding a Verovio-App or Verovio-Editor module. |
Verovio editor for tutorials would be great. |
It would be possible to pass files to fill or to correct: |
In #57 (comment) @kepper adressed the issue of simplifying the validation steps of the tutorial:
@lpugin answered in #57 (comment)
To keep things separated, let's further discuss the issue of simplifying file validation on the client side here.
The text was updated successfully, but these errors were encountered: