Closed VerzatileDev closed 8 months ago
With the following the layout of the page is as follows:
The Current has two available
Though note with this both of these will be available if enabled by inspector, but for the default user it would display it as one, which is enabled locally otherwise uses the default first value as to what is displayed.
Which is modified to enable or disable by the following Script
Script has been listed for global use under "asssets/js/script.. " can be called by using the command include_programming_language_switch_script: true
Within the .md file file as an example:
---
layout: default
title: OOP
nav_order: 1
parent: Concepts
has_children: false
include_programming_language_switch_script: true
---
Other dependencies of the page is a requirement to select the following buttons:
<button onclick="setLanguageAndShowContent('cpp')">C++</button>
<button onclick="setLanguageAndShowContent('csharp')">C#</button>
<button onclick="setLanguageAndShowContent('python')">Python</button>
Which must include a "
<div id="cppContent">
<!-- Your default C++ content goes here -->
This is C++ content for Object-Oriented Programming.
</div>
<div id="csharpContent" style="display:none;">
<!-- Your C# content goes here -->
This is C# content for Object-Oriented Programming.
</div>
<div id="pythonContent" style="display:none;">
<!-- Your C# content goes here -->
This is python content for Object-Oriented Programming.
</div>
NOTE:
You can specify any amount from 0 to 3 If the button is not added with the div ID then it will display none; if there is content added and it is currently active it will display as block;
As for example you can use: Only python, or only cpp, or only csharp, or neither of them all even when the script it enabled.
<div id="pythonContent" style="display:none;">
The specified must be listed with these exact words for ID
As these specifications are defined within the -> programmingLanguageSwitch.js
with the following
var contentMap = {
'cpp': 'cppContent',
'csharp': 'csharpContent',
'python': 'pythonContent'
};
Functionality of the feature:
++ PLEASE Read the changes carefully and comments specified under the post ++
[ADDRESSING] - @JDSherbert
Discussion in Issue " #25 ":
In this issue, it was discussed that while the current "Concepts" folder contains examples, there's a need to enhance it by including examples in different languages instead of defaulting to the easiest option. This is particularly relevant where certain languages do not utilize specific concepts, like Object-Oriented Programming (OOP).
Key points of discussion in Issue " #25 " include:
Default Language for Examples:
Folder Structure and Organization:
Implementation of Multiple Language Examples on the Same Page:
The following example implementation aims to address the aforementioned points:
Please note:
Has Been fully addressed in https://github.com/VerzatileDevOrg/Programming_HandBook/pull/68#issuecomment-1878000975