Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand utility classes #13

Merged
merged 6 commits into from
Oct 23, 2021
Merged

Conversation

jason-fox
Copy link
Collaborator

You might want to consider this as part of #12 once #11 has landed.

It splits out as many hard-coded magic numbers into an <xsl:attribute-set> in the same fashion as the PDF transform

@infotexture infotexture marked this pull request as draft August 23, 2021 22:17
@infotexture infotexture added this to the 5.3 milestone Aug 23, 2021
@infotexture
Copy link
Owner

Marked as Draft for now, as we'll want to rebase this onto develop now that #11 has been merged.

🤔 Not sure I get the intention of using attribute sets like in the PDF plug-in here.

I think it's good to make things easier to customize, but doesn't this just change the file in which the values must be changed?

@jason-fox jason-fox changed the title Add cfg/attrs/bootstrap-attrs.xsl Expand utility classes Aug 24, 2021
@jason-fox
Copy link
Collaborator Author

jason-fox commented Aug 24, 2021

I've had a rethink, and it looks like the existing DITA-OT mode="get-output-class" already provides most of what is needed. The utility-classes.xsl should hold the magic numbers so you can apply common bootstrap styling to bootstrap elements. For example making all your card elements w-50 or indenting the tabbed dialog or adding a background or changing the default Warning alert bootstrap icon to a bi-emoji-smilesmiley face 😄 (or changing all of them if you want to use a different icon set or ... etc.

The PR just collects all the relevant bootstrap CSS styles into one single file rather than scattering them across all the xsl stylesheets, which makes the values easier to maintain and update.

@jason-fox jason-fox marked this pull request as ready for review August 24, 2021 08:09
@jason-fox
Copy link
Collaborator Author

jason-fox commented Aug 24, 2021

For example, the "default" DITA Bootstrap uses text-dark for all of the headers (this aligns with Bootstrap itself, since the bright blue looks very jarring. But the current DITA-OT documentation uses text-primary for all of the headers (since the dark blue looks much better.) It doesn't make sense to annotate every <title> DITA element with output-class="text-primary", it would be much easier to do this on the command line like:

./dita -f html5-bootstrap \
    -i ../plugins/dita-bootstrap/sample/document.ditamap \
    --bootstrap.css.header=text-primary

Example: Plugins for DITA Open Toolkit

Similarly you can change the margins and add a border on all vertical tabbed dialogs with:

./dita -f html5-bootstrap \
    -i ../plugins/dita-bootstrap/sample/document.ditamap \
    --bootstrap.css.tabs.vertical="border m-5"

Similarly, the "default" bootstrap uses rounded corners for boxes so the codeblocks should also be annotated with utility classes to provide rounded corners border rounded, but if the theme uses sharp corners, the rounded addition will be unnecessary:

./dita -f html5-bootstrap \
   -i ../plugins/dita-bootstrap/sample/document.ditamap \
   --bootstrap.css.codeblock=border

Remove the need for duplicate outputclass
Copy link
Owner

@infotexture infotexture left a comment

Choose a reason for hiding this comment

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

Sorry this was stuck in the review queue for so long, but I think the ability to pass additional Bootstrap classes via CLI parameters is useful, so I'll merge this. 👍

We'll probably want to add a few more examples to the README based on #13 (comment), but I can handle that along with the other release prep tasks in #12.

@infotexture infotexture merged commit b82f375 into infotexture:develop Oct 23, 2021
@infotexture infotexture added this to Done in 5.3 Oct 24, 2021
@jason-fox jason-fox deleted the feature/attrs branch January 20, 2022 07:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
5.3
Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants