Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

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

David Rosa4b8c99b01ac5
diff --git a/web/src/portico/help.js b/web/src/portico/help.js
index f743f9e6ec0..ec536c0468c 100644
--- a/web/src/portico/help.js
+++ b/web/src/portico/help.js
@@ -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));
});
diff --git a/web/src/portico/tabbed-instructions.ts b/web/src/portico/tabbed-instructions.ts
index f8cd20113e0..ccf65b5c57e 100644
--- a/web/src/portico/tabbed-instructions.ts
+++ b/web/src/portico/tabbed-instructions.ts
@@ -67,6 +67,6 @@ export function activate_correct_tab($codeSection: JQuery): void {
}
}
-$(".code-section").each(function () {
+$(".tabbed-section").each(function () {
activate_correct_tab($(this));
});
diff --git a/web/styles/portico/markdown.css b/web/styles/portico/markdown.css
index 31ca652b60f..09fdf9e4db1 100644
--- a/web/styles/portico/markdown.css
+++ b/web/styles/portico/markdown.css
@@ -419,7 +419,7 @@
}
}
- .code-section {
+ .tabbed-section {
& ol {
margin-left: 15px;
margin-top: 10px;
diff --git a/web/styles/portico/portico.css b/web/styles/portico/portico.css
index 9ef916cb329..da270c5aea4 100644
--- a/web/styles/portico/portico.css
+++ b/web/styles/portico/portico.css
@@ -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%);
}
diff --git a/zerver/lib/html_to_text.py b/zerver/lib/html_to_text.py
index d23ba2d673f..7094bc05525 100644
--- a/zerver/lib/html_to_text.py
+++ b/zerver/lib/html_to_text.py
@@ -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 = ""
diff --git a/zerver/lib/markdown/tabbed_sections.py b/zerver/lib/markdown/tabbed_sections.py
index 693c636715e..7012a405cbf 100644
--- a/zerver/lib/markdown/tabbed_sections.py
+++ b/zerver/lib/markdown/tabbed_sections.py
@@ -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
)
diff --git a/zerver/tests/test_templates.py b/zerver/tests/test_templates.py
index 7c658585bd0..65fe457ea61 100644
--- a/zerver/tests/test_templates.py
+++ b/zerver/tests/test_templates.py
@@ -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>