8000 Merge pull request #50 from kkroening/drawtext-doc · CyberSys/ffmpeg-python@940e3e7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 940e3e7

Browse files
authored
Merge pull request kkroening#50 from kkroening/drawtext-doc
Fix drawtext documentation
2 parents a599899 + 9f7de34 commit 940e3e7

File tree

11 files changed

+299
-119
lines changed

11 files changed

+299
-119
lines changed

doc/html/_static/basic.css

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,10 +445,14 @@ dd {
445445
margin-left: 30px;
446446
}
447447

448-
dt:target, .highlighted {
448+
dt:target, span.highlighted {
449449
background-color: #fbe54e;
450450
}
451451

452+
rect.highlighted {
453+
fill: #fbe54e;
454+
}
455+
452456
dl.glossary dt {
453457
font-weight: bold;
454458
font-size: 1.1em;

doc/html/_static/doctools.js

Lines changed: 38 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jQuery.urlencode = encodeURIComponent;
4545
* it will always return arrays of strings for the value parts.
4646
*/
4747
jQuery.getQueryParameters = function(s) {
48-
if (typeof s == 'undefined')
48+
if (typeof s === 'undefined')
4949
s = document.location.search;
5050
var parts = s.substr(s.indexOf('?') + 1).split('&');
5151
var result = {};
@@ -66,29 +66,53 @@ jQuery.getQueryParameters = function(s) {
6666
* span elements with the given class name.
6767
*/
6868
jQuery.fn.highlightText = function(text, className) {
69-
function highlight(node) {
70-
if (node.nodeType == 3) {
69+
function highlight(node, addItems) {
70+
if (node.nodeType === 3) {
7171
var val = node.nodeValue;
7272
var pos = val.toLowerCase().indexOf(text);
7373
if (pos >= 0 && !jQuery(node.parentNode).hasClass(className)) {
74-
var span = document.createElement("span");
75-
span.className = className;
74+
var span;
75+
var isInSVG = jQuery(node).closest("body, svg, foreignObject").is("svg");
76+
if (isInSVG) {
77+
span = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
78+
} else {
79+
span = document.createElement("span");
80+
span.className = className;
81+
}
7682
span.appendChild(document.createTextNode(val.substr(pos, text.length)));
7783
node.parentNode.insertBefore(span, node.parentNode.insertBefore(
7884
document.createTextNode(val.substr(pos + text.length)),
7985
node.nextSibling));
8086
node.nodeValue = val.substr(0, pos);
87+
if (isInSVG) {
88+
var bbox = span.getBBox();
89+
var rect = document.createElementNS("http://www.w3.org/2000/svg", "rect");
90+
rect.x.baseVal.value = bbox.x;
91+
rect.y.baseVal.value = bbox.y;
92+
rect.width.baseVal.value = bbox.width;
93+
rect.height.baseVal.value = bbox.height;
94+
rect.setAttribute('class', className);
95+
var parentOfText = node.parentNode.parentNode;
96+
addItems.push({
97+
"parent": node.parentNode,
98+
"target": rect});
99+
}
81100
}
82101
}
83102
else if (!jQuery(node).is("button, select, textarea")) {
84103
jQuery.each(node.childNodes, function() {
85-
highlight(this);
104+
highlight(this, addItems);
86105
});
87106
}
88107
}
89-
return this.each(function() {
90-
highlight(this);
108+
var addItems = [];
109+
var result = this.each(function() {
110+
highlight(this, addItems);
91111
});
112+
for (var i = 0; i < addItems.length; ++i) {
113+
jQuery(addItems[i].parent).before(addItems[i].target);
114+
}
115+
return result;
92116
};
93117

94118
/*
@@ -131,21 +155,21 @@ var Documentation = {
131155
* i18n support
132156
*/
133157
TRANSLATIONS : {},
134-
PLURAL_EXPR : function(n) { return n == 1 ? 0 : 1; },
158+
PLURAL_EXPR : function(n) { return n === 1 ? 0 : 1; },
135159
LOCALE : 'unknown',
136160

137161
// gettext and ngettext don't access this so that the functions
138162
// can safely bound to a different name (_ = Documentation.gettext)
139163
gettext : function(string) {
140164
var translated = Documentation.TRANSLATIONS[string];
141-
if (typeof translated == 'undefined')
165+
if (typeof translated === 'undefined')
142166
return string;
143-
return (typeof translated == 'string') ? translated : translated[0];
167+
return (typeof translated === 'string') ? translated : translated[0];
144168
},
145169

146170
ngettext : function(singular, plural, n) {
147171
var translated = Documentation.TRANSLATIONS[singular];
148-
if (typeof translated == 'undefined')
172+
if (typeof translated === 'undefined')
149173
return (n == 1) ? singular : plural;
150174
return translated[Documentation.PLURALEXPR(n)];
151175
},
@@ -216,7 +240,7 @@ var Documentation = {
216240
var src = $(this).attr('src');
217241
var idnum = $(this).attr('id').substr(7);
218242
$('tr.cg-' + idnum).toggle();
219-
if (src.substr(-9) == 'minus.png')
243+
if (src.substr(-9) === 'minus.png')
220244
$(this).attr('src', src.substr(0, src.length-9) + 'plus.png');
221245
else
222246
$(this).attr('src', src.substr(0, src.length-8) + 'minus.png');
@@ -248,7 +272,7 @@ var Documentation = {
248272
var path = document.location.pathname;
2492 10000 73
var parts = path.split(/\//);
250274
$.each(DOCUMENTATION_OPTIONS.URL_ROOT.split(/\//), function() {
251-
if (this == '..')
275+
if (this === '..')
252276
parts.pop();
253277
});
254278
var url = parts.join('/');

doc/html/_static/nature.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
body {
1717
font-family: Arial, sans-serif;
1818
font-size: 100%;
19-
background-color: #111;
19+
background-color: #fff;
2020
color: #555;
2121
margin: 0;
2222
padding: 0;

doc/html/_static/searchtools.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,9 @@ var Search = {
540540
});
541541
} else if (DOCUMENTATION_OPTIONS.HAS_SOURCE) {
542542
var suffix = DOCUMENTATION_OPTIONS.SOURCELINK_SUFFIX;
543+
if (suffix === undefined) {
544+
suffix = '.txt';
545+
}
543546
$.ajax({url: DOCUMENTATION_OPTIONS.URL_ROOT + '_sources/' + item[5] + (item[5].slice(-suffix.length) === suffix ? '' : suffix),
544547
dataType: "text",
545548
complete: function(jqxhr, textstatus) {

doc/html/genindex.html

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,9 @@
66
<html xmlns="http://www.w3.org/1999/xhtml">
77
<head>
88
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
9-
109
<title>Index &#8212; ffmpeg-python documentation</title>
11-
1210
<link rel="stylesheet" href="_static/nature.css" type="text/css" />
1311
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
14-
1512
<script type="text/javascript">
1613
var DOCUMENTATION_OPTIONS = {
1714
URL_ROOT: './',
@@ -74,6 +71,8 @@ <h2 id="C">C</h2>
7471
</ul></td>
7572
<td style="width: 33%; vertical-align: top;"><ul>
7673
<li><a href="index.html#ffmpeg.concat">concat() (in module ffmpeg)</a>
74+
</li>
75+
<li><a href="index.html#ffmpeg.crop">crop() (in module ffmpeg)</a>
7776
</li>
7877
</ul></td>
7978
</tr></table>
@@ -82,6 +81,10 @@ <h2 id="D">D</h2>
8281
<table style="width: 100%" class="indextable genindextable"><tr>
8382
<td style="width: 33%; vertical-align: top;"><ul>
8483
<li><a href="index.html#ffmpeg.drawbox">drawbox() (in module ffmpeg)</a>
84+
</li>
85+
</ul></td>
86+
<td style="width: 33%; vertical-align: top;"><ul>
87+
<li><a href="index.html#ffmpeg.drawtext">drawtext() (in module ffmpeg)</a>
8588
</li>
8689
</ul></td>
8790
</tr></table>
@@ -94,8 +97,6 @@ <h2 id="F">F</h2>
9497
</ul></td>
9598
<td style="width: 33%; vertical-align: top;"><ul>
9699
<li><a href="index.html#ffmpeg.filter_">filter_() (in module ffmpeg)</a>
97-
</li>
98-
<li><a href="index.html#ffmpeg.filter_multi">filter_multi() (in module ffmpeg)</a>
99100
</li>
100101
</ul></td>
101102
</tr></table>
@@ -178,6 +179,10 @@ <h2 id="V">V</h2>
178179
<table style="width: 100%" class="indextable genindextable"><tr>
179180
<td style="width: 33%; vertical-align: top;"><ul>
180181
<li><a href="index.html#ffmpeg.vflip">vflip() (in module ffmpeg)</a>
182+
</li>
183+
</ul></td>
184+
<td style="width: 33%; vertical-align: top;"><ul>
185+
<li><a href="index.html#ffmpeg.view">view() (in module ffmpeg)</a>
181186
</li>
182187
</ul></td>
183188
</tr></table>
@@ -228,7 +233,7 @@ <h3>Navigation</h3>
228233
</div>
229234
<div class="footer" role="contentinfo">
230235
&#169; Copyright 2017, Karl Kroening.
231-
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.6.2.
236+
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.6.5.
232237
</div>
233238
</body>
234239
</html>

0 commit comments

Comments
 (0)
0