Skip to content

Commit bf4b6cf

Browse files
committed
Show VCL in tabs
Add sphinx-php to pip requirements for building on RTD Rename ‘Testing the Library’ to ‘Contributing’ Add JS and CS for tabs * Make syntax highlighting resemble that of Symfony docs more. Remove fabpot/sphinx-php from require-dev * Now in requirements.txt Improve styling Add pip install to Travis Try to fix static path on RTD Run pip install as sudo on Travis Make border none important Revert path to static Move pip install to install steps Clean up tabs.js Remove sys.path.insert Switch from RubyLexer to CLexer Add link to Sphinx installation Remove duplicated html_theme Show Varnish 4 first
1 parent 9ca60d9 commit bf4b6cf

File tree

8 files changed

+202
-82
lines changed

8 files changed

+202
-82
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ before_script:
3636
- composer update --dev --prefer-source
3737
# Install Sphinx
3838
- sudo apt-get install python-sphinx
39+
- sudo pip install -r doc/requirements.txt
3940

4041
script:
4142
- phpunit --coverage-clover=coverage.clover

doc/_static/tabs.css

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
div.configuration-block {
2+
position: relative;
3+
}
4+
5+
div.configuration-block ul.simple {
6+
margin-left: 38px;
7+
}
8+
9+
div.configuration-block ul.simple li {
10+
list-style: none;
11+
float: left;
12+
margin-left: 0;
13+
margin-right: 1em;
14+
padding: .2em .5em .5em .5em;
15+
height: 38px;
16+
background-color: #c9c9c9;
17+
}
18+
19+
div.configuration-block ul.simple li.selected {
20+
background-color: #343131;
21+
border-bottom: none;
22+
}
23+
24+
div.configuration-block ul.simple li.selected a {
25+
color: white;
26+
}
27+
28+
div.highlight-varnish3, div.highlight-varnish4 {
29+
border: none !important;
30+
}
31+
32+
div.configuration-block em {
33+
font-style: normal;
34+
}
35+
36+
div.configuration-block div {
37+
border-top: none;
38+
position: absolute;
39+
left: 0;
40+
width: 100%;
41+
max-width: 100%;
42+
overflow: auto;
43+
}
44+
45+
div.configuration-block div div {
46+
position: static;
47+
}
48+
49+
div.highlight {
50+
background-color: #343131 !important;
51+
}
52+
53+
div.highlight pre {
54+
border: none;
55+
color: white;
56+
}
57+
58+
div.highlight pre span.n,
59+
div.highlight pre span.na,
60+
div.highlight pre span.nb,
61+
div.highlight pre span.nc,
62+
div.highlight pre span.nf,
63+
div.highlight pre span.nx {
64+
color: white;
65+
}
66+
67+
div.highlight pre span.nv {
68+
color: #6ab0de
69+
}
70+
71+
div.highlight pre span.k, div.highlight pre span.o {
72+
color: #ff8400;
73+
}
74+
75+
div.highlight pre span.mi,
76+
div.highlight pre span.s,
77+
div.highlight pre span.s1,
78+
div.highlight pre span.s2,
79+
div.highlight pre span.sr {
80+
color: #56db3a;
81+
}
82+
83+
div.highlight pre span.hll {
84+
background-color: #848484;
85+
}
86+
87+
div.highlight pre span.p {
88+
color: #b3b3b3;
89+
}
90+
91+
table.highlighttable td {
92+
padding: 0;
93+
}
94+
95+
table.highlighttable td div.linenodiv {
96+
text-align: right;
97+
width: 38px;
98+
}

doc/_static/tabs.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

doc/conf.py

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,29 @@
55
import sys, os
66
from sphinx.highlighting import lexers
77
from pygments.lexers.web import PhpLexer
8+
from pygments.lexers.compiled import CLexer
89

910
lexers['php'] = PhpLexer(startinline=True, linenos=1)
11+
lexers['varnish3'] = CLexer()
12+
lexers['varnish4'] = CLexer()
13+
14+
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
15+
if not on_rtd: # only import and set the theme if we're building docs locally
16+
import sphinx_rtd_theme
17+
html_theme = 'sphinx_rtd_theme'
18+
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
19+
1020
primary_domain = 'php'
1121
highlight_language = 'php'
1222

13-
# If extensions (or modules to document with autodoc) are in another directory,
14-
# add these directories to sys.path here. If the directory is relative to the
15-
# documentation root, use os.path.abspath to make it absolute, like shown here.
16-
#sys.path.insert(0, os.path.abspath('.'))
17-
1823
# -- General configuration -----------------------------------------------------
1924

2025
# If your documentation needs a minimal Sphinx version, state it here.
2126
#needs_sphinx = '1.0'
2227

2328
# Add any Sphinx extension module names here, as strings. They can be extensions
2429
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
25-
extensions = ['sphinx.ext.coverage', 'sphinx.ext.extlinks']
30+
extensions = ['sphinx.ext.coverage', 'sphinx.ext.extlinks', 'sensio.sphinx.configurationblock']
2631

2732
# Add any paths that contain templates here, relative to this directory.
2833
templates_path = ['_templates']
@@ -86,10 +91,6 @@
8691

8792
# -- Options for HTML output ---------------------------------------------------
8893

89-
# The theme to use for HTML and HTML Help pages. See the documentation for
90-
# a list of builtin themes.
91-
html_theme = 'default'
92-
9394
# Theme options are theme-specific and customize the look and feel of a theme
9495
# further. For a list of options available for each theme, see the
9596
# documentation.
@@ -117,7 +118,11 @@
117118
# Add any paths that contain custom static files (such as style sheets) here,
118119
# relative to this directory. They are copied after the builtin static files,
119120
# so a file named "default.css" will overwrite the builtin "default.css".
120-
# html_static_path = ['_static']
121+
html_static_path = ['_static']
122+
123+
def setup(app):
124+
app.add_javascript('tabs.js')
125+
app.add_stylesheet('tabs.css')
121126

122127
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
123128
# using the given strftime format.
@@ -244,3 +249,7 @@
244249

245250
extlinks = {'source': ('https://github.com/FriendsOfSymfony/FOSHttpCache/blob/master/%s', '') }
246251

252+
config_block = {
253+
'varnish3': 'Varnish 3',
254+
'varnish4': 'Varnish 4'
255+
}

doc/testing-the-library.rst renamed to doc/contributing.rst

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
Contributing
2+
============
3+
14
Testing the Library
2-
===================
5+
-------------------
36

47
This chapter describes how to run the tests that are included with this library.
58

@@ -13,7 +16,7 @@ First clone the repository, install the vendors, then run the tests:
1316
$ phpunit
1417
1518
Unit Tests
16-
----------
19+
~~~~~~~~~~
1720

1821
To run the unit tests separately:
1922

@@ -22,7 +25,7 @@ To run the unit tests separately:
2225
$ phpunit tests/Unit
2326
2427
Functional Tests
25-
----------------
28+
~~~~~~~~~~~~~~~~
2629

2730
The library also includes functional tests against a Varnish instance. The
2831
functional test suite by default uses PHP’s built-in web server. If you have
@@ -43,5 +46,24 @@ To run the functional tests:
4346
4447
For more information about testing, see :doc:`/testing-your-application`.
4548

49+
Building the Documentation
50+
--------------------------
51+
52+
First `install Sphinx`_, then download the requirements:
53+
54+
.. code-block:: bash
55+
56+
$ pip install -r doc/requirements.txt
57+
58+
To build the docs:
59+
60+
.. code-block:: bash
61+
62+
$ cd doc
63+
$ make html
64+
4665
.. _HHVM: http://www.hhvm.com/
4766
.. _HHVM FastCGI server: https://github.com/facebook/hhvm/wiki/fastcgi
67+
.. _install Sphinx: http://sphinx-doc.org/latest/install.html
68+
69+

doc/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ Contents:
2424
user-context
2525

2626
testing-your-application
27-
testing-the-library
27+
contributing

doc/requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
git+https://github.com/fabpot/sphinx-php.git
2+
sphinx-rtd-theme==0.1.6

0 commit comments

Comments
 (0)