sphinxcontrib-screenshot 0.1.0__tar.gz → 0.1.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of sphinxcontrib-screenshot might be problematic. Click here for more details.
- {sphinxcontrib-screenshot-0.1.0 → sphinxcontrib_screenshot-0.1.2}/PKG-INFO +20 -3
- {sphinxcontrib-screenshot-0.1.0 → sphinxcontrib_screenshot-0.1.2}/README.md +18 -2
- {sphinxcontrib-screenshot-0.1.0 → sphinxcontrib_screenshot-0.1.2}/setup.cfg +1 -0
- {sphinxcontrib-screenshot-0.1.0 → sphinxcontrib_screenshot-0.1.2}/sphinxcontrib/screenshot.py +6 -1
- {sphinxcontrib-screenshot-0.1.0 → sphinxcontrib_screenshot-0.1.2}/sphinxcontrib_screenshot.egg-info/PKG-INFO +20 -3
- {sphinxcontrib-screenshot-0.1.0 → sphinxcontrib_screenshot-0.1.2}/sphinxcontrib_screenshot.egg-info/requires.txt +1 -0
- {sphinxcontrib-screenshot-0.1.0 → sphinxcontrib_screenshot-0.1.2}/tests/test_it.py +5 -2
- {sphinxcontrib-screenshot-0.1.0 → sphinxcontrib_screenshot-0.1.2}/LICENSE +0 -0
- {sphinxcontrib-screenshot-0.1.0 → sphinxcontrib_screenshot-0.1.2}/setup.py +0 -0
- {sphinxcontrib-screenshot-0.1.0 → sphinxcontrib_screenshot-0.1.2}/sphinxcontrib_screenshot.egg-info/SOURCES.txt +0 -0
- {sphinxcontrib-screenshot-0.1.0 → sphinxcontrib_screenshot-0.1.2}/sphinxcontrib_screenshot.egg-info/dependency_links.txt +0 -0
- {sphinxcontrib-screenshot-0.1.0 → sphinxcontrib_screenshot-0.1.2}/sphinxcontrib_screenshot.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: sphinxcontrib-screenshot
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: A Shpinx extension to embed webpage screenshots.
|
|
5
5
|
Home-page: https://github.com/tushuhei/sphinxcontrib-screenshot/
|
|
6
6
|
Author: Shuhei Iitsuka
|
|
@@ -25,6 +25,7 @@ Requires-Dist: isort; extra == "dev"
|
|
|
25
25
|
Requires-Dist: mypy; extra == "dev"
|
|
26
26
|
Requires-Dist: Pillow; extra == "dev"
|
|
27
27
|
Requires-Dist: pytest; extra == "dev"
|
|
28
|
+
Requires-Dist: sphinx[test]; extra == "dev"
|
|
28
29
|
Requires-Dist: toml; extra == "dev"
|
|
29
30
|
Requires-Dist: twine; extra == "dev"
|
|
30
31
|
Requires-Dist: types-beautifulsoup4; extra == "dev"
|
|
@@ -37,6 +38,8 @@ Requires-Dist: yapf; extra == "dev"
|
|
|
37
38
|
|
|
38
39
|
A Sphinx extension to embed website screenshots.
|
|
39
40
|
|
|
41
|
+

|
|
42
|
+
|
|
40
43
|
## Install
|
|
41
44
|
|
|
42
45
|
```bash
|
|
@@ -73,12 +76,26 @@ You can include a caption for the screenshot's `figure` directive.
|
|
|
73
76
|
:caption: This is a screenshot for www.example.com
|
|
74
77
|
```
|
|
75
78
|
|
|
76
|
-
You can describe the interaction that you want to have with the webpage before taking a screenshot
|
|
79
|
+
You can describe the interaction that you want to have with the webpage before taking a screenshot in JavaScript.
|
|
77
80
|
|
|
78
81
|
```rst
|
|
79
82
|
.. screenshot:: http://www.example.com
|
|
80
83
|
|
|
81
|
-
|
|
84
|
+
document.querySelector('button').click();
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Pro tips
|
|
88
|
+
`sphinxcontrib-screenshot` supports URLs with the HTTP and HTTPS protocols.
|
|
89
|
+
To take screenshots of local files and build the document while running a local server for them, you can use the NPM library [concurrently](https://www.npmjs.com/package/concurrently) in the following way:
|
|
90
|
+
|
|
91
|
+
### Build the document
|
|
92
|
+
```bash
|
|
93
|
+
npx --yes concurrently -k --success=first "make html" "python3 -m http.server 3000 --directory=examples"
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Watch and build the document
|
|
97
|
+
```bash
|
|
98
|
+
npx --yes concurrently -k "make livehtml" "python3 -m http.server 3000 --directory=examples"
|
|
82
99
|
```
|
|
83
100
|
|
|
84
101
|
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
A Sphinx extension to embed website screenshots.
|
|
4
4
|
|
|
5
|
+

|
|
6
|
+
|
|
5
7
|
## Install
|
|
6
8
|
|
|
7
9
|
```bash
|
|
@@ -38,12 +40,26 @@ You can include a caption for the screenshot's `figure` directive.
|
|
|
38
40
|
:caption: This is a screenshot for www.example.com
|
|
39
41
|
```
|
|
40
42
|
|
|
41
|
-
You can describe the interaction that you want to have with the webpage before taking a screenshot
|
|
43
|
+
You can describe the interaction that you want to have with the webpage before taking a screenshot in JavaScript.
|
|
42
44
|
|
|
43
45
|
```rst
|
|
44
46
|
.. screenshot:: http://www.example.com
|
|
45
47
|
|
|
46
|
-
|
|
48
|
+
document.querySelector('button').click();
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Pro tips
|
|
52
|
+
`sphinxcontrib-screenshot` supports URLs with the HTTP and HTTPS protocols.
|
|
53
|
+
To take screenshots of local files and build the document while running a local server for them, you can use the NPM library [concurrently](https://www.npmjs.com/package/concurrently) in the following way:
|
|
54
|
+
|
|
55
|
+
### Build the document
|
|
56
|
+
```bash
|
|
57
|
+
npx --yes concurrently -k --success=first "make html" "python3 -m http.server 3000 --directory=examples"
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Watch and build the document
|
|
61
|
+
```bash
|
|
62
|
+
npx --yes concurrently -k "make livehtml" "python3 -m http.server 3000 --directory=examples"
|
|
47
63
|
```
|
|
48
64
|
|
|
49
65
|
|
{sphinxcontrib-screenshot-0.1.0 → sphinxcontrib_screenshot-0.1.2}/sphinxcontrib/screenshot.py
RENAMED
|
@@ -32,7 +32,7 @@ Meta = typing.TypedDict('Meta', {
|
|
|
32
32
|
'parallel_write_safe': bool
|
|
33
33
|
})
|
|
34
34
|
|
|
35
|
-
__version__ = '0.1.
|
|
35
|
+
__version__ = '0.1.2'
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
class ScreenshotDirective(SphinxDirective):
|
|
@@ -80,6 +80,7 @@ class ScreenshotDirective(SphinxDirective):
|
|
|
80
80
|
'height': directives.positive_int,
|
|
81
81
|
'width': directives.positive_int,
|
|
82
82
|
'caption': directives.unchanged,
|
|
83
|
+
'figclass': directives.unchanged,
|
|
83
84
|
}
|
|
84
85
|
pool = ThreadPoolExecutor()
|
|
85
86
|
|
|
@@ -133,6 +134,7 @@ class ScreenshotDirective(SphinxDirective):
|
|
|
133
134
|
height = self.options.get('height', 960)
|
|
134
135
|
width = self.options.get('width', 1280)
|
|
135
136
|
caption_text = self.options.get('caption', '')
|
|
137
|
+
figclass = self.options.get('figclass', '')
|
|
136
138
|
interactions = '\n'.join(self.content)
|
|
137
139
|
|
|
138
140
|
if urlparse(url).scheme not in {'http', 'https'}:
|
|
@@ -158,6 +160,9 @@ class ScreenshotDirective(SphinxDirective):
|
|
|
158
160
|
image_node = nodes.image(uri=rel_filepath)
|
|
159
161
|
figure_node = nodes.figure('', image_node)
|
|
160
162
|
|
|
163
|
+
if figclass:
|
|
164
|
+
figure_node['classes'].append(figclass)
|
|
165
|
+
|
|
161
166
|
if caption_text:
|
|
162
167
|
parsed = nodes.Element()
|
|
163
168
|
self.state.nested_parse(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: sphinxcontrib-screenshot
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: A Shpinx extension to embed webpage screenshots.
|
|
5
5
|
Home-page: https://github.com/tushuhei/sphinxcontrib-screenshot/
|
|
6
6
|
Author: Shuhei Iitsuka
|
|
@@ -25,6 +25,7 @@ Requires-Dist: isort; extra == "dev"
|
|
|
25
25
|
Requires-Dist: mypy; extra == "dev"
|
|
26
26
|
Requires-Dist: Pillow; extra == "dev"
|
|
27
27
|
Requires-Dist: pytest; extra == "dev"
|
|
28
|
+
Requires-Dist: sphinx[test]; extra == "dev"
|
|
28
29
|
Requires-Dist: toml; extra == "dev"
|
|
29
30
|
Requires-Dist: twine; extra == "dev"
|
|
30
31
|
Requires-Dist: types-beautifulsoup4; extra == "dev"
|
|
@@ -37,6 +38,8 @@ Requires-Dist: yapf; extra == "dev"
|
|
|
37
38
|
|
|
38
39
|
A Sphinx extension to embed website screenshots.
|
|
39
40
|
|
|
41
|
+

|
|
42
|
+
|
|
40
43
|
## Install
|
|
41
44
|
|
|
42
45
|
```bash
|
|
@@ -73,12 +76,26 @@ You can include a caption for the screenshot's `figure` directive.
|
|
|
73
76
|
:caption: This is a screenshot for www.example.com
|
|
74
77
|
```
|
|
75
78
|
|
|
76
|
-
You can describe the interaction that you want to have with the webpage before taking a screenshot
|
|
79
|
+
You can describe the interaction that you want to have with the webpage before taking a screenshot in JavaScript.
|
|
77
80
|
|
|
78
81
|
```rst
|
|
79
82
|
.. screenshot:: http://www.example.com
|
|
80
83
|
|
|
81
|
-
|
|
84
|
+
document.querySelector('button').click();
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Pro tips
|
|
88
|
+
`sphinxcontrib-screenshot` supports URLs with the HTTP and HTTPS protocols.
|
|
89
|
+
To take screenshots of local files and build the document while running a local server for them, you can use the NPM library [concurrently](https://www.npmjs.com/package/concurrently) in the following way:
|
|
90
|
+
|
|
91
|
+
### Build the document
|
|
92
|
+
```bash
|
|
93
|
+
npx --yes concurrently -k --success=first "make html" "python3 -m http.server 3000 --directory=examples"
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Watch and build the document
|
|
97
|
+
```bash
|
|
98
|
+
npx --yes concurrently -k "make livehtml" "python3 -m http.server 3000 --directory=examples"
|
|
82
99
|
```
|
|
83
100
|
|
|
84
101
|
|
|
@@ -29,7 +29,7 @@ def test_default(app: SphinxTestApp, status: StringIO,
|
|
|
29
29
|
|
|
30
30
|
# Every screenshot directive should become an image.
|
|
31
31
|
imgs = soup.find_all('img')
|
|
32
|
-
assert len(list(imgs)) ==
|
|
32
|
+
assert len(list(imgs)) == 4
|
|
33
33
|
|
|
34
34
|
# The image size should be set as specified.
|
|
35
35
|
img_obj = Image.open(app.outdir / imgs[0]['src'])
|
|
@@ -44,7 +44,7 @@ def test_default(app: SphinxTestApp, status: StringIO,
|
|
|
44
44
|
|
|
45
45
|
# The images should be different after the specified user interaction.
|
|
46
46
|
img_before_interaction = Image.open(app.outdir / imgs[0]['src'])
|
|
47
|
-
img_after_interaction = Image.open(app.outdir / imgs[
|
|
47
|
+
img_after_interaction = Image.open(app.outdir / imgs[2]['src'])
|
|
48
48
|
assert list(img_before_interaction.getdata()) != list(
|
|
49
49
|
img_after_interaction.getdata())
|
|
50
50
|
|
|
@@ -52,3 +52,6 @@ def test_default(app: SphinxTestApp, status: StringIO,
|
|
|
52
52
|
img_with_caption_a = imgs[0]
|
|
53
53
|
img_with_caption_b = imgs[1]
|
|
54
54
|
assert img_with_caption_a['src'] == img_with_caption_b['src']
|
|
55
|
+
|
|
56
|
+
# The figure node should have the class name specified.
|
|
57
|
+
assert 'round' in soup.find_all('figure')[-1]['class']
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|