Browse Source

Use pskov 1.0.0

master
parent
commit
a7fae6d784
9 changed files with 147 additions and 56 deletions
  1. +2
    -2
      pskov/en/education.01.why.html
  2. +2
    -2
      pskov/en/education.02.deps.html
  3. +2
    -2
      pskov/en/education.03.site.html
  4. +2
    -2
      pskov/en/education.04.lang.html
  5. +2
    -2
      pskov/en/education.05.blog.html
  6. +2
    -2
      pskov/en/education.html
  7. +2
    -2
      pskov/en/item.template
  8. +132
    -41
      pskov/en/pskov_1.0.0.html
  9. +1
    -1
      pskov/index.html

+ 2
- 2
pskov/en/education.01.why.html View File

@@ -66,13 +66,13 @@
} }
</style> </style>
<title> <title>
PSKOV-201905
pskov_1.0.0
</title> </title>
</head> </head>
<body> <body>
<div id="header"> <div id="header">
<strong id="title">PSKOV</strong> <strong id="title">PSKOV</strong>
<a href="tool.pskov.html">Tool</a>
<a href="pskov_1.0.0.html">Tool</a>
<a href="education.html">Education</a> <a href="education.html">Education</a>
</div> </div>
<center><h1> <center><h1>


+ 2
- 2
pskov/en/education.02.deps.html View File

@@ -66,13 +66,13 @@
} }
</style> </style>
<title> <title>
PSKOV-201905
pskov_1.0.0
</title> </title>
</head> </head>
<body> <body>
<div id="header"> <div id="header">
<strong id="title">PSKOV</strong> <strong id="title">PSKOV</strong>
<a href="tool.pskov.html">Tool</a>
<a href="pskov_1.0.0.html">Tool</a>
<a href="education.html">Education</a> <a href="education.html">Education</a>
</div> </div>
<center><h1> <center><h1>


+ 2
- 2
pskov/en/education.03.site.html View File

@@ -66,13 +66,13 @@
} }
</style> </style>
<title> <title>
PSKOV-201905
pskov_1.0.0
</title> </title>
</head> </head>
<body> <body>
<div id="header"> <div id="header">
<strong id="title">PSKOV</strong> <strong id="title">PSKOV</strong>
<a href="tool.pskov.html">Tool</a>
<a href="pskov_1.0.0.html">Tool</a>
<a href="education.html">Education</a> <a href="education.html">Education</a>
</div> </div>
<center><h1> <center><h1>


+ 2
- 2
pskov/en/education.04.lang.html View File

@@ -66,13 +66,13 @@
} }
</style> </style>
<title> <title>
PSKOV-201905
pskov_1.0.0
</title> </title>
</head> </head>
<body> <body>
<div id="header"> <div id="header">
<strong id="title">PSKOV</strong> <strong id="title">PSKOV</strong>
<a href="tool.pskov.html">Tool</a>
<a href="pskov_1.0.0.html">Tool</a>
<a href="education.html">Education</a> <a href="education.html">Education</a>
</div> </div>
<center><h1> <center><h1>


+ 2
- 2
pskov/en/education.05.blog.html View File

@@ -66,13 +66,13 @@
} }
</style> </style>
<title> <title>
PSKOV-201905
pskov_1.0.0
</title> </title>
</head> </head>
<body> <body>
<div id="header"> <div id="header">
<strong id="title">PSKOV</strong> <strong id="title">PSKOV</strong>
<a href="tool.pskov.html">Tool</a>
<a href="pskov_1.0.0.html">Tool</a>
<a href="education.html">Education</a> <a href="education.html">Education</a>
</div> </div>
<center><h1> <center><h1>


+ 2
- 2
pskov/en/education.html View File

@@ -66,13 +66,13 @@
} }
</style> </style>
<title> <title>
PSKOV-201905
pskov_1.0.0
</title> </title>
</head> </head>
<body> <body>
<div id="header"> <div id="header">
<strong id="title">PSKOV</strong> <strong id="title">PSKOV</strong>
<a href="tool.pskov.html">Tool</a>
<a href="pskov_1.0.0.html">Tool</a>
<a href="education.html">Education</a> <a href="education.html">Education</a>
</div> </div>
<center><h1> <center><h1>


+ 2
- 2
pskov/en/item.template View File

@@ -66,13 +66,13 @@
} }
</style> </style>
<title> <title>
PSKOV-201905
pskov_1.0.0
</title> </title>
</head> </head>
<body> <body>
<div id="header"> <div id="header">
<strong id="title">PSKOV</strong> <strong id="title">PSKOV</strong>
<a href="tool.pskov.html">Tool</a>
<a href="pskov_1.0.0.html">Tool</a>
<a href="education.html">Education</a> <a href="education.html">Education</a>
</div> </div>
<center><h1> <center><h1>


pskov/en/tool.pskov.html → pskov/en/pskov_1.0.0.html View File

@@ -90,17 +90,17 @@
} }
</style> </style>
<title> <title>
PSKOV-201905
pskov_1.0.0
</title> </title>
</head> </head>
<body> <body>
<div id="header"> <div id="header">
<strong id="title">PSKOV</strong> <strong id="title">PSKOV</strong>
<a href="tool.pskov.html">Tool</a>
<a href="pskov_1.0.0.html">Tool</a>
<a href="education.html">Education</a> <a href="education.html">Education</a>
</div> </div>
<center><h1> <center><h1>
PSKOV-201905
PSKOV 1.0.0 (2019-06)
</h1></center> </h1></center>
<center><div class="contents"> <center><div class="contents">
<p> <p>
@@ -5655,6 +5655,20 @@
String.prototype.startsWith = String.prototype.startsWith || function(prefix) { String.prototype.startsWith = String.prototype.startsWith || function(prefix) {
return this.indexOf(prefix) === 0; return this.indexOf(prefix) === 0;
}; };
// Topic: JavaScript equivalent to printf/String.Format
// Source: https://stackoverflow.com/a/4673436
function formatString() {
// Topic: How to shift “arguments”?
// Source: https://stackoverflow.com/questions/4775895/how-to-shift-arguments
var args = Array.prototype.slice.call(arguments);
var str = args.shift();
return str.replace(/{(\d+)}/g, function(match, number) {
return typeof args[number] != 'undefined'
? args[number]
: match
;
});
};
function fileExists(fileName, fileList) function fileExists(fileName, fileList)
{ {
@@ -5978,12 +5992,25 @@
// Cfg class. // Cfg class.
function Cfg() function Cfg()
{ {
var self = this;
this.lfsa = null; this.lfsa = null;
this.cfg = {}; this.cfg = {};
this.cfgChanged = new Reporter(); this.cfgChanged = new Reporter();
this.fileName = "pskov.cfg";
this.logTranslations = {};
this.logTranslations["FILE_EXISTS"] = "'{0}' file exists: '{1}'";
this.logTranslations["FILE_DOES_NOT_EXIST"] = "ERROR '{0}' file does not exist";
this.logTranslations["FILE_CHECK_FAILED"] = "ERROR Could not check if '{0}' file exists because LFSA request failed";
this.logTranslations["COULD_NOT_READ"] = "ERROR Could not read '{0}' file";
this.logTranslations["SAVED"] = "Saved configuration";
this.logTranslations["SAVING"] = "Saving configuration into '{0}' file...";
this.logTranslations["COULD_NOT_SAVE"] = "ERROR Could not save '{0}' file";
this.exists = false; this.exists = false;
this.existsChanged = new Reporter(); this.existsChanged = new Reporter();
this.existsChanged.subscribe(function(){
self.LOG("FILE_EXISTS", self.fileName, self.exists)
});
this.saved = new Reporter(); this.saved = new Reporter();
} }
// Cfg's startup sequence. // Cfg's startup sequence.
@@ -5991,9 +6018,6 @@
{ {
var self = this; var self = this;
this.checkExistence(); this.checkExistence();
this.existsChanged.subscribe(function(){
self.LOG("`cfg` file exists: '" + self.exists + "'");
});
this.existsChanged.subscribe(function(){ this.existsChanged.subscribe(function(){
self.load(); self.load();
}); });
@@ -6004,15 +6028,29 @@
self.load(); self.load();
}); });
this.saved.subscribe(function(){ this.saved.subscribe(function(){
self.LOG("Saved configuration");
self.LOG("SAVED");
}); });
this.cfgChanged.subscribe(function(){ this.cfgChanged.subscribe(function(){
self.cfg["output"] = self.cfg["input"]; self.cfg["output"] = self.cfg["input"];
}); });
} }
Cfg.prototype.LOG = function(message)
Cfg.prototype.LOG = function()
{ {
LOG("Cfg " + message);
var args = Array.prototype.slice.call(arguments);
var translationKey = args.shift();
var message = "Cfg ";
if (translationKey in this.logTranslations)
{
args.unshift(this.logTranslations[translationKey]);
// Topic: Converting an array to a function arguments list
// Source: https://stackoverflow.com/a/1316389
message += formatString.apply(null, args);
}
else
{
message += translationKey + " " + args.join(" ");
}
LOG(message);
} }
Cfg.prototype.checkExistence = function() Cfg.prototype.checkExistence = function()
{ {
@@ -6020,10 +6058,10 @@
var success = function(fileList) var success = function(fileList)
{ {
var exists = fileExists("cfg", fileList);
var exists = fileExists(self.fileName, fileList);
if (!exists) if (!exists)
{ {
self.LOG("ERROR `cfg` file does not exist");
self.LOG("FILE_DOES_NOT_EXIST", self.fileName)
return; return;
} }
@@ -6033,7 +6071,7 @@
} }
var failure = function() var failure = function()
{ {
self.LOG("ERROR Could not check if `cfg` file exists because LFSA request failed");
self.LOG("FILE_CHECK_FAILED", self.fileName)
} }
this.lfsa.requestFileList("", success, failure); this.lfsa.requestFileList("", success, failure);
@@ -6049,10 +6087,10 @@
} }
var failure = function() var failure = function()
{ {
self.LOG("ERROR Could not read `cfg` file");
self.LOG("COULD_NOT_READ", self.fileName);
} }
this.lfsa.requestFile("cfg", success, failure);
this.lfsa.requestFile(this.fileName, success, failure);
} }
Cfg.prototype.display = function() Cfg.prototype.display = function()
{ {
@@ -6082,7 +6120,7 @@
Cfg.prototype.save = function() Cfg.prototype.save = function()
{ {
var cfgFile = ""; var cfgFile = "";
this.LOG("Saving configuration into `cfg` file...");
this.LOG("SAVING", this.fileName);
var input = document.getElementById("input"); var input = document.getElementById("input");
cfgFile += "input = " + input.value + "\n"; cfgFile += "input = " + input.value + "\n";
var item = document.getElementById("item"); var item = document.getElementById("item");
@@ -6112,9 +6150,9 @@
} }
var failure = function() var failure = function()
{ {
self.LOG("ERROR Could not save `cfg` file");
self.LOG("COULD_NOT_SAVE", self.fileName);
} }
this.lfsa.saveFile("cfg", cfgFile, success, failure);
this.lfsa.saveFile(this.fileName, cfgFile, success, failure);
} }
<!-- News --> <!-- News -->
@@ -6124,14 +6162,38 @@
var self = this; var self = this;
this.cfg = null; this.cfg = null;
this.lfsa = null; this.lfsa = null;
this.logTranslations = {};
this.logTranslations["TEMPLATE_IS_MISSING"] = "WARNING '{0}' template is missing";
this.logTranslations["READ_TEMPLATES"] = "Read '{0}' templates";
this.logTranslations["NO_MARKDOWNS"] = "ERROR No markdown files were found";
this.logTranslations["READ_MARKDOWNS"] = "Read '{0}' markdown files";
this.logTranslations["PARSED_MARKDOWNS"] = "Parsed '{0}' markdown files";
this.logTranslations["SAVED_NEWS_ITEMS"] = "Saved news items";
this.logTranslations["GENERATED_PREVIEWS"] = "Generated '{0}' previews";
this.logTranslations["GENERATED_PREVIEW_PAGES"] = "Generated '{0}' preview pages";
this.logTranslations["PAGINATED_PREVIEW_PAGES"] = "Preview pages have been linked";
this.logTranslations["SAVED_PREVIEW_PAGES"] = "Saved preview pages";
this.logTranslations["COULD_NOT_LOCATE_INPUT_FILES"] = "ERROR Could not locate input files because LFSA request failed";
this.inputFiles = []; this.inputFiles = [];
this.inputFilesChanged = new Reporter(); this.inputFilesChanged = new Reporter();
this.markdownFiles = []; this.markdownFiles = [];
this.markdownFilesChanged = new Reporter(); this.markdownFilesChanged = new Reporter();
this.markdownFilesChanged.subscribe(function(){
if (self.markdownFiles.length == 0)
{
self.LOG("NO_MARKDOWNS");
}
});
this.markdownFileContents = []; this.markdownFileContents = [];
this.markdownFileContentsChanged = new Reporter(); this.markdownFileContentsChanged = new Reporter();
this.markdownFileContentsChanged.subscribe(function(){
self.LOG("READ_MARKDOWNS", self.markdownFileContents.length);
});
this.newsItems = []; this.newsItems = [];
this.newsItemsChanged = new Reporter(); this.newsItemsChanged = new Reporter();
this.newsItemsChanged.subscribe(function(){
self.LOG("PARSED_MARKDOWNS", self.newsItems.length);
});
this.templatesToLocate = [ this.templatesToLocate = [
"item", "item",
"preview", "preview",
@@ -6147,6 +6209,9 @@
this.templatesChanged = new Reporter(); this.templatesChanged = new Reporter();
this.templateContents = {}; this.templateContents = {};
this.templateContentsChanged = new Reporter(); this.templateContentsChanged = new Reporter();
this.templateContentsChanged.subscribe(function(){
self.LOG("READ_TEMPLATES", Object.keys(self.templateContents).length);
});
this.savedItems = new Reporter(); this.savedItems = new Reporter();
this.previews = []; this.previews = [];
this.previewsChanged = new Reporter(); this.previewsChanged = new Reporter();
@@ -6173,31 +6238,31 @@
self.saveItems(); self.saveItems();
}); });
this.savedItems.subscribe(function(){ this.savedItems.subscribe(function(){
self.LOG("Saved news items");
self.LOG("SAVED_NEWS_ITEMS");
}); });
this.savedItems.subscribe(function(){ this.savedItems.subscribe(function(){
self.generatePreviewsIfTemplatesExist(); self.generatePreviewsIfTemplatesExist();
}); });
this.previewsChanged.subscribe(function(){ this.previewsChanged.subscribe(function(){
self.LOG("Generated '" + self.previews.length + "' previews");
self.LOG("GENERATED_PREVIEWS", self.previews.length);
}); });
this.previewsChanged.subscribe(function(){ this.previewsChanged.subscribe(function(){
self.generatePreviewPages(); self.generatePreviewPages();
}); });
this.previewPagesChanged.subscribe(function(){ this.previewPagesChanged.subscribe(function(){
self.LOG("Generated '" + self.previewPages.length + "' preview pages");
self.LOG("GENERATED_PREVIEW_PAGES", self.previewPages.length);
}); });
this.previewPagesChanged.subscribe(function(){ this.previewPagesChanged.subscribe(function(){
self.paginatePreviewPages(); self.paginatePreviewPages();
}); });
this.paginatedPreviewPagesChanged.subscribe(function(){ this.paginatedPreviewPagesChanged.subscribe(function(){
self.LOG("Paginated preview pages");
self.LOG("PAGINATED_PREVIEW_PAGES");
}); });
this.paginatedPreviewPagesChanged.subscribe(function(){ this.paginatedPreviewPagesChanged.subscribe(function(){
self.savePreviewPages(); self.savePreviewPages();
}); });
this.savedPreviewPages.subscribe(function(){ this.savedPreviewPages.subscribe(function(){
self.LOG("Saved preview pages");
self.LOG("SAVED_PREVIEW_PAGES");
}); });
this.templatesChanged.subscribe(function(){ this.templatesChanged.subscribe(function(){
self.generateUponCounter(2); self.generateUponCounter(2);
@@ -6226,9 +6291,23 @@
this.readTemplates(); this.readTemplates();
} }
} }
News.prototype.LOG = function(message)
News.prototype.LOG = function()
{ {
LOG("News " + message);
var args = Array.prototype.slice.call(arguments);
var translationKey = args.shift();
var message = "News ";
if (translationKey in this.logTranslations)
{
args.unshift(this.logTranslations[translationKey]);
// Topic: Converting an array to a function arguments list
// Source: https://stackoverflow.com/a/1316389
message += formatString.apply(null, args);
}
else
{
message += translationKey + " " + args.join(" ");
}
LOG(message);
} }
News.prototype.locateInputFiles = function() News.prototype.locateInputFiles = function()
{ {
@@ -6241,7 +6320,7 @@
} }
var failure = function() var failure = function()
{ {
self.LOG("ERROR Could not locate input files because LFSA request failed");
self.LOG("COULD_NOT_LOCATE_INPUT_FILES");
} }
var path = this.cfg["input"]; var path = this.cfg["input"];
@@ -6259,11 +6338,6 @@
} }
} }
if (files.length == 0)
{
this.LOG("ERROR No markdown files were found");
}
// Sort by name descending, effectively making latest news the first ones. // Sort by name descending, effectively making latest news the first ones.
files.sort(); files.sort();
files.reverse(); files.reverse();
@@ -6296,7 +6370,6 @@
var operation = operations[id]; var operation = operations[id];
fileContents.push(operation.contents); fileContents.push(operation.contents);
} }
self.LOG("Read '" + operations.length + "' markdown files");
self.markdownFileContents = fileContents; self.markdownFileContents = fileContents;
self.markdownFileContentsChanged.report(); self.markdownFileContentsChanged.report();
} }
@@ -6314,13 +6387,10 @@
var item = this.parseNewsItem(contents, fileName); var item = this.parseNewsItem(contents, fileName);
items.push(item); items.push(item);
} }
this.LOG("Parsed '" + items.length + "' markdown files");
// Report. // Report.
this.newsItems = items; this.newsItems = items;
this.newsItemsChanged.report(); this.newsItemsChanged.report();
} }
News.prototype.parseNewsItem = function(contents, fileName) News.prototype.parseNewsItem = function(contents, fileName)
{ {
var newsItem = new NewsItem(); var newsItem = new NewsItem();
@@ -6375,7 +6445,7 @@
} }
else else
{ {
this.LOG("WARNING `" + name + "` template is missing");
self.LOG("TEMPLATE_IS_MISSING", name);
} }
} }
@@ -6417,7 +6487,6 @@
var name = self.templateNames[fileName]; var name = self.templateNames[fileName];
templateContents[name] = operation.contents; templateContents[name] = operation.contents;
} }
self.LOG("Read '" + operations.length + "' templates");
self.templateContents = templateContents; self.templateContents = templateContents;
self.templateContentsChanged.report(); self.templateContentsChanged.report();
} }
@@ -6742,6 +6811,10 @@
function Tool() function Tool()
{ {
var self = this; var self = this;
this.logTranslations = {};
this.logTranslations["GEN_NEWS"] = "Generating news for directory '{0}'";
this.logTranslations["FINISH_GEN_NEWS"] = "Finished generating news for all directories";
this.errorMessage = "<span class='error'>Error</span>";
this.lfsa = new LFSA(); this.lfsa = new LFSA();
this.cfg = new Cfg(); this.cfg = new Cfg();
this.cfg.lfsa = this.lfsa; this.cfg.lfsa = this.lfsa;
@@ -6765,8 +6838,28 @@
self.news.run(); self.news.run();
}); });
} }
Tool.prototype.LOG = function()
{
var args = Array.prototype.slice.call(arguments);
var translationKey = args.shift();
var message = "Tool ";
if (translationKey in this.logTranslations)
{
args.unshift(this.logTranslations[translationKey]);
// Topic: Converting an array to a function arguments list
// Source: https://stackoverflow.com/a/1316389
message += formatString.apply(null, args);
}
else
{
message += translationKey + " " + args.join(" ");
}
LOG(message);
}
Tool.prototype.refreshLFSAPath = function() Tool.prototype.refreshLFSAPath = function()
{ {
var self = this;
var lfsaPath = document.getElementById("lfsaPath"); var lfsaPath = document.getElementById("lfsaPath");
var success = function(response) var success = function(response)
@@ -6775,7 +6868,7 @@
} }
var failure = function() var failure = function()
{ {
lfsaPath.innerHTML = "<span class='error'>Error</span>";
lfsaPath.innerHTML = self.errorMessage;
} }
this.lfsa.requestPath(success, failure); this.lfsa.requestPath(success, failure);
@@ -6794,20 +6887,19 @@
// Start processing. // Start processing.
this.processNewsGeneration(); this.processNewsGeneration();
} }
Tool.prototype.processNewsGeneration = function() Tool.prototype.processNewsGeneration = function()
{ {
if (this.newsDirs.length > 0) if (this.newsDirs.length > 0)
{ {
var dir = this.newsDirs.shift(); var dir = this.newsDirs.shift();
LOG("Generating news for directory '" + dir + "'");
this.LOG("GEN_NEWS", dir);
this.cfg.cfg["input"] = dir; this.cfg.cfg["input"] = dir;
this.cfg.cfg["output"] = this.cfg.cfg["input"]; this.cfg.cfg["output"] = this.cfg.cfg["input"];
this.news.generate(); this.news.generate();
} }
else else
{ {
LOG("Finished generating news for all directories");
this.LOG("FINISH_GEN_NEWS");
// Restore original 'input'. // Restore original 'input'.
this.cfg.cfg["input"] = this.originalInput; this.cfg.cfg["input"] = this.originalInput;
// Delete temorary 'output'. // Delete temorary 'output'.
@@ -6821,4 +6913,3 @@
</script> </script>
</body> </body>
</html> </html>


+ 1
- 1
pskov/index.html View File

@@ -1,4 +1,4 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<meta http-equiv="refresh" content="0; URL='en/tool.pskov.html'"/>
<meta http-equiv="refresh" content="0; URL='en/pskov_1.0.0.html'"/>
</html> </html>

Loading…
Cancel
Save