Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
abjarna committed Jun 5, 2024
1 parent da1cf26 commit 955ccf0
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 63 deletions.
52 changes: 23 additions & 29 deletions rit/_templates/rubik-pdf.html
Original file line number Diff line number Diff line change
@@ -1,39 +1,33 @@
<div class="tocsection sourcelink">
<div class="tocsection sourcelink" data-depth="{{ html_page_depth }}" data-subfolder="{{ html_subfolder }}">
<a id="pdf-link" href="#" style="display: inline-block; padding: 0; margin: 0; line-height: 1.5; vertical-align: middle;">
<i class="fa-solid fa-file-pdf" style="margin-left: 0px; margin-right: 6px; margin-bottom: 3px; font-size: inherit; line-height: inherit; vertical-align: middle; display: inline-block; width: 1em; height: 1em;"></i>{{ ("Sækja PDF") }}</a>
</div>

<script>
document.addEventListener("DOMContentLoaded", function() {
// Get the current URL path
var path = window.location.pathname;

// Find the position of the <html> folder in the path
var htmlFolderIndex = path.indexOf('/html/');
if (htmlFolderIndex === -1) {
console.error("The 'html' folder was not found in the path.");
return;
}

// Trim the path to start from the <html> folder
var relativePath = path.substring(htmlFolderIndex + 6);

// Split the relative path into parts
var parts = relativePath.split('/').filter(function(part) {
return part.length > 0;
});
const linkElement = document.getElementById('pdf-link');
if (!linkElement) return;

const tocSection = document.querySelector('.tocsection.sourcelink');
const depth = parseInt(tocSection.getAttribute('data-depth'), 10);
const subfolder = tocSection.getAttribute('data-subfolder');

// Determine the PDF link based on the path parts
var pdfLink = "";
if (parts.length === 0 || (parts.length === 1 && parts[0].endsWith('.html'))) {
// If the path has no parts or only one part that ends with .html, it is in the root folder
pdfLink = "RUBIK-oll-rit-sameinud.pdf";
let pdfLink = "";

// Determine the PDF link based on the depth attribute
if (depth === 0) {
pdfLink = `./RUBIK-oll-rit-sameinud.pdf`;
} else {
// If the path has more than one part, the first part is the subfolder
pdfLink = parts[0] + "/RUBIK-" + parts[0] + ".pdf";
let relativePath = "./";

// Generate the relative path prefix (../ for each depth level beyond 1)
for (let i = 1; i < depth; i++) {
relativePath += "../";
}

pdfLink = `${relativePath}RUBIK-${subfolder}.pdf`;
}

// Set the href attribute of the PDF link
document.getElementById("pdf-link").href = pdfLink;

linkElement.href = pdfLink;
});
</script>
</script>
28 changes: 27 additions & 1 deletion rit/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,9 @@
extensions = [
'sphinx_togglebutton',
'sphinxcontrib.tikz',
'sphinx_sitemap', # Býr til sitemap.xml skrá
]
sitemap_url_scheme = "{link}" # Fjarlægir "/is/" hlutann úr URLs í sitemap.xml
root_doc = 'index' # Aðal skrá verkefnis
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] # Útiloka þessar skrár
templates_path = ['_templates'] # Slóð á "templates" skrár
Expand Down Expand Up @@ -229,6 +231,7 @@ def update_config_values(app):
}
html_title = project # Seinni hlutinn í <title> í HTML sóttur úr "project"
html_short_title = 'Ritsafn' # Stuttur title notaður í tenglum í "header" og í HTML Help Docs
html_baseurl = 'https://rit.rubik.is/' # Notað í URLs í sitemap.xml

# Skilgreiningar í HTML (t.d. fyrir tengil í "Edit on GitHub" takkanum)
html_context = {
Expand Down Expand Up @@ -401,4 +404,27 @@ def apply_styles(text, styles):
tikz_output_format = 'svg'
tikz_tikzlibraries = 'pgfplots.groupplots'
tikz_externalize = True
tikz_latex_args = [r"-shell-escape"]
tikz_latex_args = [r"-shell-escape"]


import os

def add_data_attributes(app, pagename, templatename, context, doctree):
# Determine the depth of the file
depth = pagename.count('/')

# Extract subfolder name if applicable
if depth >= 1:
subfolder = pagename.split('/')[0]
else:
subfolder = ''

# Debug print
print(f"Processing page: {pagename}, Depth: {depth}, Subfolder: {subfolder}")

# Add the depth and subfolder as context variables
context['html_page_depth'] = depth
context['html_subfolder'] = subfolder

def setup(app):
app.connect('html-page-context', add_data_attributes)
22 changes: 11 additions & 11 deletions rit/eldhusvaskur/_build/latex/RUBIK-eldhusvaskur.fdb_latexmk
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Fdb version 4
["makeindex RUBIK-eldhusvaskur.idx"] 1717603786.75 "RUBIK-eldhusvaskur.idx" "RUBIK-eldhusvaskur.ind" "RUBIK-eldhusvaskur" 1717603790.99768 0
"RUBIK-eldhusvaskur.idx" 1717603790.79889 263 0e458d36311b74b31adaabed0b9e22e2 "pdflatex"
["makeindex RUBIK-eldhusvaskur.idx"] 1717620979.37441 "RUBIK-eldhusvaskur.idx" "RUBIK-eldhusvaskur.ind" "RUBIK-eldhusvaskur" 1717620983.76079 0
"RUBIK-eldhusvaskur.idx" 1717620983.5519 263 0e458d36311b74b31adaabed0b9e22e2 "pdflatex"
(generated)
"RUBIK-eldhusvaskur.ilg"
"RUBIK-eldhusvaskur.ind"
(rewritten before read)
["pdflatex"] 1717603789.0882 "RUBIK-eldhusvaskur.tex" "RUBIK-eldhusvaskur.pdf" "RUBIK-eldhusvaskur" 1717603790.99838 0
["pdflatex"] 1717620981.7626 "RUBIK-eldhusvaskur.tex" "RUBIK-eldhusvaskur.pdf" "RUBIK-eldhusvaskur" 1717620983.7616 0
"/usr/local/texlive/2024/texmf-dist/fonts/enc/dvips/lm/lm-ec.enc" 1254269338 2375 baa924870cfb487815765f9094cf3728 ""
"/usr/local/texlive/2024/texmf-dist/fonts/enc/dvips/lm/lm-mathit.enc" 1202520719 2405 5dcf2c1b967ee25cc46c58cd52244aed ""
"/usr/local/texlive/2024/texmf-dist/fonts/enc/dvips/lm/lm-mathsy.enc" 1202520719 2840 216e6e45ad352e2456e1149f28885bee ""
Expand Down Expand Up @@ -312,16 +312,16 @@
"/usr/local/texlive/2024/texmf-var/fonts/map/pdftex/updmap/pdftex.map" 1715610869.65933 5467645 128b85b7cde5f5edc5cb7f1dd7ff8736 ""
"/usr/local/texlive/2024/texmf-var/web2c/pdftex/pdflatex.fmt" 1715610771 8221425 fc2f7c60b34b76ecf6facdc7fa161ce8 ""
"/usr/local/texlive/2024/texmf.cnf" 1710266656 577 e590dabc9e28c5b61546e15f63eebcdf ""
"RUBIK-eldhusvaskur.aux" 1717603790.79041 15293 7e0b93799d26084c555a4bd14dc169ed "pdflatex"
"RUBIK-eldhusvaskur.ind" 1717603787.09923 454 f7744fd7c4782d41c5558dc6b408d76e "makeindex RUBIK-eldhusvaskur.idx"
"RUBIK-eldhusvaskur.out" 1717603790.79622 7716 93193b0741794a1a5a468f06aed6f5b0 "pdflatex"
"RUBIK-eldhusvaskur.tex" 1717603784.44777 21168 9441608a392f2424a50b94a3ed1fda00 ""
"RUBIK-eldhusvaskur.toc" 1717603790.79896 4051 730b78e6099077c6f8d643b663f7b7d5 "pdflatex"
"RUBIK-eldhusvaskur.aux" 1717620983.52841 15293 7e0b93799d26084c555a4bd14dc169ed "pdflatex"
"RUBIK-eldhusvaskur.ind" 1717620979.75013 454 f7744fd7c4782d41c5558dc6b408d76e "makeindex RUBIK-eldhusvaskur.idx"
"RUBIK-eldhusvaskur.out" 1717620983.54691 7716 93193b0741794a1a5a468f06aed6f5b0 "pdflatex"
"RUBIK-eldhusvaskur.tex" 1717620977.04007 21168 9441608a392f2424a50b94a3ed1fda00 ""
"RUBIK-eldhusvaskur.toc" 1717620983.552 4051 730b78e6099077c6f8d643b663f7b7d5 "pdflatex"
"daily.jpg" 1717599257 7530 5dc2cec0c7ee534600b2341fc44c9ce2 ""
"rubik-cover.png" 1717078744.14304 74807 27385f53575191b302855b7d61c22ed4 ""
"sphinx.sty" 1716566566.77778 44560 f9fbf51072c954d129c9bd5284cc4ccf ""
"sphinxcontribtikz.sty" 1717603778.11231 773 1e308d24d0f0d7630d9b36d0654c16f2 ""
"sphinxhighlight.sty" 1717603778.22365 7553 83fb52292c17957d9f4aadcb28c57a87 ""
"sphinxcontribtikz.sty" 1717620973.72813 773 1e308d24d0f0d7630d9b36d0654c16f2 ""
"sphinxhighlight.sty" 1717620974.09156 7553 83fb52292c17957d9f4aadcb28c57a87 ""
"sphinxlatexadmonitions.sty" 1716566566.77815 10989 c38302e64c2bb47779f086869b246760 ""
"sphinxlatexcontainers.sty" 1716566566.77826 901 d3a3a1b7b2547f47ade2499350b5c420 ""
"sphinxlatexgraphics.sty" 1716566566.77838 4840 a9578332b6f3b35e198751fb632c9b79 ""
Expand All @@ -336,7 +336,7 @@
"sphinxlatexstyletext.sty" 1716566566.77964 8589 a7e8f95eb4fef6c1cd2623cd417d6467 ""
"sphinxlatextables.sty" 1716566566.77981 57829 997133f8082b07d1e9aafcd87331d9bf ""
"sphinxmanual.cls" 1716566566.7799 4241 7b0d7a37df7b5715fb0dbd585c52ecdb ""
"sphinxmessages.sty" 1717603784.45177 752 7544e9e595ce430d35f172b972289843 ""
"sphinxmessages.sty" 1717620977.04457 752 7544e9e595ce430d35f172b972289843 ""
"sphinxoptionsgeometry.sty" 1716566566.78001 2061 47bb34b8ed8a78823eb0c886abfb9f4d ""
"sphinxoptionshyperref.sty" 1716566566.78011 1094 79beb8b8a3f10784f8cce804e0f9d3aa ""
"sphinxpackageboxes.sty" 1716566566.78024 36615 1d74c63e665ede6c648fa08c42ea70fb ""
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Fdb version 4
["makeindex RUBIK-fjarmal-einstaklinga.idx"] 1717603794.4535 "RUBIK-fjarmal-einstaklinga.idx" "RUBIK-fjarmal-einstaklinga.ind" "RUBIK-fjarmal-einstaklinga" 1717603798.55376 0
"RUBIK-fjarmal-einstaklinga.idx" 1717603798.37091 89 3ceb844f183bfa6f1f4c8da3c3d64c04 "pdflatex"
["makeindex RUBIK-fjarmal-einstaklinga.idx"] 1717620987.47804 "RUBIK-fjarmal-einstaklinga.idx" "RUBIK-fjarmal-einstaklinga.ind" "RUBIK-fjarmal-einstaklinga" 1717620991.54672 0
"RUBIK-fjarmal-einstaklinga.idx" 1717620991.369 89 3ceb844f183bfa6f1f4c8da3c3d64c04 "pdflatex"
(generated)
"RUBIK-fjarmal-einstaklinga.ilg"
"RUBIK-fjarmal-einstaklinga.ind"
(rewritten before read)
["pdflatex"] 1717603796.69947 "RUBIK-fjarmal-einstaklinga.tex" "RUBIK-fjarmal-einstaklinga.pdf" "RUBIK-fjarmal-einstaklinga" 1717603798.55444 0
["pdflatex"] 1717620989.65843 "RUBIK-fjarmal-einstaklinga.tex" "RUBIK-fjarmal-einstaklinga.pdf" "RUBIK-fjarmal-einstaklinga" 1717620991.548 0
"/usr/local/texlive/2024/texmf-dist/fonts/enc/dvips/lm/lm-ec.enc" 1254269338 2375 baa924870cfb487815765f9094cf3728 ""
"/usr/local/texlive/2024/texmf-dist/fonts/enc/dvips/lm/lm-ts1.enc" 1254269338 3031 6c4d3515bf7115d8518af1c9ab97ca44 ""
"/usr/local/texlive/2024/texmf-dist/fonts/map/fontname/texfonts.map" 1577235249 3524 cb3e574dea2d1052e39280babc910dc8 ""
Expand Down Expand Up @@ -296,15 +296,15 @@
"/usr/local/texlive/2024/texmf-var/fonts/map/pdftex/updmap/pdftex.map" 1715610869.65933 5467645 128b85b7cde5f5edc5cb7f1dd7ff8736 ""
"/usr/local/texlive/2024/texmf-var/web2c/pdftex/pdflatex.fmt" 1715610771 8221425 fc2f7c60b34b76ecf6facdc7fa161ce8 ""
"/usr/local/texlive/2024/texmf.cnf" 1710266656 577 e590dabc9e28c5b61546e15f63eebcdf ""
"RUBIK-fjarmal-einstaklinga.aux" 1717603798.34944 23537 2ac28d369e7b3bf54dcf90e2dd623ae0 "pdflatex"
"RUBIK-fjarmal-einstaklinga.ind" 1717603794.75246 345 6d8628ab4cee13225beace9eb33e3864 "makeindex RUBIK-fjarmal-einstaklinga.idx"
"RUBIK-fjarmal-einstaklinga.out" 1717603798.36169 15616 5720618401f4c4c7f9f8b5ebd719df8f "pdflatex"
"RUBIK-fjarmal-einstaklinga.tex" 1717603792.05324 19183 75052808659d862e0e656369f294cba2 ""
"RUBIK-fjarmal-einstaklinga.toc" 1717603798.371 7862 99364c531db7bf72191c19373eed911a "pdflatex"
"RUBIK-fjarmal-einstaklinga.aux" 1717620991.34168 23537 2ac28d369e7b3bf54dcf90e2dd623ae0 "pdflatex"
"RUBIK-fjarmal-einstaklinga.ind" 1717620987.76492 345 6d8628ab4cee13225beace9eb33e3864 "makeindex RUBIK-fjarmal-einstaklinga.idx"
"RUBIK-fjarmal-einstaklinga.out" 1717620991.35905 15616 5720618401f4c4c7f9f8b5ebd719df8f "pdflatex"
"RUBIK-fjarmal-einstaklinga.tex" 1717620985.11765 19183 75052808659d862e0e656369f294cba2 ""
"RUBIK-fjarmal-einstaklinga.toc" 1717620991.36912 7862 99364c531db7bf72191c19373eed911a "pdflatex"
"rubik-cover.png" 1717078744.14304 74807 27385f53575191b302855b7d61c22ed4 ""
"sphinx.sty" 1716566566.77778 44560 f9fbf51072c954d129c9bd5284cc4ccf ""
"sphinxcontribtikz.sty" 1717603791.93137 773 1e308d24d0f0d7630d9b36d0654c16f2 ""
"sphinxhighlight.sty" 1717603791.99953 7553 83fb52292c17957d9f4aadcb28c57a87 ""
"sphinxcontribtikz.sty" 1717620984.62249 773 1e308d24d0f0d7630d9b36d0654c16f2 ""
"sphinxhighlight.sty" 1717620985.04773 7553 83fb52292c17957d9f4aadcb28c57a87 ""
"sphinxlatexadmonitions.sty" 1716566566.77815 10989 c38302e64c2bb47779f086869b246760 ""
"sphinxlatexcontainers.sty" 1716566566.77826 901 d3a3a1b7b2547f47ade2499350b5c420 ""
"sphinxlatexgraphics.sty" 1716566566.77838 4840 a9578332b6f3b35e198751fb632c9b79 ""
Expand All @@ -319,7 +319,7 @@
"sphinxlatexstyletext.sty" 1716566566.77964 8589 a7e8f95eb4fef6c1cd2623cd417d6467 ""
"sphinxlatextables.sty" 1716566566.77981 57829 997133f8082b07d1e9aafcd87331d9bf ""
"sphinxmanual.cls" 1716566566.7799 4241 7b0d7a37df7b5715fb0dbd585c52ecdb ""
"sphinxmessages.sty" 1717603792.05676 752 7544e9e595ce430d35f172b972289843 ""
"sphinxmessages.sty" 1717620985.12072 752 7544e9e595ce430d35f172b972289843 ""
"sphinxoptionsgeometry.sty" 1716566566.78001 2061 47bb34b8ed8a78823eb0c886abfb9f4d ""
"sphinxoptionshyperref.sty" 1716566566.78011 1094 79beb8b8a3f10784f8cce804e0f9d3aa ""
"sphinxpackageboxes.sty" 1716566566.78024 36615 1d74c63e665ede6c648fa08c42ea70fb ""
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Fdb version 4
["makeindex RUBIK-fjarmal-fyrirtaekja.idx"] 1717603813.6978 "RUBIK-fjarmal-fyrirtaekja.idx" "RUBIK-fjarmal-fyrirtaekja.ind" "RUBIK-fjarmal-fyrirtaekja" 1717603817.76234 0
"RUBIK-fjarmal-fyrirtaekja.idx" 1717603817.55202 421 d6845a729c2521a129d8fdf8ec1e530b "pdflatex"
["makeindex RUBIK-fjarmal-fyrirtaekja.idx"] 1717620995.8412 "RUBIK-fjarmal-fyrirtaekja.idx" "RUBIK-fjarmal-fyrirtaekja.ind" "RUBIK-fjarmal-fyrirtaekja" 1717620999.8468 0
"RUBIK-fjarmal-fyrirtaekja.idx" 1717620999.65162 421 d6845a729c2521a129d8fdf8ec1e530b "pdflatex"
(generated)
"RUBIK-fjarmal-fyrirtaekja.ilg"
"RUBIK-fjarmal-fyrirtaekja.ind"
(rewritten before read)
["pdflatex"] 1717603815.89517 "RUBIK-fjarmal-fyrirtaekja.tex" "RUBIK-fjarmal-fyrirtaekja.pdf" "RUBIK-fjarmal-fyrirtaekja" 1717603817.76293 0
["pdflatex"] 1717620998.01962 "RUBIK-fjarmal-fyrirtaekja.tex" "RUBIK-fjarmal-fyrirtaekja.pdf" "RUBIK-fjarmal-fyrirtaekja" 1717620999.84749 0
"/usr/local/texlive/2024/texmf-dist/fonts/enc/dvips/lm/lm-ec.enc" 1254269338 2375 baa924870cfb487815765f9094cf3728 ""
"/usr/local/texlive/2024/texmf-dist/fonts/enc/dvips/lm/lm-mathit.enc" 1202520719 2405 5dcf2c1b967ee25cc46c58cd52244aed ""
"/usr/local/texlive/2024/texmf-dist/fonts/enc/dvips/lm/lm-mathsy.enc" 1202520719 2840 216e6e45ad352e2456e1149f28885bee ""
Expand Down Expand Up @@ -306,16 +306,16 @@
"/usr/local/texlive/2024/texmf-var/fonts/map/pdftex/updmap/pdftex.map" 1715610869.65933 5467645 128b85b7cde5f5edc5cb7f1dd7ff8736 ""
"/usr/local/texlive/2024/texmf-var/web2c/pdftex/pdflatex.fmt" 1715610771 8221425 fc2f7c60b34b76ecf6facdc7fa161ce8 ""
"/usr/local/texlive/2024/texmf.cnf" 1710266656 577 e590dabc9e28c5b61546e15f63eebcdf ""
"RUBIK-fjarmal-fyrirtaekja.aux" 1717603817.52644 14457 9ee188b9fbd5b99e9dd3c739b2ef3e99 "pdflatex"
"RUBIK-fjarmal-fyrirtaekja.ind" 1717603814.05137 554 cb518f1810d059c08aada82359b5195b "makeindex RUBIK-fjarmal-fyrirtaekja.idx"
"RUBIK-fjarmal-fyrirtaekja.out" 1717603817.54366 8954 f2170870698126eb5c7470cd965f82f0 "pdflatex"
"RUBIK-fjarmal-fyrirtaekja.tex" 1717603811.49313 15908 25e66d0d46ee221dd8692a7b30e08687 ""
"RUBIK-fjarmal-fyrirtaekja.toc" 1717603817.55211 4594 9ccc0b2a307b7fd9255df6ef0c83bcca "pdflatex"
"RUBIK-fjarmal-fyrirtaekja.aux" 1717620999.63158 14457 9ee188b9fbd5b99e9dd3c739b2ef3e99 "pdflatex"
"RUBIK-fjarmal-fyrirtaekja.ind" 1717620996.15543 554 cb518f1810d059c08aada82359b5195b "makeindex RUBIK-fjarmal-fyrirtaekja.idx"
"RUBIK-fjarmal-fyrirtaekja.out" 1717620999.64359 8954 f2170870698126eb5c7470cd965f82f0 "pdflatex"
"RUBIK-fjarmal-fyrirtaekja.tex" 1717620993.71843 15908 25e66d0d46ee221dd8692a7b30e08687 ""
"RUBIK-fjarmal-fyrirtaekja.toc" 1717620999.65171 4594 9ccc0b2a307b7fd9255df6ef0c83bcca "pdflatex"
"daily.jpg" 1717599257 7530 5dc2cec0c7ee534600b2341fc44c9ce2 ""
"rubik-cover.png" 1717078744.14304 74807 27385f53575191b302855b7d61c22ed4 ""
"sphinx.sty" 1716566566.77778 44560 f9fbf51072c954d129c9bd5284cc4ccf ""
"sphinxcontribtikz.sty" 1717603799.33685 773 1e308d24d0f0d7630d9b36d0654c16f2 ""
"sphinxhighlight.sty" 1717603799.42283 7553 83fb52292c17957d9f4aadcb28c57a87 ""
"sphinxcontribtikz.sty" 1717620992.35287 773 1e308d24d0f0d7630d9b36d0654c16f2 ""
"sphinxhighlight.sty" 1717620992.67442 7553 83fb52292c17957d9f4aadcb28c57a87 ""
"sphinxlatexadmonitions.sty" 1716566566.77815 10989 c38302e64c2bb47779f086869b246760 ""
"sphinxlatexcontainers.sty" 1716566566.77826 901 d3a3a1b7b2547f47ade2499350b5c420 ""
"sphinxlatexgraphics.sty" 1716566566.77838 4840 a9578332b6f3b35e198751fb632c9b79 ""
Expand All @@ -330,7 +330,7 @@
"sphinxlatexstyletext.sty" 1716566566.77964 8589 a7e8f95eb4fef6c1cd2623cd417d6467 ""
"sphinxlatextables.sty" 1716566566.77981 57829 997133f8082b07d1e9aafcd87331d9bf ""
"sphinxmanual.cls" 1716566566.7799 4241 7b0d7a37df7b5715fb0dbd585c52ecdb ""
"sphinxmessages.sty" 1717603811.50052 752 7544e9e595ce430d35f172b972289843 ""
"sphinxmessages.sty" 1717620993.72486 752 7544e9e595ce430d35f172b972289843 ""
"sphinxoptionsgeometry.sty" 1716566566.78001 2061 47bb34b8ed8a78823eb0c886abfb9f4d ""
"sphinxoptionshyperref.sty" 1716566566.78011 1094 79beb8b8a3f10784f8cce804e0f9d3aa ""
"sphinxpackageboxes.sty" 1716566566.78024 36615 1d74c63e665ede6c648fa08c42ea70fb ""
Expand Down

0 comments on commit 955ccf0

Please sign in to comment.