widgets: Rename confusing attribute name in `tabbed_sections.py`.

Renames misleading attribute in HTML template using `code-section`
to refer to both language toggles in API docs and app toggles in
help center docs.
This commit is contained in:
David Rosa 2023-08-29 15:58:01 -07:00 committed by Tim Abbott
parent 6e647f12bd
commit 4b8c99b01a
7 changed files with 12 additions and 12 deletions

View File

@ -77,7 +77,7 @@ function add_copy_to_clipboard_element($codehilite) {
}
function render_tabbed_sections() {
$(".code-section").each(function () {
$(".tabbed-section").each(function () {
activate_correct_tab($(this));
register_tabbed_section($(this));
});

View File

@ -67,6 +67,6 @@ export function activate_correct_tab($codeSection: JQuery): void {
}
}
$(".code-section").each(function () {
$(".tabbed-section").each(function () {
activate_correct_tab($(this));
});

View File

@ -419,7 +419,7 @@
}
}
.code-section {
.tabbed-section {
& ol {
margin-left: 15px;
margin-top: 10px;

View File

@ -64,7 +64,7 @@ html {
/* The API tabbed content tends to have a lot of code blocks,
which look nicer against a different background */
.api-center .code-section {
.api-center .tabbed-section {
.blocks {
background-color: hsl(0deg 0% 98%);
}

View File

@ -16,8 +16,8 @@ def html_to_text(content: Union[str, bytes], tags: Mapping[str, str] = {"p": " |
for tag in bs.find_all("div", class_="admonition"):
tag.clear()
# Skip code-sections, which just contains navigation instructions.
for tag in bs.find_all("div", class_="code-section"):
# Skip tabbed-sections, which just contain navigation instructions.
for tag in bs.find_all("div", class_="tabbed-section"):
tag.clear()
text = ""

View File

@ -11,8 +11,8 @@ START_TABBED_SECTION_REGEX = re.compile(r"^\{start_tabs\}$")
END_TABBED_SECTION_REGEX = re.compile(r"^\{end_tabs\}$")
TAB_CONTENT_REGEX = re.compile(r"^\{tab\|\s*(.+?)\s*\}$")
CODE_SECTION_TEMPLATE = """
<div class="code-section {tab_class}" markdown="1">
TABBED_SECTION_TEMPLATE = """
<div class="tabbed-section {tab_class}" markdown="1">
{nav_bar}
<div class="blocks">
{blocks}
@ -131,7 +131,7 @@ class TabbedSectionsPreprocessor(Preprocessor):
]
nav_bar = self.generate_nav_bar(tab_section)
content_blocks = self.generate_content_blocks(tab_section, lines)
rendered_tabs = CODE_SECTION_TEMPLATE.format(
rendered_tabs = TABBED_SECTION_TEMPLATE.format(
tab_class=tab_class, nav_bar=nav_bar, blocks=content_blocks
)

View File

@ -36,7 +36,7 @@ header
<h1 id="heading">Heading</h1>
<p>
<div class="code-section has-tabs" markdown="1">
<div class="tabbed-section has-tabs" markdown="1">
<ul class="nav">
<li data-tab-key="ios" tabindex="0">iOS</li>
<li data-tab-key="desktop-web" tabindex="0">Desktop/Web</li>
@ -54,7 +54,7 @@ header
<h2 id="heading-2">Heading 2</h2>
<p>
<div class="code-section has-tabs" markdown="1">
<div class="tabbed-section has-tabs" markdown="1">
<ul class="nav">
<li data-tab-key="desktop-web" tabindex="0">Desktop/Web</li>
<li data-tab-key="android" tabindex="0">Android</li>
@ -72,7 +72,7 @@ header
<h2 id="heading-3">Heading 3</h2>
<p>
<div class="code-section no-tabs" markdown="1">
<div class="tabbed-section no-tabs" markdown="1">
<ul class="nav">
<li data-tab-key="instructions-for-all-platforms" tabindex="0">Instructions for all platforms</li>
</ul>