From 172cbe73402b3eb4ab7164398a878397451fa0bc Mon Sep 17 00:00:00 2001 From: Nikolay Tyukaev Date: Tue, 1 Feb 2022 20:39:17 +0300 Subject: [PATCH] DOCS: Fix js and add ipython (#9995) * js and ipython * add to suppress warnings * fixes * fixes * fixes * fixes --- docs/CMakeLists.txt | 12 +--- docs/_static/js/custom.js | 58 +++++++++++-------- docs/_templates/layout.html | 2 +- docs/doxygen-xfail.txt | 4 ++ .../dldt_deployment_optimization_guide.md | 2 +- docs/requirements.txt | 1 + docs/scripts/copy_images.py | 2 +- docs/scripts/doxy_md_filter.py | 4 +- docs/suppress_warnings.txt | 5 ++ 9 files changed, 51 insertions(+), 39 deletions(-) diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt index 2d3ca304f16..4669250627f 100644 --- a/docs/CMakeLists.txt +++ b/docs/CMakeLists.txt @@ -51,7 +51,6 @@ set(ENABLE_OPENVINO_NOTEBOOKS OFF CACHE BOOL "Build with openvino notebooks") set(OMZ_DOCS_DIR "" CACHE PATH "Path to open_model_zoo documentation dir.") set(WORKBENCH_DOCS_DIR "" CACHE PATH "Path to workbench documentation dir.") set(OVMS_DOCS_DIR "" CACHE PATH "Path to model server documentation dir.") -set(GST_DOCS_DIR "" CACHE PATH "Path to gst-video-analytics documentation dir.") set(GRAPH_CSV_DIR "" CACHE PATH "Path to the folder containing csv data for rendering graphs.") function(build_docs) @@ -89,6 +88,8 @@ function(build_docs) # Sphinx folders, doxyrest templates and config set(SPHINX_CONF_IN "${DOCS_SOURCE_DIR}/conf.py") + set(SPHINX_TEMPLATES_IN "${DOCS_SOURCE_DIR}/_templates") + set(SPHINX_TEMPLATES_OUT "${RST_OUTPUT}/_templates") set(SPHINX_CONF_OUT "${RST_OUTPUT}/conf.py") set(SPHINX_STATIC_IN "${DOCS_SOURCE_DIR}/_static") set(SPHINX_STATIC_OUT "${RST_OUTPUT}/_static") @@ -160,14 +161,6 @@ function(build_docs) --output_dir=${DOCS_BUILD_DIR}/ovms) endif() - # gst doc files - if(EXISTS "${GST_DOCS_DIR}") - get_filename_component(GST_DOCS_DIR "${GST_DOCS_DIR}" ABSOLUTE) - list(APPEND commands COMMAND ${PYTHON_EXECUTABLE} ${DOXY_MD_FILTER} - --input_dir=${GST_DOCS_DIR} - --output_dir=${DOCS_BUILD_DIR}/gst) - endif() - add_custom_target(preprocess_docs COMMENT "Preprocess documentation" VERBATIM) @@ -198,6 +191,7 @@ function(build_docs) COMMAND ${PYTHON_EXECUTABLE} ${DOXYGEN_MAPPING_SCRIPT} ${XML_OUTPUT} ${DOCS_BUILD_DIR} ${OpenVINO_SOURCE_DIR}/../ COMMAND ${CMAKE_COMMAND} -E copy ${SPHINX_INDEX_IN} ${SPHINX_INDEX_OUT} COMMAND ${CMAKE_COMMAND} -E copy_directory ${API_DOCS_IN} ${API_DOCS_OUT} + COMMAND ${CMAKE_COMMAND} -E copy_directory ${SPHINX_TEMPLATES_IN} ${SPHINX_TEMPLATES_OUT} COMMAND ${CMAKE_COMMAND} -E copy_directory ${DOXYREST_IN} ${DOXYREST_OUT} COMMAND ${CMAKE_COMMAND} -E copy_directory ${DOXYREST_SPHINX_IN} ${DOXYREST_SPHINX_OUT} COMMAND ${CMAKE_COMMAND} -E copy_directory ${SPHINX_STATIC_IN} ${SPHINX_STATIC_OUT} diff --git a/docs/_static/js/custom.js b/docs/_static/js/custom.js index aee8b173c77..8b027164517 100644 --- a/docs/_static/js/custom.js +++ b/docs/_static/js/custom.js @@ -2,6 +2,16 @@ var sw_anchors = {}; var urlSearchParams = new URLSearchParams(window.location.search); var sw_timer; +/* Doc Versions */ +var versions; +try { + versions = JSON.parse(data); +} +catch (err) { + console.log(err); + versions = []; +} + /* Adobe Analytics */ var wapLocalCode = 'us-en'; var wapSection = 'openvinotoolkit'; @@ -15,7 +25,7 @@ var wapSection = 'openvinotoolkit'; s.appendChild(po); })(); -$(document).ready(function() { +$(document).ready(function () { createVersions(); init_col_sections(); init_switchers(); @@ -27,6 +37,13 @@ $(document).ready(function() { } }); +// Determine where we'd go if clicking on a version selector option +function getPageUrlWithVersion(version) { + var currentURL = window.location.href; + var newURL = currentURL.replace(getCurrentVersion(), version); + return encodeURI(newURL); +} + function getCurrentVersion() { var protocol = window.location.protocol + "//"; var index = window.location.href.indexOf(protocol); @@ -46,22 +63,13 @@ function getCurrentVersion() { function createVersions() { - var versions; - var currentVersion = getCurrentVersion() - - try { - versions = JSON.parse(data); - } - catch(err) { - console.log(err); - versions = []; - } + var currentVersion = getCurrentVersion(); var versionBtn = $('#version-selector'); versionBtn.text(currentVersion); versionBtn.width((currentVersion.length * 10) + 'px'); var versionsContainer = $('[aria-labelledby="version-selector"]'); versions.forEach(item => { - var link = $('' + item.version + ''); + var link = $('' + item.version + ''); if (item.version === currentVersion) { link.addClass('font-weight-bold'); } @@ -75,22 +83,22 @@ function createVersions() { function addTableSort() { var tables = $('table.table'); - tables.each(function() { + tables.each(function () { var table = $(this); var headings = table.find('th'); - headings.each(function() { + headings.each(function () { var th = $(this); var index = th.index(); var sortBtn = $(''); th.addClass('sort-header'); - th.click(function(){ + th.click(function () { var counter = 0; sortBtn.addClass('sort-active'); sortBy = sortBtn.data('sortby'); var trs = table.find('tbody tr'); sortBtn.toggleClass('ascending'); - trs.sort(function(item1, item2) { - + trs.sort(function (item1, item2) { + if (sortBtn.hasClass('ascending')) { var text1 = $(item1).find('td').eq(index).text(); var text2 = $(item2).find('td').eq(index).text(); @@ -116,7 +124,7 @@ function addTableSort() { else { return 0; } - }).map(function() { + }).map(function () { var row = $(this); if (counter % 2 === 0) { row.removeClass('row-odd'); @@ -130,7 +138,7 @@ function addTableSort() { table.find('tbody').append(row); }); - headings.each(function() { + headings.each(function () { if ($(this).index() !== index) { $(this).find('.sort-btn').removeClass('ascending'); $(this).find('.sort-btn').removeClass('sort-active'); @@ -144,9 +152,9 @@ function addTableSort() { function initViewerJS() { try { - var images =$('main img[src*="_images"]'); - images.each(function() { - try{ + var images = $('main img[src*="_images"]'); + images.each(function () { + try { new Viewer($(this).get(0)); } catch (err) { @@ -154,14 +162,14 @@ function initViewerJS() { } }); } - catch(err) { + catch (err) { console.log(err); } } function init_col_sections() { var collapsible_sections = $('div.collapsible-section'); - collapsible_sections.each(function() { + collapsible_sections.each(function () { try { var title = $(this).data('title') || 'Click to expand'; var summary = $('' + title + ''); @@ -170,7 +178,7 @@ function init_col_sections() { $(this).wrap(details); summary.insertBefore($(this)); } - catch(err) { + catch (err) { console.log(err); } }); diff --git a/docs/_templates/layout.html b/docs/_templates/layout.html index 87aa14fa6a1..f12ea6528e0 100644 --- a/docs/_templates/layout.html +++ b/docs/_templates/layout.html @@ -1,4 +1,4 @@ -{%- extends "openvino_sphinx_theme/layout.html" %} +{%- extends "openvino_sphinx_theme/templates/layout.html" %} {% block css %} {{ super() }} diff --git a/docs/doxygen-xfail.txt b/docs/doxygen-xfail.txt index 26af90c6675..667b6dd4104 100644 --- a/docs/doxygen-xfail.txt +++ b/docs/doxygen-xfail.txt @@ -59,3 +59,7 @@ openvino_docs_ie_dg_lpt_updatesharedprecisionpreserved.rst openvino_docs_ie_dg_lpt_variadicsplittransformation.rst openvino_docs_ie_plugin_dg_lp_representation.rst openvino_docs_ie_dg_lpt.rst +omz_models_model_age_gender_recognition_retail_0013.rst +omz_models_model_emotions_recognition_retail_0003.rst +ngraph_transformation.rst +notebooks/notebook_utils-with-output.rst diff --git a/docs/optimization_guide/dldt_deployment_optimization_guide.md b/docs/optimization_guide/dldt_deployment_optimization_guide.md index a6b7d0db082..1fd27f17287 100644 --- a/docs/optimization_guide/dldt_deployment_optimization_guide.md +++ b/docs/optimization_guide/dldt_deployment_optimization_guide.md @@ -72,7 +72,7 @@ There are important performance caveats though: for example, the tasks that run Also, if the inference is performed on the graphics processing unit (GPU), it can take little gain to do the encoding, for instance, of the resulting video, on the same GPU in parallel, because the device is already busy. -Refer to the [Object Detection SSD Demo](@ref omz_demos_object_detection_demo_ssd_async_README) (latency-oriented Async API showcase) and [Benchmark App Sample](../../samples/cpp/benchmark_app/README.md) (which has both latency and throughput-oriented modes) for complete examples of the Async API in action. +Refer to the [Object Detection С++ Demo](@ref omz_demos_object_detection_demo_cpp), [Object Detection Python Demo](@ref omz_demos_object_detection_demo_python)(latency-oriented Async API showcase) and [Benchmark App Sample](../../samples/cpp/benchmark_app/README.md) (which has both latency and throughput-oriented modes) for complete examples of the Async API in action. ### Request-Based API and “GetBlob” Idiom diff --git a/docs/requirements.txt b/docs/requirements.txt index 6e25852a4f3..3c7927f1b0b 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -12,6 +12,7 @@ idna==3.3 imagesize==1.3.0 importlib-metadata==4.10.1 iniconfig==1.1.1 +ipython==8.0.1 Jinja2==3.0.3 lxml==4.7.1 MarkupSafe==2.0.1 diff --git a/docs/scripts/copy_images.py b/docs/scripts/copy_images.py index 798ea94e7fb..06f357321e3 100644 --- a/docs/scripts/copy_images.py +++ b/docs/scripts/copy_images.py @@ -11,7 +11,7 @@ def copy_images(input_dir: Path, output_dir: Path): Copy images from doxygen xml folder to sphinx folder """ output_dir.mkdir(parents=True, exist_ok=True) - extensions = ('*.png', '*.jpg', '*.svg', '*.gif', '*.PNG', '*.JPG', '*.SVG', '*.GIF') + extensions = ('*.png', '*.jpg', '*.jpeg', '*.svg', '*.gif', '*.PNG', '*.JPG', '*.JPEG', '*.SVG', '*.GIF') for extension in extensions: for file in input_dir.glob(extension): shutil.copy(file, output_dir) diff --git a/docs/scripts/doxy_md_filter.py b/docs/scripts/doxy_md_filter.py index 8c0f43c7a22..59219ed6b2e 100644 --- a/docs/scripts/doxy_md_filter.py +++ b/docs/scripts/doxy_md_filter.py @@ -10,8 +10,8 @@ import logging INLINE_LINKS_PATTERN = r'!?\[.*?\]\(([\w\/\-\.]+\.md)\)' REFERENCE_LINKS_PATTERN = r'\[.+\]\:\s*?([\w\/\-\.]+\.md)' -INLINE_IMAGES_PATTERN = r'!?\[.*?\]\(([\w\/\-\.]+\.(?:png|jpg|gif|svg))\)' -REFERENCE_IMAGES_PATTERN = r'\[.+\]\:\s*?([\w\/\-\.]+\.(?:png|jpg|gif|svg))' +INLINE_IMAGES_PATTERN = r'!?\[.*?\]\(([\w\/\-\.]+\.(?:png|jpg|jpeg|gif|svg))\)' +REFERENCE_IMAGES_PATTERN = r'\[.+\]\:\s*?([\w\/\-\.]+\.(?:png|jpg|jpeg|gif|svg))' LABEL_PATTERN = r'\{\#(.+)\}' diff --git a/docs/suppress_warnings.txt b/docs/suppress_warnings.txt index 607b3c2a83d..3fbe17eae74 100644 --- a/docs/suppress_warnings.txt +++ b/docs/suppress_warnings.txt @@ -87,3 +87,8 @@ no module named openvino title level inconsistent create a pipeline run pot cli +found unknown command +unable to resolve reference to \'http +unexpected html tag +field list ends without a blank line +bullet list ends without a blank line