Thanks to T215165, it is now possible to define CSS styles in the Index namespace, that will then automatically be included in the Page namespace and in its transclusions.
However, the generated styles don't work inside the ".references" element, because references are not part of the ".prp-pages-output" element.
Description
Status | Subtype | Assigned | Task | ||
---|---|---|---|---|---|
Open | None | T276067 Get per-work CSS working properly | |||
Open | BUG REPORT | None | T305792 Allow per-work CSS inside references |
Event Timeline
@Candalua Do you have a page exhibiting this problem? And do you mean .prp-pages-output or .mw-parser-output (to which TemplateStyles are normally scoped)?
@Xover in this page: https://it.wikisource.org/wiki/Pagina:Parlamento_subalpino_-_Atti_parlamentari,_1853-54,_Documenti.pdf/13 the annotation contains a table with class tab1. In page namespace, at table level I get the following styles:
.mw-parser-output .pagetext .tab1 { width: 100%; border-collapse: collapse; }
In the transclusion: https://it.wikisource.org/wiki/Modificazione_alla_convenzione_Laffitte_per_la_concessione_della_strada_ferrata_Vittorio_Emanuele_di_Savoia/Modificazione_e_progetto_di_legge the styles are missing.
The appearance is the same, because some styles have been added inline to circumvent the problem.
Oh, indeed. Normal TableStyles are scoped to .mw-parser-output, but Index:-styles are scoped additionally to .prp-pages-output in mainspace and .pagetext in the Page: namespace. In Page: namespace the whole content (including header/footer) is contained within .pagetext and so it works fine. But in mainspace the rendered references are not mediated through Proofread Page (it uses Cite directly) and so are not contained within .prp-pages-output and the selectors cannot match.
This ought to mean (I haven't checked) that no Index:-styles can ever affect the content of references.
This is set in PagesTagParser.php:233 and I'm guessing just out of an abundance of caution, or at least I can't think of any reason for this extra scoping.
@Inductiveload / @Tpt: I think the scoping selector can just be removed from the call to getIndexTemplateStyles() but maybe there was a reason you had it in the initial implementation?