-
Notifications
You must be signed in to change notification settings - Fork 10
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
RTL support #45
RTL support #45
Conversation
Stable bootstrap 5.2.0 has released. Updated CDN to use 5.2.0 and 5.2.0 RTL CSS |
- load alternate Bootstrap CSS - Amend collapsible CSS - Update Nav.xsl to encode images and links in a RTL friendly manner
5c1727a
to
9bd28ee
Compare
Signed-off-by: Roger Sheen <roger@infotexture.net>
build_dita2html5-bootstrap.xml
Outdated
<matches | ||
string="${default.language}" | ||
pattern="((ar|arc|bcc|bqi|ckb|dv|fa|glk|he|lrc|mzn|pnb|ps|sd|ug|ur|yi)(\-|$))" | ||
/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this automatically be applied if the xml:lang
attribute is set to one of the corresponding values in the DITA source, or would the user need to change something else to trigger RTL rendering?
Shall we document that somewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bootstrap LTR or RTL CSS is usually an all or nothing affair. The Bootstrap docs are here Either the whole page of components is displayed RTL or the whole page of components is displayed LTR there is no facility yet to reduce this to the xml:lang
attribute level. using the default CSS. This is the reason why the load occurs on the default.language
level.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking into this more deeply, it gets a bit more complex. I've added some RTL documentation 89bbcf4 to explain how it works. The problem is that the first topic usually sets the layout for the whole HTML page, which is fine for mono-lingual documents, but may not be what you want for multi-lingual docs. The question is does the nav go on the left or the right in these cases?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added some RTL documentation 89bbcf4 to explain how it works.
👍 Thanks, that definitely helps.
We might want to change this topic's position in the ToC though (see related code comment).
The problem is that the first topic usually sets the layout for the whole HTML page, which is fine for mono-lingual documents, but may not be what you want for multi-lingual docs. The question is does the nav go on the left or the right in these cases?
I'm not sure of the conventions w/r/t ToC placement in RTL docs, but we might be able to get away with the first topic setting that.
If a docset is mostly English with a bit of Arabic, keeping the ToC on the left seems “right”.
If docs contain mostly RTL languages, readers may prefer the ToC on the right, even if they contain bits of LTR text.
Customization/xsl/topic.xsl
Outdated
@@ -20,6 +23,17 @@ | |||
|
|||
<xsl:template match="*" mode="addContentToHtmlBodyElement"> | |||
<main xsl:use-attribute-sets="main"> | |||
<xsl:if test="$BIDIRECTIONAL_DOCUMENT = 'yes'"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<xsl:if test="$BIDIRECTIONAL_DOCUMENT = 'yes'"> | |
<xsl:if test="$BIDIRECTIONAL_DOCUMENT = 'yes'"> |
sample/document.ditamap
Outdated
@@ -12,6 +12,7 @@ | |||
<navtitle>Getting Started</navtitle> | |||
</topicmeta> | |||
<topicref navtitle="Introduction" format="dita" href="index.dita"/> | |||
<topicref navtitle="RTL" format="dita" href="rtl.dita"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since RTL support may not be the first thing everyone needs, should we move this down to the next section (Layout) instead?
I realize the grid system and RTL are not directly related, but some might think of this as “RTL layout”.
Thoughts? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed 5666b38
Apart from the comments above, I think this is shaping up nicely. I'd be inclined to merge this soon and spawn a release branch to package up a 5.3.2 release, so we can ship the features you've added this summer. I'd do a final round of proofreading on the latest doc updates, but that shouldn't take long. — Or is there anything else you'd like to add for 5.3.2? We can always tweak further for 5.3.3, and ship the improvements with dark mode once Bootstrap 5.3 is ready. |
@jason-fox Also, this: #46 (comment)
|
Co-authored-by: Roger Sheen <roger@infotexture.net>
Co-authored-by: Roger Sheen <roger@infotexture.net>
Co-authored-by: Roger Sheen <roger@infotexture.net>
Co-authored-by: Roger Sheen <roger@infotexture.net>
Agreed. Dark Mode won't work until a proper Bootstrap 5.3 is released, the current draft doesn't work with 5.2, only with an experimental CSS. I think I have applied the suggestions. Please proofread and release. |
Again looking even further I think I have fixed this now, if
If a docset is mostly English with a bit of Arabic, use |
Bootstrap 5.2.0 brings full support for RTL languages like Arabic