Skip to content

Commit b39b210

Browse files
committed
Import project: suggest a config file (yaml)
I tried to add the intermediate page where we suggest a common Sphinx YAML file for the user to copy and paste. I found the pattern a little hard to follow. The base template didn't have all the blocks I needed, so I added some more but I don't feel comfortable with them. I also had to create a block to overwrite the CSS classes of the main div, which sounds weird to me as well. Besides, I'm not sure how to use the CSS classes to achieve what I need: syntax highlighting, smaller text, etc.
1 parent 87b28d5 commit b39b210

File tree

2 files changed

+71
-4
lines changed

2 files changed

+71
-4
lines changed

readthedocsext/theme/templates/projects/import_base.html

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
{% block title %}{% trans "Add Project" %}{% endblock %}
77

88
{% block content %}
9-
{% block project_add_content %}
109
<div class="ui very padded centered stackable grid">
11-
<div class="ui ten wide tablet six wide computer column">
10+
{% block project_add_content %}
11+
<div class="{% block project_add_css_classes %}ui ten wide tablet six wide computer column{% endblock project_add_css_classes %}">
1212

1313
{% block project_add_content_header %}
1414
<h1 class="ui medium header">
@@ -22,6 +22,9 @@ <h1 class="ui medium header">
2222
</h1>
2323
{% endblock project_add_content_header %}
2424

25+
{% block project_add_content_main %}
26+
{% endblock project_add_content_main %}
27+
2528
<form class="ui form" action="{% url "projects_import_manual" %}" method="post">
2629

2730
{% csrf_token %}
@@ -42,6 +45,7 @@ <h1 class="ui medium header">
4245
{% block wizard_actions %}
4346
<div>
4447
{% if wizard.steps.prev %}
48+
{# TODO: the previous button should not validate the form #}
4549
<button class="ui button" name="wizard_goto_step" type="submit" value="{{ wizard.steps.prev }}">
4650
{% trans "Previous" %}
4751
</button>
@@ -56,15 +60,17 @@ <h1 class="ui medium header">
5660
{% endblock wizard_actions %}
5761

5862
</form>
59-
{% endblock project_add_content %}
60-
</div>
63+
</div>
64+
{% endblock project_add_content %}
6165

66+
{% block project_add_help_topics %}
6267
<div class="ui ten wide tablet four wide computer column">
6368
<h2 class="ui small header">{% trans "Help topics" %}</h2>
6469
<div data-bind="using: EmbedTopicsView('intro/import-guide')">
6570
<div data-bind="template: { name: 'doc-topics' }"></div>
6671
</div>
6772
</div>
73+
{% endblock project_add_help_topics %}
6874
</div>
6975

7076
{% include "includes/utils/embed_docs.html" %}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{% extends "projects/import_base.html" %}
2+
{% load i18n %}
3+
4+
{% block project_add_content_subheader %}
5+
{% trans "Add a configuration file (<code>.readthedocs.yaml</code>) to your project" %}
6+
{% endblock project_add_content_subheader %}
7+
8+
{% block project_add_css_classes %}ui ten wide tablet wide computer column{% endblock project_add_css_classes %}
9+
{% block project_add_content_main %}
10+
<p class="info">
11+
{% blocktrans trimmed %}
12+
Make sure your project has a <code>.readthedocs.yaml</code> at the root of your repository. This file is required by Read the Docs to be able to build your documentation. You can <a href="https://docs.readthedocs.io/en/stable/config-file/v2.html">read more about this in our documentation</a>.
13+
{% endblocktrans %}
14+
</p>
15+
16+
<p class="info">
17+
Here you have an example for a common Sphinx project:
18+
19+
<pre class="ui padded">
20+
<code class="ui small text">
21+
# .readthedocs.yaml
22+
# Read the Docs configuration file
23+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
24+
25+
# Required
26+
version: 2
27+
28+
# Set the OS, Python version and other tools you might need
29+
build:
30+
os: ubuntu-22.04
31+
tools:
32+
python: "3.11"
33+
# You can also specify other tool versions:
34+
# nodejs: "19"
35+
# rust: "1.64"
36+
# golang: "1.19"
37+
38+
# Build documentation in the "docs/" directory with Sphinx
39+
sphinx:
40+
configuration: docs/conf.py
41+
42+
# Optionally build your docs in additional formats such as PDF and ePub
43+
# formats:
44+
# - pdf
45+
# - epub
46+
47+
# Optionally, but recommended,
48+
# declare the Python requirements required to build your documentation
49+
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
50+
# python:
51+
# install:
52+
# - requirements: docs/requirements.txt
53+
</code>
54+
</pre>
55+
</p>
56+
57+
{{ block.super }}
58+
{% endblock project_add_content_main %}
59+
60+
{% block project_add_help_topics %}
61+
{% endblock project_add_help_topics %}

0 commit comments

Comments
 (0)