Skip to content

Commit

Permalink
docs(rtd): separate active from archived projects (#436)
Browse files Browse the repository at this point in the history
  • Loading branch information
ReenigneArcher authored Mar 3, 2025
1 parent 69fa783 commit faa169e
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 26 deletions.
54 changes: 34 additions & 20 deletions docs/source/_static/js/projects.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,30 +64,44 @@ $(document).ready(function() {
let projects = []

for (let i in data) {
// add the project to the dictionary
projects.push(
{
'name': data[i]['child']['name'],
'name_lower': data[i]['child']['name'].toLowerCase(),
'url': data[i]['child']['urls']['documentation']
// check if the project is archived
let archived = false
for (let tag in data[i]['child']['tags']) {
if (data[i]['child']['tags'][tag] === "archived") {
archived = true
}
)
}

// create a new project dictionary
let project = {
'name': data[i]['child']['name'],
'name_lower': data[i]['child']['name'].toLowerCase(),
'url': data[i]['child']['urls']['documentation'],
'archived': archived
}

// add the project to the list
projects.push(project)
}

// sort the projects by name
let sorted = projects.sort(rankingSorter('name_lower', 'name')).reverse()

for (let i in sorted) {
// create a new list item
let project_list_item = document.createElement("li")
project_list.appendChild(project_list_item)

// create a new link
let project_list_item_link = document.createElement("a")
project_list_item_link.href = sorted[i]['url']
project_list_item_link.target = "_blank"
project_list_item_link.textContent = sorted[i]['name']
project_list_item.appendChild(project_list_item_link)
let sorted_projects = projects.sort(rankingSorter('name_lower', 'name')).reverse()

for (let a of [false, true]) {
for (let i in sorted_projects) {
if (sorted_projects[i]['archived'] === a) {
// create a new list item
let project_list_item = document.createElement("li")
project_list.appendChild(project_list_item)

// create a new link
let project_list_item_link = document.createElement("a")
project_list_item_link.href = sorted_projects[i]['url']
project_list_item_link.target = "_blank"
project_list_item_link.textContent = sorted_projects[i]['name'] + (a ? " (Archived)" : "")
project_list_item.appendChild(project_list_item_link)
}
}
}
}

Expand Down
7 changes: 1 addition & 6 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
# standard imports
from datetime import datetime
import os
import sys

# -- Path setup --------------------------------------------------------------

Expand All @@ -19,17 +18,13 @@
source_dir = os.path.dirname(script_dir) # the source folder directory
root_dir = os.path.dirname(source_dir) # the root folder directory

sys.path.append(script_dir)
if script_dir:
import version

# -- Project information -----------------------------------------------------
project = 'LizardByte'
project_copyright = f'{datetime.now().year}, {project}'
author = 'ReenigneArcher'

# The full version, including alpha/beta/rc tags
version = version.version
version = os.getenv('READTHEDOCS_VERSION', 'latest')

# -- General configuration ---------------------------------------------------

Expand Down

0 comments on commit faa169e

Please sign in to comment.