From fffc90442ee858ac2ec619d89c8cf44db7009f6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Behmo?= Date: Tue, 25 Feb 2020 17:02:39 +0100 Subject: [PATCH] Add youtube videos to docs This is possible thanks to a custom youtube tag. See https://jasonstitt.com/youtube-in-restructured-text --- README.rst | 11 +---------- docs/conf.py | 44 ++++++++++++++++++++++++++++++++++++++++---- docs/intro.rst | 11 +++++++---- 3 files changed, 48 insertions(+), 18 deletions(-) diff --git a/README.rst b/README.rst index 24ea279..1bdf266 100644 --- a/README.rst +++ b/README.rst @@ -71,19 +71,10 @@ Extensive documentation is available online: https://docs.tutor.overhang.io/ Support ------- -To get community support, go to the official discussion forums: https://discuss.overhang.io. +To get community support, go to the official discussion forums: https://discuss.overhang.io. For official support, please subscribe to a Long Term Support (LTS) license at https://overhang.io/tutor/lts. .. _readme_support_end: -.. _whats_tutor_start: - -What is Tutor? --------------- - -Tutor was presented at the 2019 Open edX conference in San Diego, CA. Here's the 7-minute talk: `video `_, `slides `_. - -.. _whats_tutor_end: - .. _readme_contributing_start: Contributing diff --git a/docs/conf.py b/docs/conf.py index ba290b4..2b04ce6 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -194,14 +194,50 @@ epub_title = project epub_exclude_files = ['search.html'] # Custom variables -import io -import os here = os.path.abspath(os.path.dirname(__file__)) about = {} -with io.open(os.path.join(here, "..", "tutor", "__about__.py"), "rt", encoding="utf-8") as f: +with io.open( + os.path.join(here, "..", "tutor", "__about__.py"), "rt", encoding="utf-8" +) as f: exec(f.read(), about) rst_prolog = """ .. |tutor_version| replace:: {} """.format( - about['__version__'], + about["__version__"], ) + + +# Custom directives +def youtube( + _name, + _args, + _options, + content, + _lineno, + _contentOffset, + _blockText, + _state, + _stateMachine, +): + """ Restructured text extension for inserting youtube embedded videos """ + if not content: + return [] + video_id = content[0] + return [ + docutils.nodes.raw( + "", + """ +""".format( + video_id=video_id + ), + format="html", + ) + ] + + +youtube.content = True +docutils.parsers.rst.directives.register_directive("youtube", youtube) diff --git a/docs/intro.rst b/docs/intro.rst index 8657178..6b02c41 100644 --- a/docs/intro.rst +++ b/docs/intro.rst @@ -10,16 +10,19 @@ Tutor simplifies the deployment of Open edX by: 1. Separating the configuration logic from the deployment platforms. 2. Running application processes in cleanly separated `docker containers `_. -.. image:: https://overhang.io/images/openedx-plus-docker-is-tutor.png +.. image:: https://overhang.io/static/img/openedx-plus-docker-is-tutor.png :alt: Open edX + Docker = Tutor :width: 500px :align: center Because Docker containers are becoming an industry-wide standard, that means that with Tutor it becomes possible to run Open edX anywhere: for now, Tutor supports deploying on a local server, with `docker-compose `_, and in a large cluster, with `Kubernetes `_. But in the future, Tutor may support other deployment platforms. -.. include:: ../README.rst - :start-after: _whats_tutor_start: - :end-before: _whats_tutor_end: +What is Tutor? +-------------- + +Tutor was presented at the 2019 Open edX conference in San Diego, CA. Here's the 7-minute talk (with `slides `_): + +.. youtube:: Oqc7c-3qFc4 How does Tutor work? --------------------