diff --git a/.gitignore b/.gitignore index 867e1da..9daa1ef 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ _build/ __pycache__ .nox/ .ipynb_checkpoints/ +.vs/ diff --git a/Makefile b/Makefile index bc25bc0..3d13f43 100644 --- a/Makefile +++ b/Makefile @@ -15,8 +15,11 @@ help: live: sphinx-autobuild --ignore _build -b dirhtml . _build/dirhtml/ + + .PHONY: help Makefile + # Catch-all target: route all unknown targets to Sphinx using the new # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). %: Makefile diff --git a/_ext/Pechakucha/__init__.py b/_ext/Pechakucha/__init__.py new file mode 100644 index 0000000..896be15 --- /dev/null +++ b/_ext/Pechakucha/__init__.py @@ -0,0 +1,4 @@ +from .pechakucha_directive import PechaKuchaDirective + + +__all__ = ['PechaKuchaDirective'] diff --git a/_ext/Pechakucha/pechakucha_directive.py b/_ext/Pechakucha/pechakucha_directive.py new file mode 100644 index 0000000..43e5516 --- /dev/null +++ b/_ext/Pechakucha/pechakucha_directive.py @@ -0,0 +1,46 @@ +from docutils import nodes +from sphinx.util.docutils import SphinxDirective +from docutils.parsers.rst import directives + +class PechaKuchaDirective(SphinxDirective): + has_content = True + option_spec = { + 'transition_time': directives.positive_int, + } + + def run(self): + transition_time = self.options.get('transition_time', 3000) + + container = nodes.container('', classes=['pechakucha-slideshow']) + container['data-transition-time'] = str(transition_time) + + self.set_source_info(container) + + for image_path in self.content: + image_node = nodes.image(uri=image_path, classes=['pechakucha-slide']) + figure_node = nodes.figure('', image_node, classes=['align-default']) + container += figure_node + + # Add navigation buttons + nav_container = nodes.container('', classes=['pechakucha-controls']) + prev_button = nodes.raw('', '', format='html') + next_button = nodes.raw('', '', format='html') + nav_container.extend([prev_button, next_button]) + container += nav_container + + # Add progress indicator container + progress_container = nodes.container('', classes=['pechakucha-progress']) + container += progress_container + + script_node = nodes.raw('', "", format='html') + container += script_node + + return [container] + + +def setup(app): + app.add_directive("pechakucha", PechaKuchaDirective) + app.add_css_file('_static/pechakucha.css') + app.add_js_file('_static/pechakucha.js') + + return {'version': '0.1', 'parallel_read_safe': True, 'parallel_write_safe': True} diff --git a/_ext/Pechakucha/setup.py b/_ext/Pechakucha/setup.py new file mode 100644 index 0000000..5e2f71f --- /dev/null +++ b/_ext/Pechakucha/setup.py @@ -0,0 +1,11 @@ +from setuptools import setup, find_packages + +setup( + name='pechakucha', + version='0.1', + packages=find_packages(), +) + +install_requires=[ + 'Sphinx', +], \ No newline at end of file diff --git a/_ext/todo.py b/_ext/todo.py deleted file mode 100644 index 15368f4..0000000 --- a/_ext/todo.py +++ /dev/null @@ -1,135 +0,0 @@ -from docutils import nodes -from docutils.parsers.rst import Directive - -from sphinx.locale import _ -from sphinx.util.docutils import SphinxDirective - - -class todo(nodes.Admonition, nodes.Element): - pass - - -class todolist(nodes.General, nodes.Element): - pass - - -def visit_todo_node(self, node): - self.visit_admonition(node) - - -def depart_todo_node(self, node): - self.depart_admonition(node) - - -class TodolistDirective(Directive): - - def run(self): - return [todolist('')] - - -class TodoDirective(SphinxDirective): - - # this enables content in the directive - has_content = True - - def run(self): - targetid = 'todo-%d' % self.env.new_serialno('todo') - targetnode = nodes.target('', '', ids=[targetid]) - - todo_node = todo('\n'.join(self.content)) - todo_node += nodes.title(_('Todo'), _('Todo')) - self.state.nested_parse(self.content, self.content_offset, todo_node) - - if not hasattr(self.env, 'todo_all_todos'): - self.env.todo_all_todos = [] - - self.env.todo_all_todos.append({ - 'docname': self.env.docname, - 'lineno': self.lineno, - 'todo': todo_node.deepcopy(), - 'target': targetnode, - }) - - return [targetnode, todo_node] - - -def purge_todos(app, env, docname): - if not hasattr(env, 'todo_all_todos'): - return - - env.todo_all_todos = [todo for todo in env.todo_all_todos - if todo['docname'] != docname] - - -def merge_todos(app, env, docnames, other): - if not hasattr(env, 'todo_all_todos'): - env.todo_all_todos = [] - if hasattr(other, 'todo_all_todos'): - env.todo_all_todos.extend(other.todo_all_todos) - - -def process_todo_nodes(app, doctree, fromdocname): - if not app.config.todo_include_todos: - for node in doctree.findall(todo): - node.parent.remove(node) - - # Replace all todolist nodes with a list of the collected todos. - # Augment each todo with a backlink to the original location. - env = app.builder.env - - if not hasattr(env, 'todo_all_todos'): - env.todo_all_todos = [] - - for node in doctree.findall(todolist): - if not app.config.todo_include_todos: - node.replace_self([]) - continue - - content = [] - - for todo_info in env.todo_all_todos: - para = nodes.paragraph() - filename = env.doc2path(todo_info['docname'], base=None) - description = ( - _('(The original entry is located in %s, line %d and can be found ') % - (filename, todo_info['lineno'])) - para += nodes.Text(description) - - # Create a reference - newnode = nodes.reference('', '') - innernode = nodes.emphasis(_('here'), _('here')) - newnode['refdocname'] = todo_info['docname'] - newnode['refuri'] = app.builder.get_relative_uri( - fromdocname, todo_info['docname']) - newnode['refuri'] += '#' + todo_info['target']['refid'] - newnode.append(innernode) - para += newnode - para += nodes.Text('.)') - - # Insert into the todolist - content.append(todo_info['todo']) - content.append(para) - - node.replace_self(content) - - -def setup(app): - app.add_config_value('todo_include_todos', False, 'html') - - app.add_node(todolist) - app.add_node(todo, - html=(visit_todo_node, depart_todo_node), - latex=(visit_todo_node, depart_todo_node), - text=(visit_todo_node, depart_todo_node)) - - app.add_directive('todo', TodoDirective) - app.add_directive('todolist', TodolistDirective) - app.connect('doctree-resolved', process_todo_nodes) - app.connect('env-purge-doc', purge_todos) - app.connect('env-merge-info', merge_todos) - - return { - 'version': '0.1', - 'parallel_read_safe': True, - 'parallel_write_safe': True, - } diff --git a/_static/custom.css b/_static/custom.css deleted file mode 100644 index 7fafd9d..0000000 --- a/_static/custom.css +++ /dev/null @@ -1,209 +0,0 @@ -/* Bio area */ -div.profile-pic { - margin-top: 1em; -} - -figure.profile-pic img { - /* border-radius: 500px; */ - width: 80%; - max-width: 190px; - margin: 0 auto; - display: block; -} - -.bio-info { - margin: 1em auto; - max-width: 220px; -} - -.name { - font-size: 1.5em; -} - -.focusareas { - font-size: .9em; - font-weight: bold; -} - -.whatido { - margin-top: 1em; -} - -.major { - margin-top: 1em; -} - -.gradyear { - margin-top: 1em; -} - - - -/* Sidebar for blog archive / each post */ -ul.ablog-archive { - padding-left: 0px; -} - -.bd-sidebar h2 { - font-size: 1.4em; -} - -.bd-sidebar ul { - padding-left: 0; - list-style-type: none; -} - -.bd-sidebar li { - padding-bottom: .5em; -} - -div.bd-sidebar h3, div.bd-sidebar h2, div.bd-sidebar ul { - padding-left: 5%; -} - -/* In-page post lists */ -ul.postlist { - padding-left: 0; -} - -ul.postlist > li > p:first-child { - font-size: 1.5em; -} - -ul.postlist li + li { - margin-top: 2em; -} - -ul.postlist li > p > a { - font-style: normal; - font-size: 1.3em; -} - - -/* more space in navicons */ - -ul.navbar-nav { - font-size:1.5em ; - list-style-type: none; - margin: 0; - padding: 0; - overflow: hidden; -} - - - -/* Timeline CSS */ -div.timeline div.card { - border: 0px; -} - -div.timeline div.left { - text-align: right; - border-right: 1px solid black; -} - -div.timeline div.entry::after { - width: 1em; - height: 1em; - background: white; - border-radius: 50%; - content: ""; - top: 1em; - display: block; - position: absolute; - border: 1px black solid; - z-index: 999; -} - -div.timeline div.entry.left::after { - right: -.5em; -} - -div.timeline div.entry.right::after { - left: -.5em; -} - -/* * { - box-sizing: border-box; -} */ - - -.slide { - display: none; - - animation-name: fade; - animation-duration: 1.5s; -} - -img { - vertical-align: middle; -} - -/* Slideshow container */ -.slideshow-container { - /* max-width: 1000px; */ - position: relative; - margin: auto; -} - -/* Caption text */ -.text { - color: #f2f2f2; - font-size: 15px; - padding: 8px 12px; - position: absolute; - bottom: 8px; - width: 100%; - text-align: center; -} - -/* Number text (1/3 etc) */ -.numbertext { - color: #f2f2f2; - font-size: 12px; - padding: 8px 12px; - position: absolute; - top: 0; -} - -/* The dots/bullets/indicators */ -.dot { - height: 15px; - width: 15px; - margin: 0 2px; - background-color: #bbb; - border-radius: 50%; - display: inline-block; - transition: background-color 0.6s ease; -} - -.active { - background-color: #717171; -} - -H1.pechakucha { - display:none; -} - -/* Fading animation */ -.fade { - animation-name: fade; - animation-duration: 1.5s; -} - -@keyframes fade { - from { - opacity: .4 - } - - to { - opacity: 1 - } -} - -/* On smaller screens, decrease text size */ -@media only screen and (max-width: 300px) { - .text { - font-size: 11px - } -} \ No newline at end of file diff --git a/_static/pechakucha.css b/_static/pechakucha.css new file mode 100644 index 0000000..7438d70 --- /dev/null +++ b/_static/pechakucha.css @@ -0,0 +1,82 @@ +.pechakucha-slideshow { + width: 100%; + position: relative; + background-color: #f8f8f8; /* Example background color */ + margin-bottom: 20px; + padding: 10px; + box-shadow: 0 2px 4px rgba(0,0,0,0.1); /* subtle shadow for depth */ +} + +.pechakucha-slide { + display: none; /* Hide slides by default */ + width: 100%; + height: auto; /* Adjust based on your images */ +} + +.pechakucha-controls { + text-align: center; + margin-top: 20px; +} + +.pechakucha-controls button { + padding: 10px 20px; + margin: 0 5px; + background-color: #007bff; + color: white; + border: none; + border-radius: 5px; + cursor: pointer; + font-size: 1em; +} + +.pechakucha-controls button:hover { + background-color: #0056b3; +} + +.pechakucha-progress { + position: absolute; + bottom: 10px; + width: 100%; + text-align: center; +} + +.pechakucha-progress-dot { + height: 10px; + width: 10px; + margin: 0 2px; + background-color: #bbb; + border-radius: 50%; + display: inline-block; +} + +.pechakucha-progress-dot.active { + background-color: #717171; +} + +/* Responsive styles */ +@media (max-width: 600px) { + .pechakucha-controls button { + padding: 5px 10px; + font-size: 0.8em; + } +} +.pechakucha-progress { + text-align: center; + position: absolute; + bottom: 10px; + width: 100%; +} + +.pechakucha-progress-dot { + height: 10px; + width: 10px; + margin: 0 2px; + background-color: #bbb; + border-radius: 50%; + display: inline-block; + cursor: pointer; +} + +.pechakucha-progress-dot.active { + background-color: #717171; +} diff --git a/_static/pechakucha.js b/_static/pechakucha.js new file mode 100644 index 0000000..5b98599 --- /dev/null +++ b/_static/pechakucha.js @@ -0,0 +1,51 @@ +document.addEventListener('DOMContentLoaded', function() { + let slideIndex = 0; + let slides = document.getElementsByClassName('pechakucha-slide'); + let transitionTime = document.querySelector('.pechakucha-slideshow').dataset.transitionTime; + let progressContainer = document.querySelector('.pechakucha-progress'); + + // Create and append progress indicators + for (let i = 0; i < slides.length; i++) { + let dot = document.createElement('span'); + dot.classList.add('pechakucha-progress-dot'); + dot.addEventListener('click', (function(index) { + return function() { + moveSlide(index - slideIndex); + }; + })(i)); + progressContainer.appendChild(dot); + } + + function showSlides() { + updateSlidesAndDots(); + slideIndex++; + if (slideIndex >= slides.length) { slideIndex = 0; } + setTimeout(showSlides, transitionTime); + } + + function moveSlide(direction) { + slideIndex += direction; + if (slideIndex >= slides.length) { slideIndex = 0; } + if (slideIndex < 0) { slideIndex = slides.length - 1; } + updateSlidesAndDots(); + } + + function updateSlidesAndDots() { + for (let i = 0; i < slides.length; i++) { + slides[i].style.display = 'none'; + progressContainer.children[i].classList.remove('active'); + } + slides[slideIndex].style.display = 'block'; + progressContainer.children[slideIndex].classList.add('active'); + } + + document.getElementById('prev-slide').addEventListener('click', function() { + moveSlide(-1); + }); + document.getElementById('next-slide').addEventListener('click', function() { + moveSlide(1); + }); + + // Initialize the slideshow + showSlides(); +}); diff --git a/_templates/index.html b/_templates/index.html new file mode 100644 index 0000000..c3bf5d2 --- /dev/null +++ b/_templates/index.html @@ -0,0 +1,26 @@ +{% extends '!layout.html' %} + +{% block footer %} + +{% endblock %} diff --git a/_templates/pechakucha_slideshow.html b/_templates/pechakucha_slideshow.html new file mode 100644 index 0000000..4de97f8 --- /dev/null +++ b/_templates/pechakucha_slideshow.html @@ -0,0 +1,29 @@ +{% extends 'layout.html' %} + +{% block body %} + +
+ +
+ + + + + +
+ +
+ + + +{% endblock %} diff --git a/conf.py b/conf.py index 694e5a0..52f4154 100644 --- a/conf.py +++ b/conf.py @@ -1,11 +1,27 @@ +import os +import sys +sys.path.insert(0, os.path.abspath('_ext')) # Adjust '_ext' to your directory's path + + +# extensions = ['todo'] + +todo_include_todos = False + # -- Project information ----------------------------------------------------- project = 'Site Title' copyright = '2023, Your name' author = 'Your Name' - - +extensions = [ + 'Pechakucha.pechakucha_directive', + "myst_nb", + #"ablog", + 'sphinx.ext.intersphinx', + "sphinx_design", + 'todo', + #"sphinxext.opengraph", + ] # ---------------------------------------------------------------------------- # Below here does not need to be edited for the lab # ---------------------------------------------------------------------------- @@ -16,6 +32,22 @@ # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. +# conf.py + +# ... + +# Specify 'dirhtml' as one of the builders +html_theme = 'sphinx_rtd_theme' + +# Add 'dirhtml' to the 'html_theme_options' configuration +html_theme_options = { + 'style_nav_header_background': '#343131', +} + +# Specify 'dirhtml' as one of the builders + +# ... + # "sphinxext.rediraffe", @@ -57,6 +89,8 @@ # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static'] +html_css_files = ['_static/pechakucha.css'] + # html_js_files = [ # 'slides.js', @@ -106,5 +140,6 @@ ] def setup(app): - app.add_css_file("custom.css") - # app.add_js_file("custom.js") + app.add_css_file("_static.pechakucha.css") + app.add_js_file("_static.pechakucha.js") + diff --git a/dog.jpeg b/dog.jpeg new file mode 100644 index 0000000..9951a6c Binary files /dev/null and b/dog.jpeg differ diff --git a/download.jpeg b/download.jpeg new file mode 100644 index 0000000..bfb5930 Binary files /dev/null and b/download.jpeg differ diff --git a/index.md b/index.md index 973ef4c..54b9f89 100644 --- a/index.md +++ b/index.md @@ -1,4 +1,4 @@ -# Page Title +# Profile Site A short introduction for the top of your main page @@ -8,9 +8,11 @@ More content you want on your page - +someotherfile +somefile +``` + diff --git a/index.rst b/index.rst new file mode 100644 index 0000000..1d0fab1 --- /dev/null +++ b/index.rst @@ -0,0 +1,18 @@ +Welcome to my profile site! +============================ + + + +.. toctree:: + somefile.rst + someotherfile.rst + +.. Hello world. Below is the list of TODOs. + +.. .. todolist:: +.. Finish Sphinx Project +.. Finish final paper for 320 +.. Finish project for 120G + + + diff --git a/somefile.rst b/somefile.rst new file mode 100644 index 0000000..af5862a --- /dev/null +++ b/somefile.rst @@ -0,0 +1,14 @@ +================= +My Pechakucha +================= + +Hello everyone, this is my first time running this extension to see how it works. + + +.. pechakucha::5 + :transition_time: + + dog.jpeg + + + diff --git a/someotherfile.rst b/someotherfile.rst new file mode 100644 index 0000000..cd8b8f3 --- /dev/null +++ b/someotherfile.rst @@ -0,0 +1,9 @@ +=============== +Class Progress +=============== + +.. This is what I have to get done for this class: + +.. .. todolist:: + finished pechakucha +