From 54c8c79a9820636d0ee8deb085ed103965ea3686 Mon Sep 17 00:00:00 2001 From: lambdamusic Date: Wed, 16 Nov 2022 11:47:27 +0000 Subject: [PATCH 1/3] fix for missing ontologies --- .../templates/html-single/html-single.html | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/ontospy/gendocs/media/templates/html-single/html-single.html b/ontospy/gendocs/media/templates/html-single/html-single.html index 0db5df2..19175ae 100755 --- a/ontospy/gendocs/media/templates/html-single/html-single.html +++ b/ontospy/gendocs/media/templates/html-single/html-single.html @@ -228,20 +228,25 @@ - - - {% if ontologies|length > 1 %} -

{{docs_title}}

+ {% if ontologies%} - {% for o in ontologies %} -

  • {{o.uri}}
  • - {% endfor %} + {% if ontologies|length > 1 %} +

    {{docs_title}}

    + {% for o in ontologies %} +

  • {{o.uri}}
  • + {% endfor %} + + {% else %} +

    {{docs_title}}

    +

    {{ontologies.0.bestDescription()|linebreaks}}

    + {% endif %} + {% else %} -

    {{docs_title}}

    -

    {{ontologies.0.bestDescription()|linebreaks}}

    +

    {{docs_title}}

    {% endif %} +

    Ontology documentation automatically generated by Ontospy on {% now 'utc', '%a, %d %b %Y %H:%M:%S' %}

    From 92a5f17406dd222b898de531a3a5dfe1c9b7a17d Mon Sep 17 00:00:00 2001 From: lambdamusic Date: Wed, 16 Nov 2022 11:47:39 +0000 Subject: [PATCH 2/3] multi page dendogram --- ontospy/gendocs/jinja_env.py | 17 +- .../media/templates/d3/d3_dendogram copy.html | 531 ------------------ .../media/templates/d3/d3_dendogram.html | 276 +++------ ontospy/gendocs/viz/viz_d3dendogram.py | 142 +++-- 4 files changed, 203 insertions(+), 763 deletions(-) delete mode 100755 ontospy/gendocs/media/templates/d3/d3_dendogram copy.html diff --git a/ontospy/gendocs/jinja_env.py b/ontospy/gendocs/jinja_env.py index ab8dc28..cea9cba 100644 --- a/ontospy/gendocs/jinja_env.py +++ b/ontospy/gendocs/jinja_env.py @@ -40,13 +40,16 @@ def slugify_filter(value): @pass_eval_context def linebreaks_filter(eval_ctx, value): """A filter for legacy django templates.""" - if not value: - return "" - result = u'\n\n'.join(u'

    %s

    ' % p.replace('\n', '
    \n') - for p in _paragraph_re.split(escape(value))) - if eval_ctx.autoescape: - result = Markup(result) - return result + try: + if not value: + return "" + result = u'\n\n'.join(u'

    %s

    ' % p.replace('\n', '
    \n') + for p in _paragraph_re.split(escape(value))) + if eval_ctx.autoescape: + result = Markup(result) + return result + except: + return value env.filters['linebreaks'] = linebreaks_filter diff --git a/ontospy/gendocs/media/templates/d3/d3_dendogram copy.html b/ontospy/gendocs/media/templates/d3/d3_dendogram copy.html deleted file mode 100755 index b22d516..0000000 --- a/ontospy/gendocs/media/templates/d3/d3_dendogram copy.html +++ /dev/null @@ -1,531 +0,0 @@ -{% extends "shared/d3_base.html" %} - - - - -{% block custom_css %} - - - - - -{% endblock custom_css %} - - - - - - - -{% block main_content %} - - - - {% if TOTAL_CLASSES %} -
    -

    Classes ({{TOTAL_CLASSES}})

    -
    - - -
    - - -
    - {% endif %} - - {% if TOTAL_PROPERTIES %} -
    -

    Properties ({{TOTAL_PROPERTIES}})

    -
    - - -
    - - -
    - {% endif %} - - - {% if TOTAL_CONCEPTS %} - -
    -

    Concepts ({{TOTAL_CONCEPTS}})

    -
    - - -
    - - -
    - - {% endif %} - - - - -{% endblock main_content %} - - - - -{% block extra_footer %} - -Visualization developed with d3.js. - -{% endblock extra_footer %} - - - - - - - - -{% block the_javascript %} - - - - - - {# JAVASCRIPT #} - - {% if save_on_github %} - - - - - - - - {% else %} - - - - - - - - - {% endif %} - - - - - {% include 'shared/js_slidereveal.html' %} - - - - - -{# JAVASCRIPT FOR D3 TREE #} - - - - - - - - -{% endblock the_javascript %} - - - - diff --git a/ontospy/gendocs/media/templates/d3/d3_dendogram.html b/ontospy/gendocs/media/templates/d3/d3_dendogram.html index 4115eec..60e656b 100755 --- a/ontospy/gendocs/media/templates/d3/d3_dendogram.html +++ b/ontospy/gendocs/media/templates/d3/d3_dendogram.html @@ -5,79 +5,86 @@ {% block custom_css %} + + {% endblock custom_css %} @@ -91,37 +98,34 @@ {% block main_content %} - - {% if TOTAL_CLASSES %} -
    -

    Classes ({{TOTAL_CLASSES}})

    -
    - - -
    - +
    + + + + + {% if TOTAL_CLASSES %} + Classes ({{TOTAL_CLASSES}})   + {% endif %} + + {% if TOTAL_PROPERTIES %} + Properties ({{TOTAL_PROPERTIES}})   + {% endif %} + + {% if TOTAL_CONCEPTS %} + Concepts ({{TOTAL_CONCEPTS}}) + {% endif %} + + +
    - {% endif %} - - {% if TOTAL_PROPERTIES %} -
    -

    Properties ({{TOTAL_PROPERTIES}})

    -
    - - -
    -
    - {% endif %} - - - {% if TOTAL_CONCEPTS %} -
    -

    Concepts ({{TOTAL_CONCEPTS}})

    -
    + + + +
    @@ -129,8 +133,6 @@

    Concepts ({{TOTAL_CONCEPTS}})

    - {% endif %} - @@ -195,14 +197,15 @@

    Concepts ({{TOTAL_CONCEPTS}})