image links convention, table of contents fix

Also created a separate buttons page
This commit is contained in:
Dibyashanu Pati 2025-03-18 02:44:00 +05:30
parent 541da2397f
commit e5b69d15eb
8 changed files with 136 additions and 91 deletions

View file

@ -1,7 +1,6 @@
# cosmicflow.space # cosmicflow.space
This is the source code of the cosmicflow website This is the source code of the cosmicflow website
## How it works ## How it works
There is a main script called [](./create.sh) just cd into the cloned repository, and run it, this runs all other scripts and generates the static stite in the [](./public) directory. There is a main script called [](./create.sh) just cd into the cloned repository, and run it, this runs all other scripts and generates the static stite in the [](./public) directory.
@ -10,4 +9,23 @@ Ofcourse do not expect it to work as is. There are many things which have to be
cd cosmicflow cd cosmicflow
./create.sh ./create.sh
``` ```
## Images
Here are the link formats in org mode and how they are rendered
[[/absolute/path/with/no/content/someimg.imgextension]] - as a plain text href
[[relative/path/with/some/content/someimg.imgextension]] - as displayed as full width image
for more control use the #+HTML tag
## Table of Contents
For Table of Contents links to work it is for now necessary to add a custom id block like the follows for all headings to be linked
* Some heading
:PROPERTIES:
:CUSTOM_ID: some-heading
:END:
Note - for now the custom_id must be some-heading and not some_other_heading
# Latex
Use dvisvgm it looks better

7
content/buttons.org Normal file
View file

@ -0,0 +1,7 @@
#+Title: Buttons
#+attr_html: :width 81px :height 33px
#+BEGIN_buttons :width 81px :height 33px
#+HTML: <img src="../pics/CCLogoColorPop1.gif" alt="CC Logo" style="width: 88px; height: 31px;">
#+HTML: <img src="../pics/brainmade-88x31-dark.png" alt="brainmade.org" style="width: 88px; height: 31px;">
#+END_buttons

View file

@ -2,11 +2,15 @@
#+created: [2024-12-05 Thu] #+created: [2024-12-05 Thu]
#+last_modified: [2024-12-06 Fri] #+last_modified: [2024-12-06 Fri]
#+author: Dibyashanu Pati #+author: Dibyashanu Pati
#+OPTIONS: tex:dvipng #+OPTIONS: tex:dvisvgm
#+OPTIONS: \n:t #+OPTIONS: \n:t
#+OPTIONS: toc:2 #+OPTIONS: toc:2
* Union of Finite Countable Sets * Union of Finite Countable Sets
:PROPERTIES:
:CUSTOM_ID: union-of-finite-countable-sets
:END:
It is straight forward to show that the union of two countable set is countable. It is straight forward to show that the union of two countable set is countable.
Let $S_0$ and $S_1$ be two countable infinite sets(in case when either is finite the proof trivial), that is, Let $S_0$ and $S_1$ be two countable infinite sets(in case when either is finite the proof trivial), that is,
@ -34,6 +38,10 @@ Either using induction or using a similar argument with the naturals modulo $k$
$S = S_0 \cup S_1 \cup S_2 \hdots \cup S_k$. $S = S_0 \cup S_1 \cup S_2 \hdots \cup S_k$.
* Larger Unions? * Larger Unions?
:PROPERTIES:
:CUSTOM_ID: larger-unions
:END:
We know that an arbitrary union of countable sets is not necessarily countable. We know that an arbitrary union of countable sets is not necessarily countable.
Consider as a counterexample the union of all singletons $\{r\}, r \in \mathbb{R}$, this is $\mathbb{R}$ itself which we know not to be countable. Consider as a counterexample the union of all singletons $\{r\}, r \in \mathbb{R}$, this is $\mathbb{R}$ itself which we know not to be countable.
@ -55,11 +63,14 @@ The first time I encountered this it was supposed to be justified was by observi
Although this is convincing, a thought process that would lead me to come up with this eluded me until now, I explain this thought process below. Although this is convincing, a thought process that would lead me to come up with this eluded me until now, I explain this thought process below.
* The Argument * The Argument
:PROPERTIES:
:CUSTOM_ID: the-argument
:END:
In the modulo $k$ argument we have a constant gap between each consecutive element of a sequence, because of this we are limited by the gap size($k$). So the key idea is constructing such a partitioning of the Naturals is to keep increasing the gap size, but since the gap size is finite at any point we can only have elements from a finite number of the countably infinite sub-sequences at any particular, so we are forced to start subsequent sub-sequences at larger and larger points. In the modulo $k$ argument we have a constant gap between each consecutive element of a sequence, because of this we are limited by the gap size($k$). So the key idea is constructing such a partitioning of the Naturals is to keep increasing the gap size, but since the gap size is finite at any point we can only have elements from a finite number of the countably infinite sub-sequences at any particular, so we are forced to start subsequent sub-sequences at larger and larger points.
The most simple way to increase the gap size in this way is to keep increasing it by one after each gap. The most simple way to increase the gap size in this way is to keep increasing it by one after each gap.
[[pics/countable_union_of_countable_sets_is_countable.jpg][image 1]] [[../pics/countable_union_of_countable_sets_is_countable.jpg][image 1]]
Look at the $0^{th}$ sequence we just get the [[https://en.wikipedia.org/wiki/Triangular_number][Triangular numbers]] and zero. Look at the $0^{th}$ sequence we just get the [[https://en.wikipedia.org/wiki/Triangular_number][Triangular numbers]] and zero.
@ -169,6 +180,10 @@ Then
Since $S: \mathbb{N} \times \mathbb{N} \rightarrow \mathbb{N}$ is both injective and surjective, it is a bijection, we are done. Since $S: \mathbb{N} \times \mathbb{N} \rightarrow \mathbb{N}$ is both injective and surjective, it is a bijection, we are done.
* An Interesting Application * An Interesting Application
:PROPERTIES:
:CUSTOM_ID: an-interesting-application
:END:
*The set of finite subsets of $\mathbb{N}$ is countable.* *The set of finite subsets of $\mathbb{N}$ is countable.*
Let $A_i$ be set of all subsets of $\mathbb{N}$ containing $i$ elements, that is with cardinality $i$. Let $A_i$ be set of all subsets of $\mathbb{N}$ containing $i$ elements, that is with cardinality $i$.

View file

@ -4,6 +4,6 @@
#+author: Dibyashanu Pati #+author: Dibyashanu Pati
#+OPTIONS: tex:dvipng #+OPTIONS: tex:dvipng
[[pics/some_evenings_on_this_planet_are_worth_dying_for.jpg][Evening 26 January 2025]] [[../pics/some_evenings_on_this_planet_are_worth_dying_for.jpg][Evening 26 January 2025]]
*Some Evenings on this Planet are worth Dying for* - no matter how bleak things are otherwise, something shifts inside my brain when I see Venus peeking through the golden skies like this.. *Some Evenings on this Planet are worth Dying for* - no matter how bleak things are otherwise, something shifts inside my brain when I see Venus peeking through the golden skies like this..

View file

@ -14,4 +14,4 @@ What should we do if this happens?
/In such cases we do not surrender, *we resist*, we resist by *learning* !!/ /In such cases we do not surrender, *we resist*, we resist by *learning* !!/
#+end_quote #+end_quote
[[pics/we_do_not_surrender_we_resist.jpg][resist]] [[../pics/we_do_not_surrender_we_resist.jpg][resist]]

View file

@ -1,19 +0,0 @@
# Set the source and destination directories
src_dir="./public/cosmicflow-html"
src_pics_dir="./assets/pics/"
# Loop through each subdirectory
for dir in "$src_dir"/*; do
if [ -d "$dir" ]; then
dir_name=$(basename "$dir")
dst_pics_dir="${src_dir}/${dir_name}/pics"
# Create the destination subdirectory if it doesn't exist
if [ ! -d "$dst_pics_dir" ]; then
mkdir -p "$dst_pics_dir"
fi
# Use rsync to copy files starting with the subdirectory name as prefix
rsync -av --include="$dir_name*" --exclude="*" "${src_pics_dir}/" "${dst_pics_dir}/"
fi
done

View file

@ -64,6 +64,9 @@
"The URL for the site being generated.") "The URL for the site being generated.")
(defun my/site-header () (defun my/site-header ()
"Generate HTML for the header of the website."
;; Create the main structure of the site header.
(list `(header (@ (class "site-header")) (list `(header (@ (class "site-header"))
(div (@ (class "container")) (div (@ (class "container"))
(div (@ (class "site-title")) (div (@ (class "site-title"))
@ -74,49 +77,74 @@
(div (@ (class "container")) (div (@ (class "container"))
(nav (@ (class "nav")) (nav (@ (class "nav"))
(a (@ (class "nav-link") (href "/")) "<span style='color: #833F3F;'>Home</span>") " " ;; Home link
(a (@ (class "nav-link") (href "/exocortex/")) "<span style='color: #DE3163;'>Exocortex</span><sub style='font-size: 0.55em; color: red;'> requires javascript</sub>") " " (a (@ (class "nav-link") (href "/")) "<span style='color: #833F3F;'>Home</span>") " "
(a (@ (class "nav-link") (href "/blogs/")) "<span style='color: #3F833F;'>Blog</span>") " "
(a (@ (class "nav-link") (href "https://cosmicflow.space:3030/")) "<span style='color: #C0C0C0;'>Git</span><sub style='font-size: 0.6em; color: red'> clearweb</sub>") " "
(a (@ (class "nav-link") (href "http://git.cosmicflow.i2p/")) "<span style='color: #C0C0C0;'>Git</span><sub style='font-size: 0.6em; color: #e9ff33'> i2p</sub>") " "
(a (@ (class "nav-link") (href "http://pohnq5z43ok3tefj6v3qx2zgn7zinpf4s55kztqxifa2poc3oirpe2id.onion/")) "<span style='color: #C0C0C0;'>Git</span><sub style='font-size: 0.6em; color: #800080'> tor</sub>") " "
;; Exocortex link
(a (@ (class "nav-link") (href "/exocortex/")) "<span style='color: #DE3163;'>Exocortex</span><sub style='font-size: 0.55em; color: red;'> requires javascript</sub>") " "
;; Blog link
(a (@ (class "nav-link") (href "/blogs/")) "<span style='color: #3F833F;'>Blog</span>") " "
;; Git links
(a (@ (class "nav-link") (href "https://cosmicflow.space:3030/")) "<span style='color: #C0C0C0;'>Git</span><sub style='font-size: 0.6em; color: red'> clearweb</sub>") " "
(a (@ (class "nav-link") (href "http://git.cosmicflow.i2p/")) "<span style='color: #C0C0C0;'>Git</span><sub style='font-size: 0.6em; color: #e9ff33'> i2p</sub>") " "
(a (@ (class "nav-link") (href "http://pohnq5z43ok3tefj6v3qx2zgn7zinpf4s55kztqxifa2poc3oirpe2id.onion/")) "<span style='color: #C0C0C0;'>Git</span><sub style='font-size: 0.6em; color: #800080'> tor</sub>") " "
;; About link
(a (@ (class "nav-link") (href "/about/")) "<span style='color: #808080;'>About</span>") " " (a (@ (class "nav-link") (href "/about/")) "<span style='color: #808080;'>About</span>") " "
(a (@ (class "nav-link") (href "/contact/")) "<span style='color: #808080;'>PGP</span>") " "
(a (@ (class "nav-link") (href "/links/")) "<span style='color: #808080;'>Links</span>") " "
(a (@ (class "nav-link") (href "/gallery/")) "<span style='color: #808080;'>Gallery</span>") " " ;; contact link
(a (@ (class "nav-link") (href "/news/")) "<span style='color: #008080;'>News</span>"))))))) (a (@ (class "nav-link") (href "/contact/")) "<span style='color: #808080;'>PGP</span>") " "
;; Links link
(a (@ (class "nav-link") (href "/links/")) "<span style='color: #808080;'>Links</span>") " "
;; Gallery link
(a (@ (class "nav-link") (href "/gallery/")) "<span style='color: #808080;'>Gallery</span>") " "
;; Buttons link
(a (@ (class "nav-link") (href "/buttons/")) "<span style='color: #2e86c1;'>Buttons</span>") " "
;; News link
(a (@ (class "nav-link") (href "/news/")) "<span style='color: #008080;'>News</span>")))))))
(defun my/site-footer () (defun my/site-footer ()
"Generate HTML for the footer of the website."
(list `(footer (@ (class "site-footer")) (list `(footer (@ (class "site-footer"))
(div (@ (class "container")) (div (@ (class "container"))
(div (@ (class "row")) (div (@ (class "row"))
(div (@ (class "column")) (div (@ (class "column"))
(p (a (@ (href "/privacy_policy/")) "Privacy Policy")
(p
;; Privacy Policy link
(a (@ (href "/privacy_policy/")) "Privacy Policy")
" · " " · "
(a (@ (href "/credits/")) "Credits") ;; Credits link
(a (@ (href "/credits/")) "Credits")
" · " " · "
(a (@ (href "/attributions/")) "Attributions")
;; Attributions link
(a (@ (href "/attributions/")) "Attributions")
" · " " · "
(a (@ (href "https://cosmicflow.space:3030/DibyashanuPati/cosmicflow")) "Source Code (clearweb)")
;; Source Code links
(a (@ (href "https://cosmicflow.space:3030/DibyashanuPati/cosmicflow")) "Source Code (clearweb)")
" · " " · "
(a (@ (href "http://git.cosmicflow.i2p/DibyashanuPati/cosmicflow")) "Source Code (i2p)") (a (@ (href "http://git.cosmicflow.i2p/DibyashanuPati/cosmicflow")) "Source Code (i2p)")
" · " " · "
(a (@ (href "http://pohnq5z43ok3tefj6v3qx2zgn7zinpf4s55kztqxifa2poc3oirpe2id.onion/DibyashanuPati/cosmicflow")) "Source Code (tor)") (a (@ (href "http://pohnq5z43ok3tefj6v3qx2zgn7zinpf4s55kztqxifa2poc3oirpe2id.onion/DibyashanuPati/cosmicflow")) "Source Code (tor)")
(p "© 2024-2025 Dibyashanu Pati - <a href='https://creativecommons.org/licenses/by-sa/4.0/'>CC BY-SA 4.0</a> "
(img (@ (class "column align-left")
(src "/pics/CCLogoColorPop1.gif")
(style "width: 40px")
(alt "Creative Commons")))
(img (@ (class "column align-left")
(src "/pics/brainmade-88x31-dark.png")
(style "width: 60px")
(alt "brainmade.org")))
)
) ;; Copyright and license information
) (p "© 2024-2025 Dibyashanu Pati - <a href='https://creativecommons.org/licenses/by-sa/4.0/'>CC BY-SA 4.0</a> " ))))))))
)))))
(defun get-article-output-path (org-file pub-dir) (defun get-article-output-path (org-file pub-dir)
@ -170,12 +198,7 @@
(link (@ (rel "stylesheet") (href "/fonts/jetbrains-mono/jetbrains-mono.css"))) (link (@ (rel "stylesheet") (href "/fonts/jetbrains-mono/jetbrains-mono.css")))
(link (@ (rel "stylesheet") (href "/css/code.css"))) (link (@ (rel "stylesheet") (href "/css/code.css")))
(link (@ (rel "stylesheet") (href "/css/site.css"))) (link (@ (rel "stylesheet") (href "/css/site.css")))
;; (script (@ (defer "defer")
;; (data-domain "systemcrafters.net")
;; (src "https://plausible.io/js/plausible.js"))
;; ;; Empty string to cause a closing </script> tag
;; "")
;; ,(when head-extra head-extra)
(title ,(concat title " - Cosmicflow"))) (title ,(concat title " - Cosmicflow")))
(body ,@(unless exclude-header (body ,@(unless exclude-header
(my/site-header)) (my/site-header))
@ -209,37 +232,40 @@
(file-name-sans-extension (file-name-sans-extension
(org-element-property :path link))))) (org-element-property :path link)))))
;; (let ((exported-link (org-export-custom-protocol-maybe link contents 'html info))) (let ((exported-link (org-export-custom-protocol-maybe link contents 'html info)))
;; (cond (cond
;; (exported-link exported-link)
;; ((equal contents nil) ;; Check if there's an exported link available.
;; (format "<a href=\"%s\">%s</a>" ;; If a custom protocol handler returns a value, use it directly.
;; (org-element-property :raw-link link) (exported-link exported-link)
;; (org-element-property :raw-link link)))
;; ((string-prefix-p "/" (org-element-property :raw-link link)) ;; Check if the raw link starts with a slash, indicating it's an absolute path or URL.
;; (format "<a href=\"%s\">%s</a>" ;; this is checked before images so to display an image as an href provide absolute paths
;; (org-element-property :raw-link link) ((string-prefix-p "/" (org-element-property :raw-link link))
;; contents)) (format "<a href=\"%s\">%s</a>"
;; (t (org-export-with-backend 'html link contents info)))) (org-element-property :raw-link link)
(let ((exported-link (org-export-custom-protocol-maybe link contents 'html info))) contents))
(cond
(exported-link exported-link) ;; Check if the raw link is an image with no description
((equal contents nil) ;; If so display the image such that it occupies max-width
(format "<a href=\"%s\">%s</a>" ((and
(org-element-property :raw-link link) (string-match-p (concat "\\." (regexp-opt '("jpg" "jpeg" "png" "gif")))
(org-element-property :raw-link link))) (org-element-property :raw-link link))
((string-prefix-p "/" (org-element-property :raw-link link)) (not (equal contents nil)))
(format "<a href=\"%s\">%s</a>" (format "<img src=\"%s\" alt=\"%s\" style=\"max-width: 100%%; height: auto;\">"
(org-element-property :raw-link link) (org-element-property :raw-link link)
contents)) contents))
((and (string-match-p (concat "\\." (regexp-opt '("jpg" "jpeg" "png" "gif")))
(org-element-property :raw-link link)) ;; Check if there are no contents to display and use the raw link as both href and text.
(not (equal contents nil))) ((equal contents nil)
(format "<img src=\"%s\" alt=\"%s\" style=\"max-width: 100%%; height: auto;\">" (format "<a href=\"%s\">%s</a>"
(org-element-property :raw-link link) (org-element-property :raw-link link)
contents)) (org-element-property :raw-link link)))
(t (org-export-with-backend 'html link contents info))))
)
;; Default case: use the default export backend to handle the link.
(t (org-export-with-backend 'html link contents info))))
)
(defun my/make-heading-anchor-name (headline-text) (defun my/make-heading-anchor-name (headline-text)

View file

@ -12,6 +12,4 @@ emacs -Q --batch -l create-site.el
# Generate the exocortex # Generate the exocortex
./build_exocortex.sh ./build_exocortex.sh
# Copy relavent pics to blog subdirectories
./copy-pics.sh