forked from NatronGitHub/Natron
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNodeDocumentation.cpp
601 lines (548 loc) · 31.1 KB
/
NodeDocumentation.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
/* ***** BEGIN LICENSE BLOCK *****
* This file is part of Natron <https://natrongithub.github.io/>,
* (C) 2018-2021 The Natron developers
* (C) 2013-2018 INRIA and Alexandre Gauthier-Foichat
*
* Natron is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Natron is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Natron. If not, see <http://www.gnu.org/licenses/gpl-2.0.html>
* ***** END LICENSE BLOCK ***** */
// ***** BEGIN PYTHON BLOCK *****
// from <https://docs.python.org/3/c-api/intro.html#include-files>:
// "Since Python may define some pre-processor definitions which affect the standard headers on some systems, you must include Python.h before any standard headers are included."
#include <Python.h>
// ***** END PYTHON BLOCK *****
#include "NodePrivate.h"
#include <QtCore/QTextStream>
#include <QtCore/QFile>
#include "Engine/EffectInstance.h"
#include "Engine/KnobTypes.h"
#include "Engine/Utils.h"
NATRON_NAMESPACE_ENTER
// those parameters should be ignored (they are always secret in Natron)
#define kOCIOParamInputSpace "ocioInputSpace"
#define kOCIOParamOutputSpace "ocioOutputSpace"
// those parameters should not have their options in the help file if generating markdown,
// because the options are dinamlically constructed at run-time from the OCIO config.
#define kOCIOParamInputSpaceChoice "ocioInputSpaceIndex"
#define kOCIOParamOutputSpaceChoice "ocioOutputSpaceIndex"
#define kOCIODisplayPluginIdentifier "fr.inria.openfx.OCIODisplay"
#define kOCIODisplayParamDisplay "display"
#define kOCIODisplayParamDisplayChoice "displayIndex"
#define kOCIODisplayParamView "view"
#define kOCIODisplayParamViewChoice "viewIndex"
// not yet implemented (see OCIOCDLTransform.cpp)
//#define kOCIOCDLTransformPluginIdentifier "fr.inria.openfx.OCIOCDLTransform"
//#define kOCIOCDLTransformParamCCCID "cccId"
//#define kOCIOCDLTransformParamCCCIDChoice "cccIdIndex"
#define kOCIOFileTransformPluginIdentifier "fr.inria.openfx.OCIOFileTransform"
#define kOCIOFileTransformParamCCCID "cccId"
#define kOCIOFileTransformParamCCCIDChoice "cccIdIndex"
// genHTML: true for live HTML output for the internal web-server, false for markdown output
QString
Node::makeDocumentation(bool genHTML) const
{
QString ret;
QString markdown;
QTextStream ts(&ret);
QTextStream ms(&markdown);
QString pluginID, pluginLabel, pluginDescription, pluginIcon;
int majorVersion = getMajorVersion();
int minorVersion = getMinorVersion();
QStringList pluginGroup;
bool pluginDescriptionIsMarkdown = false;
QVector<QStringList> inputs;
QVector<QStringList> items;
{
QMutexLocker k(&_imp->pyPluginInfoMutex);
if (_imp->pyPlugInfo.isPyPlug) {
pluginID = QString::fromUtf8( _imp->pyPlugInfo.pyPlugID.c_str() );
pluginLabel = QString::fromUtf8( _imp->pyPlugInfo.pyPlugLabel.c_str() );
pluginDescription = QString::fromUtf8( _imp->pyPlugInfo.pyPlugDesc.c_str() );
pluginIcon = QString::fromUtf8( _imp->pyPlugInfo.pyPlugIconFilePath.c_str() );
for (std::list<std::string>::const_iterator it = _imp->pyPlugInfo.pyPlugGrouping.begin() ; it != _imp->pyPlugInfo.pyPlugGrouping.end(); ++it) {
pluginGroup.push_back(QString::fromUtf8(it->c_str()));
}
} else {
pluginID = _imp->plugin->getPluginID();
pluginLabel = Plugin::makeLabelWithoutSuffix( _imp->plugin->getPluginLabel() );
pluginDescription = QString::fromUtf8( _imp->effect->getPluginDescription().c_str() );
pluginIcon = _imp->plugin->getIconFilePath();
pluginGroup = _imp->plugin->getGrouping();
pluginDescriptionIsMarkdown = _imp->effect->isPluginDescriptionInMarkdown();
}
for (int i = 0; i < _imp->effect->getNInputs(); ++i) {
QStringList input;
input << convertFromPlainTextToMarkdown( QString::fromStdString( _imp->effect->getInputLabel(i) ), genHTML, true );
input << convertFromPlainTextToMarkdown( QString::fromStdString( _imp->effect->getInputHint(i) ), genHTML, true );
input << ( _imp->effect->isInputOptional(i) ? tr("Yes") : tr("No") );
inputs.push_back(input);
// Don't show more than doc for 4 inputs otherwise it will just clutter the page
if (i == 3) {
break;
}
}
}
// check for plugin icon
QString pluginIconUrl;
if ( !pluginIcon.isEmpty() ) {
QFile iconFile(pluginIcon);
if ( iconFile.exists() ) {
if (genHTML) {
pluginIconUrl.append( QString::fromUtf8("/LOCAL_FILE/") );
pluginIconUrl.append(pluginIcon);
pluginIconUrl.replace( QString::fromUtf8("\\"), QString::fromUtf8("/") );
} else {
pluginIconUrl.append(pluginID);
pluginIconUrl.append(QString::fromUtf8(".png"));
}
}
}
// check for extra markdown file
QString extraMarkdown;
QString pluginMD = pluginIcon;
pluginMD.replace( QString::fromUtf8(".png"), QString::fromUtf8(".md") );
QFile pluginMarkdownFile(pluginMD);
if ( pluginMarkdownFile.exists() ) {
if ( pluginMarkdownFile.open(QIODevice::ReadOnly | QIODevice::Text) ) {
extraMarkdown = QString::fromUtf8( pluginMarkdownFile.readAll() );
pluginMarkdownFile.close();
}
}
// generate knobs info
KnobsVec knobs = getEffectInstance()->getKnobs_mt_safe();
for (KnobsVec::const_iterator it = knobs.begin(); it != knobs.end(); ++it) {
if ( (*it)->getDefaultIsSecret() ) {
continue;
}
if ( !(*it)->isDeclaredByPlugin() && !( isPyPlug() && (*it)->isUserKnob() ) ) {
continue;
}
// do not escape characters in the scriptName, since it will be put between backquotes
QString knobScriptName = /*NATRON_NAMESPACE::convertFromPlainTextToMarkdown(*/ QString::fromUtf8( (*it)->getName().c_str() )/*, genHTML, true)*/;
QString knobLabel = NATRON_NAMESPACE::convertFromPlainTextToMarkdown( QString::fromUtf8( (*it)->getLabel().c_str() ), genHTML, true);
QString knobHint = NATRON_NAMESPACE::convertFromPlainTextToMarkdown( QString::fromUtf8( (*it)->getHintToolTip().c_str() ), genHTML, true);
// totally ignore the documentation for these parameters (which are always secret in Natron)
if ( knobScriptName.startsWith( QString::fromUtf8("NatronOfxParam") ) ||
knobScriptName == QString::fromUtf8("exportAsPyPlug") ||
knobScriptName == QString::fromUtf8(kOCIOParamInputSpace) ||
knobScriptName == QString::fromUtf8(kOCIOParamOutputSpace) ||
( ( pluginID == QString::fromUtf8(kOCIODisplayPluginIdentifier) ) &&
( knobScriptName == QString::fromUtf8(kOCIODisplayParamDisplay) ) ) ||
( ( pluginID == QString::fromUtf8(kOCIODisplayPluginIdentifier) ) &&
( knobScriptName == QString::fromUtf8(kOCIODisplayParamView) ) ) ||
//( ( pluginID == QString::fromUtf8(kOCIOCDLTransformPluginIdentifier) ) &&
// ( knobScriptName == QString::fromUtf8(kOCIOCDLTransformParamCCCID) ) ) ||
( ( pluginID == QString::fromUtf8(kOCIOFileTransformPluginIdentifier) ) &&
( knobScriptName == QString::fromUtf8(kOCIOFileTransformParamCCCID) ) ) ||
false ) {
continue;
}
QString defValuesStr, knobType;
std::vector<std::pair<QString, QString> > dimsDefaultValueStr;
KnobInt* isInt = dynamic_cast<KnobInt*>( it->get() );
KnobChoice* isChoice = dynamic_cast<KnobChoice*>( it->get() );
KnobBool* isBool = dynamic_cast<KnobBool*>( it->get() );
KnobDouble* isDbl = dynamic_cast<KnobDouble*>( it->get() );
KnobString* isString = dynamic_cast<KnobString*>( it->get() );
bool isLabel = isString && isString->isLabel();
KnobSeparator* isSep = dynamic_cast<KnobSeparator*>( it->get() );
KnobButton* isBtn = dynamic_cast<KnobButton*>( it->get() );
KnobParametric* isParametric = dynamic_cast<KnobParametric*>( it->get() );
KnobGroup* isGroup = dynamic_cast<KnobGroup*>( it->get() );
KnobPage* isPage = dynamic_cast<KnobPage*>( it->get() );
KnobColor* isColor = dynamic_cast<KnobColor*>( it->get() );
if (isInt) {
knobType = tr("Integer");
} else if (isChoice) {
knobType = tr("Choice");
} else if (isBool) {
knobType = tr("Boolean");
} else if (isDbl) {
knobType = tr("Double");
} else if (isString) {
if (isLabel) {
knobType = tr("Label");
} else {
knobType = tr("String");
}
} else if (isSep) {
knobType = tr("Separator");
} else if (isBtn) {
knobType = tr("Button");
} else if (isParametric) {
knobType = tr("Parametric");
} else if (isGroup) {
knobType = tr("Group");
} else if (isPage) {
knobType = tr("Page");
} else if (isColor) {
knobType = tr("Color");
} else {
knobType = tr("N/A");
}
if (!isGroup && !isPage) {
for (int i = 0; i < (*it)->getDimension(); ++i) {
QString valueStr;
if (!isBtn && !isSep && !isParametric) {
// If this is a ChoiceParam and we are not generating live HTML doc,
// only add the list of entries and their help if this node should not be
// ignored (eg. OCIO colorspace knobs).
if ( isChoice &&
(genHTML || !( knobScriptName == QString::fromUtf8(kOCIOParamInputSpaceChoice) ||
knobScriptName == QString::fromUtf8(kOCIOParamOutputSpaceChoice) ||
( ( pluginID == QString::fromUtf8(kOCIODisplayPluginIdentifier) ) &&
( knobScriptName == QString::fromUtf8(kOCIODisplayParamDisplayChoice) ) ) ||
( ( pluginID == QString::fromUtf8(kOCIODisplayPluginIdentifier) ) &&
( knobScriptName == QString::fromUtf8(kOCIODisplayParamViewChoice) ) ) ||
//( ( pluginID == QString::fromUtf8(kOCIOCDLTransformPluginIdentifier) ) &&
// ( knobScriptName == QString::fromUtf8(kOCIOCDLTransformParamCCCIDChoice) ) ) ||
( ( pluginID == QString::fromUtf8(kOCIOFileTransformPluginIdentifier) ) &&
( knobScriptName == QString::fromUtf8(kOCIOFileTransformParamCCCIDChoice) ) ) ||
( ( pluginID == QString::fromUtf8("net.fxarena.openfx.Text") ) &&
( knobScriptName == QString::fromUtf8("name") ) ) || // font family from Text plugin
( ( pluginID == QString::fromUtf8("net.fxarena.openfx.Polaroid") ) &&
( knobScriptName == QString::fromUtf8("font") ) ) || // font family from Polaroid plugin
( ( pluginID == QString::fromUtf8(PLUGINID_NATRON_PRECOMP) ) &&
( knobScriptName == QString::fromUtf8("writeNode") ) ) ||
( ( pluginID == QString::fromUtf8(PLUGINID_NATRON_ONEVIEW) ) &&
( knobScriptName == QString::fromUtf8("view") ) ) ) ) ) {
// see also KnobChoice::getHintToolTipFull()
int index = isChoice->getDefaultValue(i);
std::vector<ChoiceOption> entries = isChoice->getEntries_mt_safe();
if ( (index >= 0) && ( index < (int)entries.size() ) ) {
valueStr = QString::fromUtf8( entries[index].label.c_str() );
}
bool first = true;
for (size_t i = 0; i < entries.size(); i++) {
QString entryHelp = QString::fromUtf8( entries[i].tooltip.c_str() );
QString entry;
if (entries[i].id != entries[i].label) {
entry = QString::fromUtf8( "%1 (%2)" ).arg(QString::fromUtf8( entries[i].label.c_str() )).arg(QString::fromUtf8( entries[i].id.c_str() ));
} else {
entry = QString::fromUtf8( entries[i].label.c_str() );
}
if (!entry.isEmpty()) {
if (first) {
// empty line before the option descriptions
if (genHTML) {
if ( !knobHint.isEmpty() ) {
knobHint.append( QString::fromUtf8("<br />") );
}
// "Possible values:" clutters the documentation.
//knobHint.append( tr("Possible values:") + QString::fromUtf8("<br />") );
} else {
// we do a hack for multiline elements, because the markdown->rst conversion by pandoc doesn't use the line block syntax.
// what we do here is put a supplementary dot at the beginning of each line, which is then converted to a pipe '|' in the
// genStaticDocs.sh script by a simple sed command after converting to RsT
if ( !knobHint.isEmpty() ) {
if (!knobHint.startsWith( QString::fromUtf8(". ") )) {
knobHint.prepend( QString::fromUtf8(". ") );
}
knobHint.append( QString::fromUtf8("\\\n") );
}
// "Possible values:" clutters the documentation.
//knobHint.append( QString::fromUtf8(". ") + tr("Possible values:") + QString::fromUtf8("\\\n") );
}
first = false;
}
if (genHTML) {
knobHint.append( QString::fromUtf8("<br />") );
} else {
knobHint.append( QString::fromUtf8("\\\n") );
// we do a hack for multiline elements, because the markdown->rst conversion by pandoc doesn't use the line block syntax.
// what we do here is put a supplementary dot at the beginning of each line, which is then converted to a pipe '|' in the
// genStaticDocs.sh script by a simple sed command after converting to RsT
knobHint.append( QString::fromUtf8(". ") );
}
if (entryHelp.isEmpty()) {
knobHint.append( QString::fromUtf8("**%1**").arg( convertFromPlainTextToMarkdown(entry, genHTML, true) ) );
} else {
knobHint.append( QString::fromUtf8("**%1**: %2").arg( convertFromPlainTextToMarkdown(entry, genHTML, true) ).arg( convertFromPlainTextToMarkdown(entryHelp, genHTML, true) ) );
}
}
}
} else if (isInt) {
valueStr = QString::number( isInt->getDefaultValue(i) );
} else if (isDbl) {
valueStr = QString::number( isDbl->getDefaultValue(i) );
} else if (isBool) {
valueStr = isBool->getDefaultValue(i) ? tr("On") : tr("Off");
} else if (isString) {
valueStr = QString::fromUtf8( isString->getDefaultValue(i).c_str() );
} else if (isColor) {
valueStr = QString::number( isColor->getDefaultValue(i) );
}
}
dimsDefaultValueStr.push_back( std::make_pair(convertFromPlainTextToMarkdown( QString::fromUtf8( (*it)->getDimensionName(i).c_str() ), genHTML, true ),
convertFromPlainTextToMarkdown(valueStr, genHTML, true)) );
}
for (std::size_t i = 0; i < dimsDefaultValueStr.size(); ++i) {
if ( !dimsDefaultValueStr[i].second.isEmpty() ) {
if (dimsDefaultValueStr.size() > 1) {
defValuesStr.append(dimsDefaultValueStr[i].first);
defValuesStr.append( QString::fromUtf8(": ") );
}
defValuesStr.append(dimsDefaultValueStr[i].second);
if (i < dimsDefaultValueStr.size() - 1) {
defValuesStr.append( QString::fromUtf8(" ") );
}
}
}
if ( defValuesStr.isEmpty() ) {
defValuesStr = tr("N/A");
}
}
if (!isPage && !isSep && !isGroup && !isLabel) {
QStringList row;
row << knobLabel << knobScriptName << knobType << defValuesStr << knobHint;
items.append(row);
}
} // for (KnobsVec::const_iterator it = knobs.begin(); it!=knobs.end(); ++it) {
// Generate plugin info
// section header must be first, or cross-refs will not work:
// Documentation/source/plugins/net.sf.openfx.MergeMatte.rst:10: WARNING: undefined label: net.sf.openfx.mergeplugin (if the link has no caption the label must precede a section header)
ms << tr("%1 node").arg(pluginLabel) << "\n==========\n\n";
ms << ( QString::fromUtf8("<!-- ") + tr("Do not edit this file! It is generated automatically by %1 itself.").arg ( QString::fromUtf8( NATRON_APPLICATION_NAME) ) + QString::fromUtf8(" -->\n\n") );
// a hack to avoid repeating the documentation for the various merge plugins
if ( pluginID.startsWith( QString::fromUtf8("net.sf.openfx.Merge") ) ) {
std::string id = pluginID.toStdString();
std::string op;
if (id == PLUGINID_OFX_MERGE) {
// do nothing
} else if (id == "net.sf.openfx.MergeDifference") {
op = "difference (a.k.a. absminus)";
} else if (id == "net.sf.openfx.MergeIn") {
op = "in";
} else if (id == "net.sf.openfx.MergeMatte") {
op = "matte";
} else if (id == "net.sf.openfx.MergeMax") {
op = "max";
} else if (id == "net.sf.openfx.MergeMin") {
op = "min";
} else if (id == "net.sf.openfx.MergeMultiply") {
op = "multiply";
} else if (id == "net.sf.openfx.MergeOut") {
op = "out";
} else if (id == "net.sf.openfx.MergePlus") {
op = "plus";
} else if (id == "net.sf.openfx.MergeScreen") {
op = "screen";
}
if ( !op.empty() ) {
// we should use the custom link "[Merge node](|http::/plugins/" PLUGINID_OFX_MERGE ".html||rst::net.sf.openfx.MergePlugin|)"
// but pandoc borks it
ms << tr("The *%1* node is a convenience node identical to the %2, except that the operator is set to *%3* by default.")
.arg(pluginLabel)
.arg(genHTML ? QString::fromUtf8("<a href=\"" PLUGINID_OFX_MERGE ".html\">Merge node</a>") :
QString::fromUtf8(":ref:`" PLUGINID_OFX_MERGE "`")
//QString::fromUtf8("[Merge node](http::/plugins/" PLUGINID_OFX_MERGE ".html)")
)
.arg( QString::fromUtf8( op.c_str() ) );
goto OUTPUT;
}
}
if (!pluginIconUrl.isEmpty()) {
// add a nonbreaking space so that pandoc doesn't use the alt-text as a caption
// http://pandoc.org/MANUAL.html#images
ms << "";
if (!genHTML) {
// specify image width for pandoc-generated printed doc
// (for hoedown-generated HTML, this handled by the CSS using the alt=pluginIcon attribute)
// see http://pandoc.org/MANUAL.html#images
// note that only % units are understood both by pandox and sphinx
ms << "{ width=10% }";
}
ms << " \n\n"; // required so that there is no legend when converted to rst by pandoc
}
ms << tr("*This documentation is for version %1.%2 of %3 (%4).*").arg(majorVersion).arg(minorVersion).arg(pluginLabel).arg(pluginID) << "\n\n";
ms << "\n" << tr("Description") << "\n--------------------------------------------------------------------------------\n\n";
if (!pluginDescriptionIsMarkdown) {
if (genHTML) {
pluginDescription = NATRON_NAMESPACE::convertFromPlainText(pluginDescription, NATRON_NAMESPACE::WhiteSpaceNormal);
// replace URLs with links
QRegExp re( QString::fromUtf8("((http|ftp|https)://([\\w_-]+(?:(?:\\.[\\w_-]+)+))([\\w.,@?^=%&:/~+#-]*[\\w@?^=%&/~+#-])?)") );
pluginDescription.replace( re, QString::fromUtf8("<a href=\"\\1\">\\1</a>") );
} else {
pluginDescription = convertFromPlainTextToMarkdown(pluginDescription, genHTML, false);
}
}
ms << pluginDescription << "\n";
// add extra markdown if available
if ( !extraMarkdown.isEmpty() ) {
ms << "\n\n";
ms << extraMarkdown;
}
// create markdown table
ms << "\n" << tr("Inputs") << "\n--------------------------------------------------------------------------------\n\n";
ms << tr("Input") << " | " << tr("Description") << " | " << tr("Optional") << "\n";
ms << "--- | --- | ---\n";
if (inputs.size() > 0) {
Q_FOREACH(const QStringList &input, inputs) {
QString inputName = input.at(0);
QString inputDesc = input.at(1);
QString inputOpt = input.at(2);
ms << inputName << " | " << inputDesc << " | " << inputOpt << "\n";
}
}
ms << "\n" << tr("Controls") << "\n--------------------------------------------------------------------------------\n\n";
if (!genHTML) {
// insert a special marker to be replaced in rst by the genStaticDocs.sh script)
ms << "CONTROLSTABLEPROPS\n\n";
}
ms << tr("Parameter / script name") << " | " << tr("Type") << " | " << tr("Default") << " | " << tr("Function") << "\n";
ms << "--- | --- | --- | ---\n";
if (items.size() > 0) {
Q_FOREACH(const QStringList &item, items) {
QString itemLabel = item.at(0);
QString itemScript = item.at(1);
QString itemType = item.at(2);
QString itemDefault = item.at(3);
QString itemFunction = item.at(4);
ms << itemLabel << " / `" << itemScript << "` | " << itemType << " | " << itemDefault << " | " << itemFunction << "\n";
}
}
OUTPUT:
// output
if (genHTML) {
// use hoedown to convert to HTML
// See Documentation/templates for how to grab header/footer from the latest Sphinx version
QString groupString; // %2 in plugin_head
if ( !pluginGroup.isEmpty() ) {
QString group = pluginGroup.at(0);
if (!group.isEmpty()) {
groupString = QString::fromUtf8("<li><a href=\"../_group.html?id=%1\">%1 nodes</a> »</li>").arg(group);
}
}
QString plugin_head =
QString::fromUtf8(
"<!DOCTYPE html>\n"
"<!--[if IE 8]><html class=\"no-js lt-ie9\" lang=\"en\" > <![endif]-->\n"
"<!--[if gt IE 8]><!--> <html class=\"no-js\" lang=\"en\" > <!--<![endif]-->\n"
"<head>\n"
"<meta charset=\"utf-8\">\n"
"<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n"
"<title>%1 node — NATRON_DOCUMENTATION</title>\n"
"<script type=\"text/javascript\" src=\"../_static/js/modernizr.min.js\"></script>\n"
"<script type=\"text/javascript\" id=\"documentation_options\" data-url_root=\"../\" src=\"../_static/documentation_options.js\"></script>\n"
"<script src=\"../_static/jquery.js\"></script>\n"
"<script src=\"../_static/underscore.js\"></script>\n"
"<script src=\"../_static/doctools.js\"></script>\n"
"<script src=\"../_static/language_data.js\"></script>\n"
"<script async=\"async\" src=\"https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS-MML_HTMLorMML\"></script>\n"
"<script type=\"text/javascript\" src=\"../_static/js/theme.js\"></script>\n"
"<link rel=\"stylesheet\" href=\"../_static/css/theme.css\" type=\"text/css\" />\n"
"<link rel=\"stylesheet\" href=\"../_static/pygments.css\" type=\"text/css\" />\n"
"<link rel=\"stylesheet\" href=\"../_static/theme_overrides.css\" type=\"text/css\" />\n"
"<link rel=\"index\" title=\"Index\" href=\"../genindex.html\" />\n"
"<link rel=\"search\" title=\"Search\" href=\"../search.html\" />\n"
"</head>\n"
"<body class=\"wy-body-for-nav\">\n"
"<div class=\"wy-grid-for-nav\">\n"
"<nav data-toggle=\"wy-nav-shift\" class=\"wy-nav-side\">\n"
"<div class=\"wy-side-scroll\">\n"
"<div class=\"wy-side-nav-search\" >\n"
"<a href=\"../index.html\" class=\"icon icon-home\"> Natron\n"
"<img src=\"../_static/logo.png\" class=\"logo\" alt=\"Logo\"/>\n"
"</a>\n"
"<div class=\"version\">\n"
"2.3\n"
"</div>\n"
"<div role=\"search\">\n"
"<form id=\"rtd-search-form\" class=\"wy-form\" action=\"../search.html\" method=\"get\">\n"
"<input type=\"text\" name=\"q\" placeholder=\"Search docs\" />\n"
"<input type=\"hidden\" name=\"check_keywords\" value=\"yes\" />\n"
"<input type=\"hidden\" name=\"area\" value=\"default\" />\n"
"</form>\n"
"</div>\n"
"</div>\n"
"<div class=\"wy-menu wy-menu-vertical\" data-spy=\"affix\" role=\"navigation\" aria-label=\"main navigation\">\n"
"<ul class=\"current\">\n"
"<li class=\"toctree-l1\"><a class=\"reference internal\" href=\"../guide/index.html\">User Guide</a></li>\n"
"<li class=\"toctree-l1 current\"><a class=\"reference internal\" href=\"../_group.html\">Reference Guide</a><ul class=\"current\">\n"
"<li class=\"toctree-l2\"><a class=\"reference internal\" href=\"../_prefs.html\">Preferences</a></li>\n"
"<li class=\"toctree-l2\"><a class=\"reference internal\" href=\"../_environment.html\">Environment Variables</a></li>\n"
"<li class=\"toctree-l2\"><a class=\"reference internal\" href=\"../_groupImage.html\">Image nodes</a></li>\n"
"<li class=\"toctree-l2\"><a class=\"reference internal\" href=\"../_groupDraw.html\">Draw nodes</a></li>\n"
"<li class=\"toctree-l2\"><a class=\"reference internal\" href=\"../_groupTime.html\">Time nodes</a></li>\n"
"<li class=\"toctree-l2\"><a class=\"reference internal\" href=\"../_groupChannel.html\">Channel nodes</a></li>\n"
"<li class=\"toctree-l2\"><a class=\"reference internal\" href=\"../_groupColor.html\">Color nodes</a></li>\n"
"<li class=\"toctree-l2\"><a class=\"reference internal\" href=\"../_groupFilter.html\">Filter nodes</a></li>\n"
"<li class=\"toctree-l2\"><a class=\"reference internal\" href=\"../_groupKeyer.html\">Keyer nodes</a></li>\n"
"<li class=\"toctree-l2\"><a class=\"reference internal\" href=\"../_groupMerge.html\">Merge nodes</a></li>\n"
"<li class=\"toctree-l2\"><a class=\"reference internal\" href=\"../_groupTransform.html\">Transform nodes</a></li>\n"
"<li class=\"toctree-l2\"><a class=\"reference internal\" href=\"../_groupViews.html\">Views nodes</a></li>\n"
"<li class=\"toctree-l2\"><a class=\"reference internal\" href=\"../_groupOther.html\">Other nodes</a></li>\n"
"<li class=\"toctree-l2\"><a class=\"reference internal\" href=\"../_groupGMIC.html\">GMIC nodes</a></li>\n"
"<li class=\"toctree-l2\"><a class=\"reference internal\" href=\"../_groupExtra.html\">Extra nodes</a></li>\n"
"</ul>\n"
"</li>\n"
"<li class=\"toctree-l1\"><a class=\"reference internal\" href=\"../devel/index.html\">Developers Guide</a></li>\n"
"</ul>\n"
"</div>\n"
"</div>\n"
"</nav>\n"
"<section data-toggle=\"wy-nav-shift\" class=\"wy-nav-content-wrap\">\n"
"<nav class=\"wy-nav-top\" aria-label=\"top navigation\">\n"
"<i data-toggle=\"wy-nav-top\" class=\"fa fa-bars\"></i>\n"
"<a href=\"../index.html\">Natron</a>\n"
"</nav>\n"
"<div class=\"wy-nav-content\">\n"
"<div class=\"rst-content\">\n"
"<div role=\"navigation\" aria-label=\"breadcrumbs navigation\">\n"
"<ul class=\"wy-breadcrumbs\">\n"
"<li><a href=\"../index.html\">Docs</a> »</li>\n"
"<li><a href=\"../_group.html\">Reference Guide</a> »</li>\n"
"%2\n"
"<li>%1 node</li>\n"
"</ul>\n"
"<hr/>\n"
"</div>\n"
"<div role=\"main\" class=\"document\" itemscope=\"itemscope\" itemtype=\"http://schema.org/Article\">\n"
"<div itemprop=\"articleBody\">\n"
"<div class=\"section\">\n");
QString plugin_foot =
QString::fromUtf8(
"</div>\n"
"</div>\n"
"</div>\n"
"<footer>\n"
"<hr/>\n"
"<div role=\"contentinfo\">\n"
"<p>\n"
"© Copyright 2013-2021 The Natron documentation authors, licensed under CC BY-SA 4.0\n"
"</p>\n"
"</div>\n"
"Built with <a href=\"http://sphinx-doc.org/\">Sphinx</a> using a <a href=\"https://github.com/rtfd/sphinx_rtd_theme\">theme</a> provided by <a href=\"https://readthedocs.org\">Read the Docs</a>.\n"
"</footer>\n"
"</div>\n"
"</div>\n"
"</section>\n"
"</div>\n"
"<script type=\"text/javascript\">\n"
"jQuery(function () {\n"
"SphinxRtdTheme.Navigation.enable(true);\n"
"});\n"
"</script>\n"
"</body>\n"
"</html>\n");
ts << plugin_head.arg(pluginLabel, groupString);
QString html = Markdown::convert2html(markdown);
ts << Markdown::fixNodeHTML(html);
ts << plugin_foot;
} else {
// this markdown will be processed externally by pandoc
ts << markdown;
}
return ret;
} // Node::makeDocumentation
NATRON_NAMESPACE_EXIT