docuapi
docuapi copied to clipboard
Multiple languages by tab
Fix #54
I realize this PR is not very elegant yet.
The body data attributes are now a list of all languages including "otherlangs", and a list by tab of languages to go with the main language.
<body class="index" data-languages='[ "go" , "java" , "javascript" , "python" , "ruby" , "shell" ]' data-withgo='[ "go" ]' data-withshell='[ "shell" ]' data-withruby='[ "ruby" ]' data-withpython='[ "python" ]' data-withjavascript='[ "javascript" , "java" ]'>
It now works
-
in the JavaScript tab one sees both Java and JavaScript,
-
JSON is in all tabs.
I suppose the CSS could also be tinkered with (to add spacing between languages), but that is probably best kept for custom CSS.
Something like
content pre {
margin-top: 20px;
}
This PR can only handle one otherlangs (i.e. I'll need to add for loops for maps in otherlangs)
In this PR there is now
- tweaks to baseof.html to store more data attributes related to languages.
- changes in _lang.js to show more than one language per tab
- changes in exampleSite to exemplify the features
- changes in the styles.html partial to be able to add custom CSS because I couldn't find a variable to override to add some margin before pre elements.
I'm not sure whether any of this might be useful to add to the theme, but if some of it is, happy to incorporate feedback & to document stuff.