Code Monkey home page Code Monkey logo

jarchi-single-page-html-export's Introduction

Generate Single-page HTML Export

image

Requires jArchi

This script creates a single HTML page which contains views contained into selected folders. This HTML page makes heavy use of CSS tricks to create a dynamic web application which doesn't rely on JavaScript. This non-JS approach is by design to allow the file to be previewed when stored on Onedrive Pro, MsTeams or SharePoint Document Library.

To use it, simply download the archive from the latest release and unzip it in your scripts folder. Then select one or more folders containing views and run the script through the context menu.

Mardown rendering of documentations is on by default. You can set it off in the "Preferences" dialog (cog icon on top right).

Copyright (c) 2020 Phillip Beauvoir & Jean-Baptiste Sarrodie

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

jarchi-single-page-html-export's People

Contributors

davidsara avatar jbsarrodie avatar phillipus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jarchi-single-page-html-export's Issues

[Request] Can the export obey _hide_from_export_?

This script is an excellent addition to the HTML report, but it lacks the ability to skip views that are not intended for publication. With below little patch it seems that it does obey the property setting hide_from_export and this makes it all the more useful at least for me! Thanks for considering this request.

*** "jarchi-single-page-html-export-1.0/Generate Single-page HTML Export.ajs" 2022-08-03 17:47:37.472500400 +0200
--- "./Generate Single-page HTML Export.ajs" 2022-08-03 17:54:02.414156300 +0200


*** 82,87 ****
--- 82,88 ----
var elementsCollection;
var relationships = '';
var relationshipsCollection;

  • var hide_from_export = '';

    var allFolders = $('folder');
    var viewsFolder = $(model).children().filter('folder.Views');


*** 103,109 ****
--- 104,115 ----
}

_.chain(folders).sortBy(function (f) { return f.name; }).each(function (f) {

  • hide_from_export = f.prop('hide_from_export');
  • if (hide_from_export != null && hide_from_export == 'true') {
  • console.log('hide folder ' + f.name);
    
  • } else {
    exportViews(f);
  • }
    });

function exportViews(folder) {


*** 111,120 ****
--- 117,135 ----
var previousContent = treeContent;
treeContent = '';
_.chain($(folder).children('folder')).sortBy(function (f) { return f.name; }).each(function (f) {

  • hide_from_export = f.prop('_hide_from_export_');
    
  • if (hide_from_export != null && hide_from_export == 'true') {
    
  •   console.log('hide folder ' + f.name);
    
  • } else {
      exportViews(f)
    
  • }
    
    });
    _.chain($(folder).children('view')).sortBy(function (v) { return v.name; }).each(function (v) {
    // Generate report's fragments
  • hide_from_export = v.prop('_hide_from_export_');
    
  • if (hide_from_export != null && hide_from_export == 'true') {
    
  •   console.log('hide view ' + v.name);
    
  • } else {
      treeContent += tplTreeView({ viewId: 'id-' + v.id, viewName: _.escape(v.name) });
      visibilityRulesBold += tplVisibilityRuleBold({ viewId: 'id-' + v.id });
      visibilityRulesReveal += tplVisibilityRuleReveal({ viewId: 'id-' + v.id });
    

*** 144,149 ****
--- 159,165 ----
}
viewsIdsByConceptId[r.concept.id] += ' id-' + v.id;
});

  • }
    
    });
    treeContent = tplTreeFolder({ folderId: 'id-' + folder.id, folderName: _.escape(folder.name), folderContent: treeContent });
    treeContent = previousContent + treeContent;

Use link (hand) cursor in some places

I don't know if this is possible or just me nit-picking, but would it be possible to use the hand cursor on:

  • The "X" and hamburger buttons
  • The "Documentation", "Elements", "Relationships" tabs

I cannot generate the export using this script.

Hello,

sorry to disturb.

as I am a total noob in computer sciences, I may sound dumb.
I tried this script to generate a HTML report by selecting folders in the tree on jArchi and got error messages.
I added in DIR the path where the folders are registered (Archi/scripts).
Then, I got this message :
javax.script.ScriptException: java.io.FileNotFoundException: C:\Users\Tibo\Documents\Archi\model-repository\architecture\Documents\Archi\scripts\jarchi-single-page-html-export-master\jarchi-single-page-html-export-master\resources\roboto.css (Le chemin d�accès spécifié est introuvable)
at java.base/java.io.FileInputStream.open0(Native Method)
at java.base/java.io.FileInputStream.open(Unknown Source)
at java.base/java.io.FileInputStream.(Unknown Source)
at java.base/java.io.FileInputStream.(Unknown Source)
at java.base/sun.net.www.protocol.file.FileURLConnection.connect(Unknown Source)

Indeed, the css is also in the Archi/scripts and not in the path we can read on the error message.

How can I run this script correctly ?
Thank you for your help.

Thibault

Ask for file name first?

As there can be a delay when the script is exporting images, do you think it makes sense to show the Save As dialog first? (In cases such as the user changing their mind, or sees that the file already exists)

Major redesign (version 2)

Current version works great, but while working on #7 (Allow deeplinks to easily bookmark one specific view) and #10 (Report mode with AlaSql) it became obvious that current HTML/CSS code was a bit of a mess.

So I decided to reboot and to start again using gain knowledge as a starting point. I now have the basic skeleton up and running (and documented) and will be able to share it soon.

Report mode with AlaSql

Integrated AlaSql and allow a reporting mode (opening the page with some specific options in the URL containing the SQL query). See #7

Show Element Documentation and Properties on mouse click/hover

Currently Element properties are not exported.

Being able to see them as a table or list after a click on the element on a diagram would make the export more useful and complete.

My workflow relies on using element properties a lot to describe common things like implementation language, api endpoint address, urls to logging, source code repository, etc. Actually, a diagram picture and the stuff around in the element properties is the most valuable piece for that kind of workflow when exploring documentation.

Bug: Export terminated when exporting full model ?

Great idea to generate a single html page ! Really useful.

I do:

  • Imported Archisurance model
  • Runs this script
  • I get this error message
All views have been selected.
Exporting " Views "...
Export terminated.

Is this i bug or have I misunderstood the script ? Is only the View exported ?

See attached zip-file for example output:
Archisurance.html.zip

Running:

  • Archimate v4.8.0
  • Jarchi v1.1.0
  • Single page html export - Stable release

Allow deeplinks to easily bookmark one specific view

Note: that's (finally not so) easy to do but the link should not show when loaded in an iFrame or else Sharepoint/Onedrive preview will show a blank page if navigated. This last part can be done simply through a preference (now that we have them)

[Request] Can the Default HTML File Name be the Selected View Folder Name, instand of Model Name?

Hello,

There're several views I created within one View folder, and the folder name is kind of meaningful.

When I use the script to generat single HTML page report, the default file name, as well as the inner main frame header names are both the whole "Model Name", I think it would be more make sence to generate HTML with using the View folder name.

For now, it's still working as I can manually search in the HTML and rename 2 to 3 part in the file to the expected one.

Thanks a lot, regards,
Xiaoqi

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.