Commit f3702c0a authored by PTSEFTON's avatar PTSEFTON
Browse files

Cleaning up

parent c52e9487
......@@ -19,12 +19,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
const Collection = require("./lib/collection.js");
const Index = require("./lib/index_html.js");
const Bag = require("./lib/bag.js");
// const ROCrate = require("ro-crate").ROCrate;
const ROCrate = require("ro-crate").ROCrate;
const Preview = require("ro-crate").Preview;
const HtmlFile = require("ro-crate").HtmlFile;
const path = require("path");
const shell = require("shelljs");
......@@ -159,15 +157,12 @@ async function generateHTML(metadataPath) {
}
var index_maker = new Index();
index_maker.init(
crate,
path.join(__dirname, "defaults", "metadata_template.html")
);
const preview = await new Preview(crate);
console.log(HtmlFile)
const f = new HtmlFile(preview);
fs.writeFileSync(path.join(dir, htmlFileName),
await index_maker.make_index_html(program.url, program.cratescript));
await f.render());
if (program.bag) {
......
/* This is part of Calcyte a tool for implementing the DataCrate data packaging
spec. Copyright (C) 2018 University of Technology Sydney
This program 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 3 of the License, or
(at your option) any later version.
This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
const defaults = require("./defaults");
const Preview = require("ro-crate").Preview
var ejs = require("ejs");
const fs = require("fs-extra");
module.exports = function () {
return {
init: function init(crate, template_path) {
if (template_path) {
var temp = fs.readFileSync(template_path, { encoding: "utf8" });
this.template = ejs.compile(temp);
}
this.crate = crate;
this.crate.index();
//this.helper.add_back_links();
// A container for our page
},
make_index_html: async function make_index_html(zip_path, render_script) {
var body_el = "";
var rootNode = this.crate.getRootDataset();
var name = rootNode.name;
if (!render_script) {
render_script = defaults.render_script;
}
if (zip_path) {
zip_path = `<a href='${zip_path}'>Download this Dataset</a>`;
}
const preview = new Preview(this.crate);
const summary = await preview.summarizeDataset();
var date = new Date();
var timestamp = date.getTime();
return this.template({
html:summary.html(),
dataset_name: name,
item_name: name,
citation: this.text_citation,
zip_link: zip_path,
up_link: "",
time_stamp: timestamp,
ROCrate_version: defaults.ROCrate_version,
spec_id: defaults.DataCrate_Specification_Identifier,
json_ld: JSON.stringify(this.crate.getJson(), null, 2),
render_script: render_script
})
}
}
}
This diff is collapsed.
{
"@context": "https://researchobject.github.io/ro-crate/1.0/context.jsonld",
"@graph": [
{
"@id": "#88df3f1c-29d1-4a92-905f-aa3457093d8b",
"@type": "GeoCoordinates",
"latitude": "-33.7152",
"longitude": "150.30119",
"name": "Latitude: -33.7152, Longitude: 150.30119"
},
{
"@id": "#EPL1",
"@type": "IndividualProduct",
......@@ -67,6 +60,13 @@
"@id": "pics/sepia_fence.jpg"
}
},
{
"@id": "#a250c512-16b5-4e0b-b226-7b231acd0987",
"@type": "GeoCoordinates",
"latitude": "-33.7152",
"longitude": "150.30119",
"name": "Latitude: -33.7152, Longitude: 150.30119"
},
{
"@id": "#picsdistro",
"@type": "DataDownload",
......@@ -117,7 +117,12 @@
"publisher": {
"@id": "https://ror.org/0384j8v12"
},
"temporalCoverage": "2017"
"temporalCoverage": "2017",
"distribution": [
{
"@id": "http://something/"
}
]
},
{
"@id": "_:b0",
......@@ -2621,7 +2626,7 @@
"address": "Katoomba, NSW",
"description": "Catalina Park is a disused motor racing venue, located at Katoomba, in the Blue Mountains, New South Wales, Australia, and is recognised as an Aboriginal Place due to the long association of the local Gundungarra and Darug clans to the area.",
"geo": {
"@id": "#88df3f1c-29d1-4a92-905f-aa3457093d8b"
"@id": "#a250c512-16b5-4e0b-b226-7b231acd0987"
},
"name": "Catalina Park"
},
......@@ -3986,6 +3991,12 @@
"@id": "./"
},
"identifier": "ro-crate-metadata.jsonld"
},
{
"@id": "http://something/",
"contentUrl": "http://something/",
"@type": "DataDownload",
"encodingFormat": "zip"
}
]
}
\ No newline at end of file
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment