Skip to content

Commit

Permalink
Initial commit, configuring Read the Docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jflopezfernandez committed May 27, 2020
1 parent 2f7d9a6 commit bb85e9c
Show file tree
Hide file tree
Showing 9 changed files with 242 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@

# Visual Studio Code
/.vscode/

# Python Virtual Environment
/docs/.venv/

# Sphinx Files
docs/_build/

# Prerequisites
*.d

Expand Down
34 changes: 34 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# .readthedocs.yml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html#supported-settings
# for details.
version: 2

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py

# Build documentation with MkDocs
# mkdocs:
# configuration: mkdocs.yml

# Optionally build your docs in additional formats such as PDF
formats:
- pdf

# Optionally set the version of Python and requirements to build your docs.
python:
version: 3.8
install:
- requirements: docs/requirements.txt
- method: pip
path: docs/
extra_requirements:
- docs
system_packages: true

# Sphinx configuration
sphinx:
builder: html
configuration: docs/conf.py
fail_on_warning: false
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.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
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
56 changes: 56 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))


# -- Project information -----------------------------------------------------

project = 'StdConf'
copyright = '2020, Jose Fernando Lopez Fernandez'
author = 'Jose Fernando Lopez Fernandez'

# The full version, including alpha/beta/rc tags
release = '0.0.1'


# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'recommonmark'
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']


# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'alabaster'

# Add any paths that contain custom static files (such as style sheets) here,
# 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']
27 changes: 27 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
.. StdConf documentation master file, created by
sphinx-quickstart on Wed May 27 16:45:43 2020.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to StdConf's documentation!
===================================

.. toctree::
:maxdepth: 2
:caption: Contents:

introduction

This is plain text.

.. py:function:: enumerate(sequence[, start=0])
Return an iterator that yields tuples of an index and an item of the "sequence".
(And so on.)

Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
35 changes: 35 additions & 0 deletions docs/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=.
set BUILDDIR=_build

if "%1" == "" goto help

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
exit /b 1
)

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
27 changes: 27 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
alabaster==0.7.12
Babel==2.8.0
certifi==2020.4.5.1
chardet==3.0.4
commonmark==0.9.1
docutils==0.16
idna==2.9
imagesize==1.2.0
Jinja2==2.11.2
MarkupSafe==1.1.1
packaging==20.4
pkg-resources==0.0.0
Pygments==2.6.1
pyparsing==2.4.7
pytz==2020.1
recommonmark==0.6.0
requests==2.23.0
six==1.15.0
snowballstemmer==2.0.0
Sphinx==3.0.4
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==1.0.3
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.4
urllib3==1.25.9
27 changes: 27 additions & 0 deletions get-config.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env perl
use strict;
use warnings;
use v5.30;

# TODO: Parse command-line options

# TODO: Get options from configuration file
for my $filename (@ARGV) {
# Open the configuration file
open CONFIG_FILE, '<:encoding(UTF-8)', $filename or die("Failed to open file.");

# TODO: Figure out how strings are initialized properly
my $current_line = "";

# TODO: Process configuration options
while ($current_line = <CONFIG_FILE>) {
chomp $current_line;

if ($current_line =~ m/(?<Key>.*)=(?<Value>.*)/g) {
say "$+{Key}: $+{Value}";
}
}
}

# TODO: Actually use configuration file
# ...
6 changes: 6 additions & 0 deletions sample.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#
# This is a comment
#
[server]
hostname=localhost
port=8080

0 comments on commit bb85e9c

Please sign in to comment.