From 7f8d6920d555edf768a8f4e582416059004fc070 Mon Sep 17 00:00:00 2001 From: Jillian Date: Wed, 24 Feb 2016 17:40:51 -0800 Subject: [PATCH] #207: added help template file for html-app. updated text for help page --- src/scancode/format.py | 18 +++++++++++ .../{assets/index.html => help_template.html} | 30 +++++++++++-------- src/scancode/templates/html-app/template.html | 2 +- 3 files changed, 37 insertions(+), 13 deletions(-) rename src/scancode/templates/html-app/{assets/index.html => help_template.html} (70%) diff --git a/src/scancode/format.py b/src/scancode/format.py index d0dde0a1831..170fb71de57 100644 --- a/src/scancode/format.py +++ b/src/scancode/format.py @@ -27,6 +27,7 @@ from collections import OrderedDict from operator import itemgetter from os.path import abspath +from os.path import basename from os.path import dirname from os.path import exists from os.path import expanduser @@ -68,6 +69,16 @@ def as_html_app(scanned_path, output_file): return template.render(assets_dir=assets_dir, scanned_path=scanned_path) +def get_html_app_help(output_filename): + """ + Return an HTML string containing html-app help page with a reference back + to the main app + """ + template = get_template(get_template_dir('html-app'), template_name='help_template.html') + + return template.render(main_app=output_filename) + + class HtmlAppAssetCopyWarning(Exception): pass @@ -109,10 +120,13 @@ def create_html_app_assets(results, output_file): raise HtmlAppAssetCopyWarning() assets_dir = join(get_template_dir('html-app'), 'assets') + # delete old assets tgt_dirs = get_html_app_files_dirs(output_file) target_dir = join(*tgt_dirs) if exists(target_dir): fileutils.delete(target_dir) + + # copy assets fileutils.copytree(assets_dir, target_dir) # write json data @@ -120,6 +134,10 @@ def create_html_app_assets(results, output_file): root_path, assets_dir = get_html_app_files_dirs(output_file) with open(join(root_path, assets_dir, 'data.json'), 'w') as f: f.write('data=' + json.dumps(results)) + + # create help file + with open(join(root_path, assets_dir, 'help.html'), 'w') as f: + f.write(get_html_app_help(basename(output_file.name))) except HtmlAppAssetCopyWarning, w: raise w except Exception, e: diff --git a/src/scancode/templates/html-app/assets/index.html b/src/scancode/templates/html-app/help_template.html similarity index 70% rename from src/scancode/templates/html-app/assets/index.html rename to src/scancode/templates/html-app/help_template.html index 6ef1768256a..c209ccec5cb 100644 --- a/src/scancode/templates/html-app/assets/index.html +++ b/src/scancode/templates/html-app/help_template.html @@ -56,6 +56,9 @@
  • Terms
  • +
  • + How To +
  • @@ -65,18 +68,27 @@
    - Back to scan results + Back to scan results

    ScanCode Toolkit

    Scan Summaries

    License Summary

    -

    The License Summary displays a bar chart of the number of times a detected license appears.

    +

    The License Summary displays a bar chart of the number of times a detected license appears. The "Total Files Scanned" displays the number of files that were scanned. As you select a directory in the file tree, the number will update to show the number of files scanned in that directory. In the chart summary we have included "No License Found" to represent the number of files that did not have a license detected.

    Copyright Summary

    -

    The Copyright Summary displays a bar chart of the number of times a detected copyright holder appears. In the file tree view, the chart results can be filtered to show a selected directory or file.

    +

    The Copyright Summary displays a bar chart of the number of times a detected copyright holder appears. The "Total Files Scanned" displays the number of files that were scanned. As you select a directory in the file tree, the number will update to show the number of files scanned in that directory. In the chart summary we have included "No Copyright Found" to represent the number of files that did not have a copyright holder detected.

    Clues

    -

    The license, copyright, email, and url clues from a scan.

    +

    In the Clues tab, the available clues detected by ScanCode are shown in a tabular format. Currently, the license, copyright, email, and url clues are available from a scan.

    + Column header descriptions: +
      +
    • Path - Location of component
    • +
    • What - Type of scan clue (license, copyright, url, email)
    • +
    • Start Line - Starting line number of the clue
    • +
    • End Line - Ending line number of the clue
    • +
    • Info - Detected clue information
    • +

    File Details

    The file information for a component (For example, file type, sha1, file size)

    Package Details

    +

    Package information that is typically derived from a package manifest such as a RPM metadata, an NPM, a gem, a wheel, a Jar, etc.

    Data Processing

    Filtering

    In the file tree view, the scan results that are shown in the table or in the summary charts can be filtered by selecting a directory or file.

    @@ -84,14 +96,8 @@

    Sorting

    Column sorting can be used by selecting the ascending or descending arrow of the column you would like to sort.

    Searching

    The results in the table view can be searched using the Search box

    -

    Terms

    -
      -
    • Path - Location of component
    • -
    • What - Type of scan clue (license, copyright, url, email)
    • -
    • Start Line - Starting line number of the clue
    • -
    • End Line - Ending line number of the clue
    • -
    • Info - Detected clue information
    • -
    +

    How To

    +

    Visit the ScanCode Wiki for a series of How To wiki entries that provide step by step instructions to getting started with ScanCode.

    diff --git a/src/scancode/templates/html-app/template.html b/src/scancode/templates/html-app/template.html index e77784306bc..b113e29c095 100644 --- a/src/scancode/templates/html-app/template.html +++ b/src/scancode/templates/html-app/template.html @@ -45,7 +45,7 @@ ScanCode scan results for: {{ scanned_path }}