Skip to content

Commit 434372a

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
1 parent 9c65814 commit 434372a

File tree

8 files changed

+207
-73
lines changed

8 files changed

+207
-73
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ before_script:
3939

4040
script:
4141
- phpunit --coverage-clover=coverage.clover
42+
- sudo pip install -r doc/requirements.txt
4243
- make -C doc SPHINXOPTS='-nW' html
4344

4445
after_script:

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: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//$(document).ready(function() {
2+
// $("div.configuration-block li").click(function(event) {
3+
// console.log('clicked');
4+
// event.preventDefault();
5+
// $(this).parent().addClass("current");
6+
// $(this).parent().siblings().removeClass("current");
7+
// var tab = $(this).attr("href");
8+
// $(".tab-content").not(tab).css("display", "none");
9+
// $(tab).fadeIn();
10+
// });
11+
//});
12+
13+
$(document).ready(function(){$("div.configuration-block [class^=highlight-]").hide();$("div.configuration-block").addClass("jsactive");$("div.configuration-block").addClass("clearfix");$("div.configuration-block").each(function(){var a=$("[class^=highlight-]:first",$(this));a.show();a.parents("ul:eq(0)").height(a.height()+40)});$("div.configuration-block li").each(function(){var a=$(":first",$(this)).html();$(":first ",$(this)).html("");$(":first ",$(this)).append('<a href="#">'+a+"</a>");$(":first",$(this)).bind("click",function(){$("[class^=highlight-]",$(this).parents("ul")).hide();$("li",$(this).parents("ul")).removeClass("selected");$(this).parent().addClass("selected");var b=$("[class^=highlight-]",$(this).parent("li"));b.show();b.parents("ul:eq(0)").height(b.height()+40);return false})});$("div.configuration-block").each(function(){$("li:first",$(this)).addClass("selected")})});

doc/conf.py

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,22 @@
55
import sys, os
66
from sphinx.highlighting import lexers
77
from pygments.lexers.web import PhpLexer
8+
from pygments.lexers.agile import RubyLexer
89

910
lexers['php'] = PhpLexer(startinline=True, linenos=1)
11+
lexers['varnish3'] = RubyLexer()
12+
lexers['varnish4'] = RubyLexer()
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('.'))
23+
sys.path.insert(0, os.path.abspath('./../vendor/fabpot/sphinx-php/'))
1724

1825
# -- General configuration -----------------------------------------------------
1926

@@ -22,7 +29,7 @@
2229

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

2734
# Add any paths that contain templates here, relative to this directory.
2835
templates_path = ['_templates']
@@ -88,7 +95,7 @@
8895

8996
# The theme to use for HTML and HTML Help pages. See the documentation for
9097
# a list of builtin themes.
91-
html_theme = 'default'
98+
# html_theme = 'default'
9299

93100
# Theme options are theme-specific and customize the look and feel of a theme
94101
# further. For a list of options available for each theme, see the
@@ -117,7 +124,11 @@
117124
# Add any paths that contain custom static files (such as style sheets) here,
118125
# relative to this directory. They are copied after the builtin static files,
119126
# so a file named "default.css" will overwrite the builtin "default.css".
120-
# html_static_path = ['_static']
127+
html_static_path = ['_static']
128+
129+
def setup(app):
130+
app.add_javascript('tabs.js')
131+
app.add_stylesheet('tabs.css')
121132

122133
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
123134
# using the given strftime format.
@@ -244,3 +255,7 @@
244255

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

258+
config_block = {
259+
'varnish3': 'Varnish 3',
260+
'varnish4': 'Varnish 4'
261+
}

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

Lines changed: 22 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
@@ -45,3 +48,19 @@ For more information about testing, see :doc:`/testing-your-application`.
4548

4649
.. _HHVM: http://www.hhvm.com/
4750
.. _HHVM FastCGI server: https://github.com/facebook/hhvm/wiki/fastcgi
51+
52+
Building the Documentation
53+
--------------------------
54+
55+
First download the requirements:
56+
57+
.. code-block:: bash
58+
59+
$ pip install -r doc/requirements.txt
60+
61+
Then you can build the docs:
62+
63+
.. code-block:: bash
64+
65+
$ cd doc
66+
$ make html

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)