reschke / xml2rfc

A formatter for the "xml2rfc" vocabulary, implemented in XSLT.
12 stars 5 forks source link

Replacement CSS #19

Closed martinthomson closed 4 years ago

martinthomson commented 4 years ago

The python xml2rfc offers a --css option that it reads and uses to provide CSS for the output HTML. This would be a very useful facility for me as I don't find that the default stylesheet meets my needs.

reschke commented 4 years ago

So the generated HTML would just have a link to the CSS?

The main issue here is that the details of CSS classes are not standardized yet, so it's really not possible to replace the CSS and keep it possible to develop it further...

And yes, it's a goal to align with the class names used by xml2rfc, so CSS becomes interchangeable, but we're not there yet.

reschke commented 4 years ago

See https://github.com/reschke/xml2rfc/commit/be0379a8e8e4af58b362c53abf84f88a704626b9

martinthomson commented 4 years ago

Thanks Julian, this is awesome. I'll try it out.

reschke commented 4 years ago

Note that it requires XSLT 2 (XSLT 1 can only read external XML).

martinthomson commented 4 years ago

Yeah, I just hit that. I'm stuck on xsltproc which can't handle this. Is it possible to take the value of the parameter as the CSS contents? As in rather than

xsltproc --stringparam xml2rfc-ext-css style.css ...

I could do

xsltproc --stringparam xml2rfc-ext-css "$(cat style.css)" ...
reschke commented 4 years ago

That should be possible.

reschke commented 4 years ago

Try https://github.com/reschke/xml2rfc/commit/79db07377dff05d59ac49544c7a106db9b963b03 and the parameter "xml2rfc-ext-css-contents".

martinthomson commented 4 years ago

That worked brilliantly. Thanks!

reschke commented 4 years ago

You're welcome. Please keep in mind though that class names may not be stable.

If you have CSS changes that you believe should go into the builtin CSS, by all means let me know.

martinthomson commented 4 years ago

I need to spend some time refining the stylesheet, but I think that I would ultimately want to propose something akin to what I'm using for the python xml2rfc (see QUIC for an example of that).