From 0b2d10a11c4468bff3f4adc792572a56b4be2e6e Mon Sep 17 00:00:00 2001
From: Deepak Khatri <lorforlinux@beagleboard.org>
Date: Thu, 26 Sep 2024 18:28:28 +0530
Subject: [PATCH] Setup books and projects PDF build

---
 conf.py  | 38 +++++++++++++++++++++++++++++++++++++-
 conf.yml | 20 ++++++++++++++++++++
 2 files changed, 57 insertions(+), 1 deletion(-)

diff --git a/conf.py b/conf.py
index 0820c8c4..518bba25 100644
--- a/conf.py
+++ b/conf.py
@@ -42,6 +42,8 @@ latex_documents = []
 pdf_paths = []
 oshw_details = []
 board_details = []
+book_details = []
+project_details = []
 
 with open('conf.yml', 'r') as conf_file:
     conf_data = yaml.safe_load(conf_file)
@@ -79,7 +81,39 @@ with open('conf.yml', 'r') as conf_file:
                             oshw_details.append([board, path, oshw_id])
                 
                 # Board basic details
-                board_details.append([board, path, page, git, forum])
+                board_details.append([name, path, page, git, forum])
+        
+        # Books
+        if(type == "books"):
+            for book, data in conf_data["books"].items():
+                name = book
+                path = data['path']
+                pdf = data.get('pdf', False)
+
+                #Books PDF build details
+                if(pdf and (name in pdf_build or pdf_build_all)):
+                    pdf_paths.append(path)
+                    tex_name = '-'.join(path.split('/')[1:])
+                    latex_documents.append((path+"/index", tex_name+".tex", "", author, "manual"))
+
+                # Book basic details
+                book_details.append([name, path])
+
+        # Projects
+        if(type == "projects"):
+            for book, data in conf_data["projects"].items():
+                project = book
+                path = data['path']
+                pdf = data.get('pdf', False)
+
+                #Projects PDF build details
+                if(pdf and (project in pdf_build or pdf_build_all)):
+                    pdf_paths.append(path)
+                    tex_name = '-'.join(path.split('/')[1:])
+                    latex_documents.append((path+"/index", tex_name+".tex", "", author, "manual"))
+
+                # Project basic details
+                project_details.append([name, path])
 
 # -- General configuration --
 
@@ -348,6 +382,8 @@ html_context = {
     "oshw_details": oshw_details,
     "pdf_paths": pdf_paths,
     "board_details": board_details,
+    "book_details": book_details,
+    "project_details": project_details,
     "announcement_message": announcement_message,
     "development_version_message": development_version_message,
     "forked_version_message": forked_version_message,
diff --git a/conf.yml b/conf.yml
index fafee261..3c2011e4 100644
--- a/conf.yml
+++ b/conf.yml
@@ -92,5 +92,25 @@ boards:
       oshw: PocketBeagle_US000083.svg
 
 # Books
+books:
+   BeagleBone-Cookbook:
+      path: books/beaglebone-cookbook
+      pdf: True
+   PRU-Cookbook:
+      path: books/pru-cookbook
+      pdf: True
 
 # Projects
+projects:
+   BB-Config:
+      path: projects/bb-config
+      pdf: True
+   BeagleConnect:
+      path: projects/beagleconnect
+      pdf: True
+   libRobotControl:
+      path: projects/librobotcontrol
+      pdf: True
+   SimpPRU:
+      path: projects/simppru
+      pdf: True
\ No newline at end of file
-- 
GitLab