-
Notifications
You must be signed in to change notification settings - Fork 6
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
Export html #52
base: master
Are you sure you want to change the base?
Export html #52
Conversation
This exports a basic html file, with the option to specify which properties are written. Annotations and their properties are wrapped in div tags with classes specified automatically, leaving ID open for the moment. The point of id for individual annotations will obviously be to link to score items once that is eventually approached. Different annotation lists (as/in bookparts) in a book could also use id's to differentiate themselves from one another.
…ust specific any/all)
Ah, I meant to add that it also looks for the The output of all this is in usage-examples/index.html. Plaintext and LaTeX still export fine as well. |
This looks exciting, great to see that your continuing interest spawns new productivity. I hope to be able to look into it this evening. Based on the description I think there's one additional option to wish (sorry if I should have overlooked it): export the annotations div only, i.e. not a full document. Probably it should also be configurable to produce id= or class=. At least these are the things I found necessary in Frescobaldi's colored source export. This export option will be a great foundation for creating a GUI annotation viever/editor (in Frescobaldi)! |
annotate/README.md
Outdated
``` | ||
|
||
Those output files will automatically format annotations to be further processed by the | ||
relevant programs. Currently, *plaintext* and *latex* are available, while other types | ||
relevant programs. Currently, *plaintext*, *latex* and *html* are available, while other types | ||
are on the wishlist (such as *scheme* and *markdown*). |
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.
One could add json to the list
annotate/config.ily
Outdated
\registerOption scholarly.annotate.export.html.css | ||
#"annotate-styles.css" | ||
|
||
|
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 we need the option
\registerOption scholarly.annotate.export.html.full-document ##t
here. Of course it also has to be processed somewhere ...
usage-examples/index.html
Outdated
@@ -0,0 +1,96 @@ | |||
<head> |
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.
This is a resulting file, isn't it?
If so it shouldn't be included in the commit but rather ~.html
be added to the .gitignore
file.
(Disclaimer: note this is still from only looking at the web interface) We can't know in what contexts users may want to use the exported HTML - which is why we also want to provide the option to export a full document or only the content div. For the same reason I suggest that the enclosing div can look either of the following:
Users might want to have multiple such divs in a document (so |
Okay thanks for the clarification - so you mean this only for the (currently named) "annotations" div, correct? I agree this should be as flexible as possible, without it being too messy / confusing (of course the alternative is it being too rigid / inflexible..). Perhaps (and this is assuming we mean just the overall annotations div):
Feel free to suggest a better name than
Yes, I had that in mind which is why I defaulted to And now, if we implement this option to name an ID (which should have already been there, I just forgot about it) with the (now committed) option to export that annotations div without header/body stuff, the user can append / manipulate multiple lists together. Maybe Frescobaldi's future annotations viewer can even have a way to simply import multiple documents (containing annotations divs) into the browser? |
How about, an option for referencing/including CSS: \setOption scholarly.annotate.export.html.with-css ##f % doesn't link / include any CSS
\setOption scholarly.annotate.export.html.with-css #`header % prints CSS to header
\setOption scholarly.annotate.export.html.with-css #`linked % prints a link to the CSS in header Of course the latter two will only be employed if the html is exported with the header and not just the annotations div. The following option, an updated version of the similar one already in place, for which CSS to use:
\setOption scholarly.annotate.export.html.use-css #`default or a new one generated at the time of compilation based on other options (yet to be implemented) \setOption scholarly.annotate.export.html.use-css #`generate or one that the user will provide: \setOption scholarly.annotate.export.html.use-css #`external And finally, this option to set the name of the CSS document which goes into naming the generated CSS and/or what CSS to link to in the header. % Note: I'm aware this may not actually be the correct quasiquote/string punctuation
\setOption scholarly.annotate.export.html.css-name #`"my-special-css" |
…specific most div types - TO BE extended probably
OK, I'll first comment on the previous comments and then go and look at the code ...
I think this is completely true. \registerOption scholarly.annotate.export.html.annotations-div-tags
#`((type . "ul")
(class . "annotations")
(id . #f))
+1
These are very clear ideas, to which I only add some suggestions:
And I suggest to add the following to the wish list (although it is not necessary to implement it right away): Finally we need (i think) the option to let the user provide a CSS template to use for
Great!
Actually, I can't. I have a complicated and tightly scheduled commission right now where I have to prove that LilyPond is and that I am capable of tackling a very specific challenge, and additionally the GSoC aspirants require some time dedicated ...
Thanks for getting back to this. I really think this will be an exciting addition and announcement. Would be great if someone would start on a GUI for this in Frescobaldi. We'll see what GSoC brings ... |
Based on the previous commit the need for a println function is greatly reduced, and also if we're going to add more functionality I'm pretty sure that "format" in combination with multline strings will be the better (and more functionally oriented) way to do it.
I'm not 100% sure if I can impose this but anything other than keeping indentation the way Frescobaldi does it seems to be a problem on the long run
This approach includes the necessary conditionals in the bindings of the parameters themselves, avoiding to have to separate but nearly identical structures in the branches of the if clause. Additionally it fixes an issue when both class and id are present (where the space was missing in between). Now an arbitrary number of tags can be joined in an opening tag
nest-indent somehow sounds to me like it would actively determine the current indentation level and add one to it, while actually it simply indents a given string.
OK, you see that I've added a number of commits modifying (and hopefully streamlining) the code in I think you have to continue implementing the options we discussed in this thread, but from running the example files I have two questions: Do you know why there is no location info in the output, shouldn't this be collected automatically? And do you have any idea why the |
It appears that the first segment of the filename must match the (first segment, all segments?) of the original. Changing the generated name to |
Do you mean grob location (Measure n, beat n)? There isn't automatically printed because this frees the user to, say, have type occur before grob-location in the printed props list, or however else. No reason to hard code that. \setOption scholarly.annotate.export.html.props #`(type grob-location message) |
What this mainly does:
Exports html with a header and body.
The user can set the name (or really path to) their CSS file (
scholarly.annotate.export.html.css
) so that it is automatically linked in the header. Within the body, an "annotations" div encapsulates all the individual annotations. Then they each are held in an "annotation" div, and within that another div of the respective type (critical-remark, etc) which holds divs for each prop. This structure is a little redundant for a simple project with little CSS, but it leaves open the opportunity to alter styles for different annotation types, which I think will be a pretty awesome level of flexibility to have when this all comes together.The props are set with
and the labels are set with
scholarly.annotate.export.html.labels
.But what it also does:
Changes the
write-output-file
procedure to ask for atype
symbol argument, which is one ofhtml
,scheme
,latex
orplaintext
. By default, as before, the module exports the files as<name>.annotations.<default type extension>
with the extensions being "html", "inp", "scm" and "log". But the following option lets the user specify an exact output name, or otherwise the aforementioned default: