Skip to content

Add HTML->CSS submenu - #1999

Open
arbayai wants to merge 8 commits into
DistributedProofreaders:masterfrom
arbayai:css-submenu
Open

arbayai wants to merge 8 commits into
DistributedProofreaders:masterfrom
arbayai:css-submenu

Conversation

@arbayai

@arbayai arbayai commented Oct 17, 2026

Copy link
Copy Markdown

Looks in user's prefsdir for a css folder. If present, adds a CSS submenu to the HTML menu with the contents of that folder.
Choosing a file from that menu inserts the file's contents, and BEGIN/END markers, at the end of the <style>..</style> section of the HTML. A warning message prompts the user to replace if the file is already present.

A further improvement would be to also look in a project-controlled folder. Then relatively niche standard css, currently added as part of HTML generation (e.g. sidenotes) could be added by the user as-needed instead of adding to every project and requiring manual removal later. Happy to work on that if you'd like.

@windymilla
windymilla self-requested a review October 18, 2026 12:53

@windymilla windymilla left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to work as expected, and the style & use of existing GG functions fits well with the existing code - thank you.
I have a few questions/suggestions:

  1. Would it be better to pass the file path into add_css_file rather than just the filename? It would need to extract the filename internally to add to the start/end lines. This would mean that the function could be used for loading files from other directories in future. Also, it would avoid having the directory location under GGprefs being referenced in two separate places.
  2. I wonder if the directory should be css rather than CSS? Since the files need a suffix of .css, some users may not often consider upper/lowercase in filenames, and either make the directory lowercase or the suffix uppercase, causing confusion.
  3. Line 1369 can be made clearer by using a feature of Tk index strings to increment by one line, and move to start of line:
    end_pos += "+1l linestart"
    Or you could use f"{end_pos} +1l linestart" where you use end_pos later
  4. Lines 1371/2 can be combined in one call to
    `maintext().replace(begin_pos, end_pos, f"{begin_marker}{css_text}{end_marker}\n")
  5. L 1355/58 - no need to specify regexp=False - that's the default.
  6. I suggest adding a call to make the inserted CSS visible on-screen, something like:
    maintext().set_insert_index(maintext().rowcol(f"{insert_pos}+1l"), top_of_page=True)
    You might decide you want to restructure slightly to avoid duplicate calls to undo_block_begin, replace & set_insert_index for the two cases. It should be safe to call undo_block_begin early in the routine if that helps - it doesn't matter if you end up returning without making any edits

The following are more general questions about how to best make use of this feature. I'm happy to discuss them here, or feel free to message me via PM if that's easier. None of this is meant to be negative - just trying to explore the consequences of what would be quite a significant change to the way CSS has been provided by GG2 (and GG1 before it) for a long time.

  • At the moment, the default CSS header contains CSS, that as you say, is not used in most projects, e.g. sidenotes, footnotes, poetry, index. Are you thinking we should remove some/all of that CSS from the default, and require the PPer to add in the CSS files they need?
  • If the footnote CSS was removed, for example, is there a danger that a PPer might do their HTML conversion, then be confused by the fact that footnotes don't look right, or even submit it without noticing?
  • If we did remove CSS from the default header, where would we put it so that PPers could access it? Perhaps in a data/html/css directory under the release. Would we then want a second HTML menu entry, "Add Default CSS" that lists the CSS files in that directory, and maybe rename your first entry to "Add Custom CSS", for CSS files that the user creates?
  • Possibly overkill, but another option might be to have a "Configure Default CSS" menu entry too (probably need to put all 3 into a CSS submenu at this point). This would pop a dialog which lists the CSS files in data/html/css with a checkbox next to each. When they run HTML autogenerate, it would automatically import all the checked ones. They could then use the Add CSS options to add any more later at any point. The list of checked CSS would be stored as a preference, so persistent from one project to the next. This would have two advantages that I can see: First, a user who would prefer to just get all the default CSS and delete the lines they don't want (as is currently the case) can have that. Second, a user who does mostly simple fiction could have most CSS files unchecked, but one who regularly does non-fiction with footnotes, could have the footnote CSS file checked, so they don't need to keep importing footnote CSS manually for every project. Perhaps the "Configure Default CSS" button should also be in the HTML generation dialog, so when a user is about to create the HTML , they can tweak what will be imported.

@srjfoo

srjfoo commented Oct 19, 2026

Copy link
Copy Markdown
Member

I wonder if the directory should be css rather than CSS? Since the files need a suffix of .css, some users may not often consider upper/lowercase in filenames, and either make the directory lowercase or the suffix uppercase, causing confusion.

I tried both in macOS. Default install isn't case-sensitive, so both worked. But it's a good idea to be aware that some systems are case sensitive. Perhaps make sure that both are acceptable?

The following are more general questions about how to best make use of this feature. I'm happy to discuss them here, or feel free to message me via PM if that's easier. None of this is meant to be negative - just trying to explore the consequences of what would be quite a significant change to the way CSS has been provided by GG2 (and GG1 before it) for a long time.

As always, there's a balance between providing new and desirable functionality and keeping it recognizable to existing users. I honestly don't see a down-side to reducing the effort it takes PPers to customize CSS.

  • At the moment, the default CSS header contains CSS, that as you say, is not used in most projects, e.g. sidenotes, footnotes, poetry, index. Are you thinking we should remove some/all of that CSS from the default, and require the PPer to add in the CSS files they need?
  • If the footnote CSS was removed, for example, is there a danger that a PPer might do their HTML conversion, then be confused by the fact that footnotes don't look right, or even submit it without noticing?
  • If we did remove CSS from the default header, where would we put it so that PPers could access it? Perhaps in a data/html/css directory under the release. Would we then want a second HTML menu entry, "Add Default CSS" that lists the CSS files in that directory, and maybe rename your first entry to "Add Custom CSS", for CSS files that the user creates?
  • Possibly overkill, but another option might be to have a "Configure Default CSS" menu entry too (probably need to put all 3 into a CSS submenu at this point). This would pop a dialog which lists the CSS files in data/html/css with a checkbox next to each. When they run HTML autogenerate, it would automatically import all the checked ones. They could then use the Add CSS options to add any more later at any point. The list of checked CSS would be stored as a preference, so persistent from one project to the next. This would have two advantages that I can see: First, a user who would prefer to just get all the default CSS and delete the lines they don't want (as is currently the case) can have that. Second, a user who does mostly simple fiction could have most CSS files unchecked, but one who regularly does non-fiction with footnotes, could have the footnote CSS file checked, so they don't need to keep importing footnote CSS manually for every project. Perhaps the "Configure Default CSS" button should also be in the HTML generation dialog, so when a user is about to create the HTML, they can tweak what will be imported.

I think that this comment applies to the above 4 bullet points. If we make CSS fully customizable, and not added 100% automatically while leaving the PPer to remove any unused CSS if they wish to, I think we need to leave the default configuration such that those who don't immediately notice the change won't be surprised by the change, so

  • Use Default CSS as a preference in the Settings dialog with it automatically selected, and
  • All the checkboxes (per @windymilla's last bullet point) checked, so that ultimately, nothing changes for users before they wrap their heads around the change.

I also like the idea of being able to navigate to the extra CSS file so that one can have project-specific extra CSS that is not stored in the GGprefs directory. I can see the value of having both.

The people who are most likely to face potential confusion are those who have already customized their CSS per the current method. I haven't thought through how to alert them to the change.

@windymilla

Copy link
Copy Markdown
Collaborator

I think that this comment applies to the above 4 bullet points. If we make CSS fully customizable, and not added 100% automatically while leaving the PPer to remove any unused CSS if they wish to, I think we need to leave the default configuration such that those who don't immediately notice the change won't be surprised by the change, so

  • Use Default CSS as a preference in the Settings dialog with it automatically selected, and
  • All the checkboxes (per @windymilla's last bullet point) checked, so that ultimately, nothing changes for users before they wrap their heads around the change.

I don't think there will be a need for a Use Default CSS preference if the checkboxes are all checked by default. I think that would mean no change for users by default.

I also like the idea of being able to navigate to the extra CSS file so that one can have project-specific extra CSS that is not stored in the GGprefs directory. I can see the value of having both.

I'm not sure of the purpose of project-specific CSS files. If you are truly just using the CSS for project X, then edit it into the style section at the top of the file after you create the HTML - if it is that specific, it's likely you won't get it right until after you create the HTML and look at it in the browser anyway. But if you want to use the CSS in several projects (e.g. you enjoy doing drama and have specific CSS for them) put the CSS in your GGprefs, and include it in the relevant projects.

The people who are most likely to face potential confusion are those who have already customized their CSS per the current method. I haven't thought through how to alert them to the change.

I don't think it will affect them if they use the recommended method, nor if they use the alternative method. In the first case, they will just get whichever files are included by the checkbox list (by default all of them) and their custom CSS will follow it, as it does now. With the alternative method, their custom CSS completely replaces all the GG-supplied CSS, which will continue to be the case.

@arbayai

arbayai commented Oct 20, 2026

Copy link
Copy Markdown
Author

I've made changes 2-5; see below re:1. 5 was a little surprising since I just copied that from html_convert.py line 1056, but no matter.

To respond to your general questions I'll try to describe where I see this going. I'd meant to hold off on this until I had time to try doing it, since in practice my ideas tend to evolve as I work, and I don't really know how feasible this is (especially for me). But here goes...

The goal would be to have both GG2-level default and additional css, and user-level default and additional css. GG2-level default is a subset of the full header that gets added by HTML Generator now; additional css is /data/html/css/ (or wherever), sidenotes.css, footnotes.css, etc. At the user-level, there's prefsdir/html-header.txt (which I really want to rename to .css; I imagine most people who'd use this also use a text editor with syntax-coloring based on filename extension, so .css is a functionally better choice than .txt) for default/always include, and prefsdir/css/ for additional .css files.

GG2 and user .css filenames are merged into a deduplicated & sorted CSS submenu. If the same file is in both directories, the user's prevails, so e.g. a user can override the default footnotes.css with their own if desired. That's why (for now) I haven't made change 1. I want to pass just the filename to add_css_file, and have that function check first for a user .css file, and then if there isn't one use the GG2 .css file. Can't do that if I pass filepath.

On Generate HTML, automatically add css if needed for the project. For example, if there are footnotes, call add_css_file(footnotes.css). The function will then apply the user's footnotes.css if there is one, else the GG2 footnotes.css. If there aren't footnotes, skip it, save the user deleting it later.

So, I don't think there would be a need for the complexity of letting the user manually choose css blocks to always include whether needed or not. If it's not needed, it's probably not wanted (but available in the CSS submenu just in case, e.g. if a book has no TOC but someone wants to see the TOC css for reference when setting up a different flex-list). Or put another way, something that has a fair chance of being wanted even when not needed belongs in the default, not a seperate .css file.

Let me know what you think, or if I've missed something, etc.

For me I think the next step is trying this with probably footnotes.css, see how it goes with something I'm familiar with and use in many though not all projects. An open question is where to draw the line between always-added and added-as-needed.

@windymilla

Copy link
Copy Markdown
Collaborator

I've made changes 2-5; see below re:1. 5 was a little surprising since I just copied that from html_convert.py line 1056, but no matter.

It's no problem to specify regexp=False, and I'm not surprised you found an example of it elsewhere, especially since when I started writing GG2 I was also teaching myself python/Tkinter.

To respond to your general questions I'll try to describe where I see this going. I'd meant to hold off on this until I had time to try doing it, since in practice my ideas tend to evolve as I work, and I don't really know how feasible this is (especially for me). But here goes...

Thanks - this overview is very helpful in understanding your idea.

The goal would be to have both GG2-level default and additional css, and user-level default and additional css. GG2-level default is a subset of the full header that gets added by HTML Generator now; additional css is /data/html/css/ (or wherever), sidenotes.css, footnotes.css, etc. At the user-level, there's prefsdir/html-header.txt (which I really want to rename to .css; I imagine most people who'd use this also use a text editor with syntax-coloring based on filename extension, so .css is a functionally better choice than .txt) for default/always include, and prefsdir/css/ for additional .css files.

The ".txt" extension is what was always used for the header. I don't know why the original author of GG1 chose that, but perhaps because back then editing a text file (at least on Windows) was easy, by double-clicking it, or perhaps because the default version, included by GG, is not just CSS, since it includes the <!DOCTYPE html> and other HTML header stuff. I think a good argument could be made for removing all the HTML from html-header.txt, and renaming it default.css or something similar. The autogeneration process would add the HTML header (either directly from the code, or from a header.html file), something like:

<!DOCTYPE html>
<html lang="BOOKLANG">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="format-detection" content="telephone=no,date=no,address=no,email=no,url=no">
    <title>
      TITLE | Project Gutenberg
    </title>
    <link rel="icon" href="images/cover.jpg" type="image/x-cover">
    <style>

    </style>
</head>
<body>

Then it would insert the default.css file using your mechanism.

GG2 and user .css filenames are merged into a deduplicated & sorted CSS submenu. If the same file is in both directories, the user's prevails, so e.g. a user can override the default footnotes.css with their own if desired. That's why (for now) I haven't made change 1. I want to pass just the filename to add_css_file, and have that function check first for a user .css file, and then if there isn't one use the GG2 .css file. Can't do that if I pass filepath.

On Generate HTML, automatically add css if needed for the project. For example, if there are footnotes, call add_css_file(footnotes.css). The function will then apply the user's footnotes.css if there is one, else the GG2 footnotes.css. If there aren't footnotes, skip it, save the user deleting it later.

That makes sense. There is one subtlety in the current code (not sure if you've come across it), but I think we could argue that it could be removed if we have your new mechanism. It is that if the user's html_header.txt starts with <!DOCTYPE, it is assumed to be a complete header, rather than additional CSS. This feature is used by one or two PPers, but has a disadvantage (which is why it is not the recommended method): if we make a change to the default CSS, e.g. to match a change in the code, such a user doesn't get the change - this has happened fairly recently causing some confusion.

I can see a possible similar danger in your scheme. If we change the default footnotes.css for any reason, a user's footnotes.css would override the changes. Although a tech-savvy user could find the default from in the released code and copy the changes across into their custom footnotes.css file, it is not ideal to expect users to have to delve into the installed code. I'm not sure what the best solution to that is.

It's not clear to me from your description above (and I understand you are thinking it through yourself too) whether the user's html-header.css is a replacement or addition to the GG2 CSS. You have said that the additional CSS files are replacements. If html-header.css is also a replacement, there is no mechanism for just supplying additions without replacing CSS that might be vital. Perhaps html-header.css would be a replacement, and a separate file, something like additional.css would be a place where the user would put additional CSS they always want, and that is not specific to a feature.

So, I don't think there would be a need for the complexity of letting the user manually choose css blocks to always include whether needed or not. If it's not needed, it's probably not wanted (but available in the CSS submenu just in case, e.g. if a book has no TOC but someone wants to see the TOC css for reference when setting up a different flex-list). Or put another way, something that has a fair chance of being wanted even when not needed belongs in the default, not a seperate .css file.

Subject to my thoughts above about replacement/addition of default CSS, I agree.

For me I think the next step is trying this with probably footnotes.css, see how it goes with something I'm familiar with and use in many though not all projects. An open question is where to draw the line between always-added and added-as-needed.

I'm very happy to help with any of that - feel free to message with any specific questions

@windymilla windymilla left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks - your changes look good.

I think it's better for you to continue work and add commits to this PR, but I would be open to merging this into the master branch and you starting a new PR if you'd prefer. This work is harmless to existing users, and they wouldn't see it anyway unless I released a new version, which there is no rush to do.

@arbayai

arbayai commented Oct 21, 2026

Copy link
Copy Markdown
Author

I was thinking that the user's defaults would be added to what comes from GG2, not replace it. But I was aware of the full replacement option (and chose not to use it myself because of not getting updates when the official CSS changes). I think that can still be an option for those who want it, and perhaps something with the release notes could help with user awareness, e.g. if the release notes for the recentmost version contains footnotes.css, then HTML Generate can add a comment about that if the user's footnotes.css is overriding. Just for some extra awareness of the change. But that's just off the top of my head.

As for merging to master I'll trust your judgement, it's ok with me to keep this as a branch as I continue working.

@windymilla

Copy link
Copy Markdown
Collaborator

Just checking I've understood:

  • User defaults would be in addition to GG2 default
  • User footnotes.css (for example) would replace GG2 footnotes.css
  • Possibly, if release notes for the current release mention "footnotes.css", then when the user first runs the new release (and thus get shown the release notes) they could perhaps have an additional alert: "The supplied footnote.css file has changed in this release - you may want to adjust your custom footnotes.css file accordingly"

The only other alternative that comes to mind is to allow the custom footnotes.css to either augment or replace GG2's, possibly controlled by a naming convention, e.g. footnotes.css replaces, but footnotes_additional, or footnotes_user, or something like that would add. Or possibly, like the current scheme for the default, it could check if footnotes.css has the GG2 header /* BEGIN {filename} */ - if it does, it's a replacement for the GG2 version, but if not, it's additional. Anyway - doesn't need to be decided immediately, of course.

in add_css_file, add support for project-supplied .css files
add project-supplied transcriber_note.css file
edit html_header.txt to no longer include transcriber note css
@arbayai

arbayai commented Oct 24, 2026

Copy link
Copy Markdown
Author

Merged cleanly with 2.1.8.
Split off .transnote into a project supplied file ../html/transcriber_note.css
Moved add_css_file to html_convert.
Generate HTML now adds transcriber_note.css. I started with this instead of footnotes because (a)there's no conditional needed and (b)for my projects, I use custom css for .transnote instead of the default.
This works as far as it goes. But poetry run pytest -q fails now, for obvious reasons. Updating the expected files won't really work, since prefsdir files override project-supplied .css files. I wonder if something like ignoring prefsdir for the purpose of that testing would be possible/reasonable? Then (a)expected wouldn't be affected by user .css and (b)additional tests could be added for conditionally-applied css (sidenotes, footnotes, etc.)
I haven't added project-supplied .css files to the css submenu yet, but I intend to.

@windymilla

Copy link
Copy Markdown
Collaborator

Merged cleanly with 2.1.8. Split off .transnote into a project supplied file ../html/transcriber_note.css Moved add_css_file to html_convert. Generate HTML now adds transcriber_note.css. I started with this instead of footnotes because (a)there's no conditional needed and (b)for my projects, I use custom css for .transnote instead of the default. This works as far as it goes.

Sounds good.

But poetry run pytest -q fails now, for obvious reasons. Updating the expected files won't really work, since prefsdir files override project-supplied .css files. I wonder if something like ignoring prefsdir for the purpose of that testing would be possible/reasonable? Then (a)expected wouldn't be affected by user .css and (b)additional tests could be added for conditionally-applied css (sidenotes, footnotes, etc.) I haven't added project-supplied .css files to the css submenu yet, but I intend to.

If I understand correctly there is already a mechanism for this situation: if you look at line 1177 in html_convert.py, it says:

if not is_test() and user_path.is_file():

It is deciding whether to use the user's header.txt file. When testing, we don't want the user's versions. So, I think at about L1207, you could add a call to is_test(), something like:

    css_filepath = (
        user_css_filepath if os.path.isfile(user_css_filepath) and not is_test() else default_css_filepath
    )

Is that what you need?

@windymilla

Copy link
Copy Markdown
Collaborator

I haven't added project-supplied .css files to the css submenu yet, but I intend to.

I would hold off on this feature for now. I don't really see the need for project specific CSS. If something is specific to a project, then the PPer can just put it in the header of the HTML file after autogeneration. That kind of thing typically needs you to view the book in the browser after autogeneration, then to customize the CSS, so it's better done in the actual HTML header, rather than an external file, I would have thought.

@srjfoo

srjfoo commented Oct 25, 2026

Copy link
Copy Markdown
Member

I haven't added project-supplied .css files to the css submenu yet, but I intend to.

I would hold off on this feature for now. I don't really see the need for project specific CSS. If something is specific to a project, then the PPer can just put it in the header of the HTML file after autogeneration. That kind of thing typically needs you to view the book in the browser after autogeneration, then to customize the CSS, so it's better done in the actual HTML header, rather than an external file, I would have thought.

I know I was initially thinking it would be good to have the option for project-specific CSS, but after re-thinking, I agree.

@arbayai

arbayai commented Oct 25, 2026

Copy link
Copy Markdown
Author

There might be some misunderstanding here, caused by my misuse of the word "project"? I want GG2-supplied css files (from ../data/html/), in addition to user-supplied css files, to be in the CSS submenu.
The use case seems clear to me, especially since I've been using it for some time prior to it being a pull request. Most always-added css just needs to be deleted later (because it's unused, and pphtml complains about that). Quite a bit of GG2-supplied css falls into that category, and it became even more of an issue as my own html_header.txt grew and grew. Adding css on an as-needed basis is better than adding it whether it's needed or not, since it means less deleting at the end, and also less noise to scroll through while working with a project.
The low-tech workaround is, instead of using prefsdir/html_header.txt, keep a separate file someplace with css in it, and copy/paste chunks from that into a project as needed.
A CSS submenu is a more convenient way of doing that.
GG2-supplied CSS can be added as-needed by the HTML Generate process, as can user-supplied overrides for that; but other user-supplied CSS cannot be added automatically. The options are: (a)add it regardless of need (via user's html_header.txt), (b)manually copy/paste from an external file as needed; (c)CSS submenu. (c) is the most convenient choice.
Including GG2-supplied CSS in the submenu means that CSS can be added as-needed after HTML Generate has run, e.g. to replace failed edits, for reference, for usage which HTML Generate didn't detect need for, etc.
Another benefit of the CSS submenu is it's discoverable. In the initial state, it'll only have GG2-supplied CSS, and be little-used. But a user who sees it might wonder if it can be customized to add their own CSS (yes!). Seeing the menu invites the user to solve the oversized user html_header.txt problem.
And of course users who don't want it aren't harmed by it. So I don't see the downside.

@windymilla

Copy link
Copy Markdown
Collaborator

There might be some misunderstanding here, caused by my misuse of the word "project"?

That was exactly it. I read "project" to mean a DP project (i.e. a book) and we don't need CSS on a per-book basis. Everything else you wrote makes complete sense, and I'm happy to go ahead with that plan. After the CSS has been split up a bit more, we'll get Sharon to do some testing on it.

@arbayai

arbayai commented Oct 25, 2026

Copy link
Copy Markdown
Author

There might be some misunderstanding here, caused by my misuse of the word "project"?

That was exactly it. I read "project" to mean a DP project (i.e. a book) and we don't need CSS on a per-book basis. Everything else you wrote makes complete sense, and I'm happy to go ahead with that plan. After the CSS has been split up a bit more, we'll get Sharon to do some testing on it.

Ok, good. I'd meant it as in, GG2 is a project (and the endtable I'm building is a project, etc.) but I totally get the confusion. Anyway I'll keep working towards something I can point to and say, here's what I mean...

And your response re: testing is just what I needed, thanks. It's obvious in hindsight; I was just going the long way round.

footnotes.css has been split off from html_header.txt; is applied on html autogenerate if needed
the css submenu includes gg2-supplied default css in addition to user-supplied css
if the user is fully overriding the html_header.txt with their own, gg2-supplied default css will not be used.
@arbayai

arbayai commented Nov 8, 2026

Copy link
Copy Markdown
Author

Merged with 3.19. Added some functionality we discussed earlier. footnotes.css is now added "if needed" during html generate, and gg2-supplied css files (currently just footnotes.css and transcriber_note.css) will show in the CSS submenu along with user-supplied css files.
Also thought a bit about people who totally override the html_header. They will be able to supply their own css files if they want, but they won't get gg2-supplied css. I think that's the closest match to current behavior. (e.g. they presumably have their own css for footnotes in their html_header.txt, if they want it, so automatically adding the project-supplied footnotes.css would not be desirable. But if they have split off their own footnotes.css, that will be added conditionally.)
Next step I think is picking some other css blocks should be split off from html_header.txt. That'd be things for which the need can be detected during html autogenerate, and things the user might just want to customize (maybe just transcriber_note.css, for now).
Also I want to dig into how the testing works... e.g. neither htmlconvert test has footnotes, and I'd like a test that will make sure that css gets added if needed.

@windymilla
windymilla self-requested a review November 8, 2026 12:17
@windymilla

Copy link
Copy Markdown
Collaborator

Merged with 3.19. Added some functionality we discussed earlier. footnotes.css is now added "if needed" during html generate, and gg2-supplied css files (currently just footnotes.css and transcriber_note.css) will show in the CSS submenu along with user-supplied css files.

Thanks @arbayai

Also thought a bit about people who totally override the html_header. They will be able to supply their own css files if they want, but they won't get gg2-supplied css. I think that's the closest match to current behavior. (e.g. they presumably have their own css for footnotes in their html_header.txt, if they want it, so automatically adding the project-supplied footnotes.css would not be desirable. But if they have split off their own footnotes.css, that will be added conditionally.)

Agreed

Next step I think is picking some other css blocks should be split off from html_header.txt. That'd be things for which the need can be detected during html autogenerate, and things the user might just want to customize (maybe just transcriber_note.css, for now).

I think this would be good to do, and then we can do some more thorough testing. Are these the blocks you were thinking of?

  • sidenote (similar to footnote)
  • ul.index & the li... classes below - used for index
  • poetry & associated classes
  • linenum - poetry line numbers
  • autoflex & toc - more complicated - since it could be used by the automatically generated ToC, but also by the AutoTable tool which the user might run at any point after HTML generation.
  • illustration classes - also more complicated, since added later by user, not during autogeneration

Also I want to dig into how the testing works... e.g. neither htmlconvert test has footnotes, and I'd like a test that will make sure that css gets added if needed.

As you can see, not much work has gone into maintaining the tests after my initial work to add them. I would suggest leaving this initially. After we've done some manual testing / tweaking, perhaps we could add new tests or improve the existing ones. I feel as though to do a proper job on enhancing the testing might be quite a bit of work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants