You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using an existing theme, but did some very small modifications by copying some templates using 'theme -c' and editing them.
Over time the theme might be updated and it would be great to a) be able to see if there are updates available and b) see the diffs between my templates and the original theme.
I can do the diffs manually using git, e.g. delete the file in the themes directory, do a new 'theme -c' , and then run git diff, but I would need to do this for every single file and then also checkout the original file again. Perhaps a 'nikola theme diff' would be an option?
Another suggestion/question: when I use '--parent=' to specify a non-base theme for the '-c' command is there a way to find out where the file came from? For git tracked themes, it would be great to have the git version and url in the header of custom templates, so that one can figure out where they came from and perhaps manually can look for updates in the theme;)
The text was updated successfully, but these errors were encountered:
I might give this a try. As far as I understand a custom template does have the parent defined and so it shouldn't be too hard to run a diff over all files, perhaps using the python built-in difflib module. One thing I'm not sure about is how the command would be best implemented. I assume it would go into plugin/command/theme.py ? Would one also create a diff task that compare two files and then have theme.py issue a task for each custom template? Or just do everything in theme.py?
arunpersaud
pushed a commit
to arunpersaud/nikola
that referenced
this issue
Mar 7, 2025
Think I got it working. I'm iterating over all custom templates and using the built-in functions to find the correct version in a given theme to compare to and then just use difflib to print the changes.
I'm using an existing theme, but did some very small modifications by copying some templates using 'theme -c' and editing them.
Over time the theme might be updated and it would be great to a) be able to see if there are updates available and b) see the diffs between my templates and the original theme.
I can do the diffs manually using git, e.g. delete the file in the themes directory, do a new 'theme -c' , and then run git diff, but I would need to do this for every single file and then also checkout the original file again. Perhaps a 'nikola theme diff' would be an option?
Another suggestion/question: when I use '--parent=' to specify a non-base theme for the '-c' command is there a way to find out where the file came from? For git tracked themes, it would be great to have the git version and url in the header of custom templates, so that one can figure out where they came from and perhaps manually can look for updates in the theme;)
The text was updated successfully, but these errors were encountered: