lektor / lektor-atom

Lektor Atom plugin.
30 stars 13 forks source link

Fix #10 #36

Closed dairiki closed 3 years ago

dairiki commented 3 years ago

Here is a fix for #10.

The issue is that AtomFeedSource.iter_source_filenames (inherited from lektor.sourceobj.VirtualSourceObject) only returns the single primary source file for the virtual source. As a result, the resulting artifact for the feed in the build-state database gets only one primary source file.

I.e. (assuming alt=en) both blog/contents+en.lr and blog/contents.lr should be listed as primary source files. As things were, only the alternative-specific blog/contents+en.lr was being listed as a primary source. (Artifacts get pruned if none of their primary source files exist.)


Questions

I'm not quite sure that this fix really belongs here in AtomFeedSource. Maybe it should moved up to lektor.sourceobj.VirtualSourceObject.iter_source_filenames?

dairiki commented 3 years ago

Note CI tests are broken because of changes in lektor 3.2. See #35.

dairiki commented 3 years ago

Questions

I'm not quite sure that this fix really belongs here in AtomFeedSource. Maybe it should moved up to lektor.sourceobj.VirtualSourceObject.iter_source_filenames?

Having thought about this overnight, I'm pretty convinced that the "proper" place to fix this is in VirtualSourceObject.

Given that, currently, VirtualSourceObject delegates the source_filename property to their parent record, it seems only reasonable to similarly delegate iter_source_filenames. I.e., by default*, all virtual sources should have all the same source filenames as their parent record.

That said, I see nothing wrong with fixing things here in lektor-atom as well. Especially since that's the only way to fix things when running under current (or older) versions of Lektor.


* VirtualSourceObject is an abstract base class. As such, it provides reasonable default behaviors for virtual source objects. Concrete implementations are always free to override such defaults.