Skip to content

Commit e68cc52

Browse files
committed
Try to auto fix relative links in inginious description
1 parent 7028b2d commit e68cc52

12 files changed

+172
-91
lines changed

README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ some attributes for an exercise are required
6969
(like `"title"`, `tags`, `description`) whereas some are optional (like `"url"` or `"file"`).
7070

7171
As you can see, whatever the platform, there is some common tags categories that should be used whenever it is possible.
72-
The full list of them :
72+
An possible [example](default_auto_generated_tags.json) might be:
7373

7474
```json
7575
{
@@ -138,7 +138,8 @@ These two sub properties must be present : use an empty array if you don't have
138138
Each item of these arrays should be relative path so `archiver` can build the absolute path with the option `baseFolder` (in case you change location of an exercise folder afterward)
139139
and automatically add the `"file"` property in each exercise.
140140

141-
Using the property `"file"` in each exercise, the `uploader` command will do for you the mapping between files and exercises when you want to upload exercises into the API.
141+
Using the property `"file"` in each exercise, the `uploader` command will do for you the mapping between files and exercises when you want to upload exercises into the API.
142+
(don't forget to use option `auto_generated_tags_categories` in `uploader` if you used other common tag categories)
142143

143144
## Which strategies are available by default for crawler ?
144145

commands/uploader.js

+12
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,24 @@ exports = module.exports = {
3333
description: 'Absolute path to a JSON file that contains admin credentials like this : {"email": "", "password": ""}',
3434
demandOption: true
3535
})
36+
.option("auto_generated_tags_categories", {
37+
type: "string",
38+
description: 'Absolute path to a JSON file that contains a map of autogenerated tag categories (see Readme.md)',
39+
default: path.resolve(__dirname, "..", "default_auto_generated_tags.json")
40+
})
3641
.config("settings", "Absolute path to a JSON config file for uploader", (configPath) => {
3742
return JSON.parse(readFileSync(path.resolve(configPath), 'utf-8'));
3843
})
3944
.coerce("resultFile", (arg) => {
4045
return JSON.parse(readFileSync(path.resolve(arg), 'utf-8'));
4146
})
47+
.coerce("auto_generated_tags_categories", (arg => {
48+
const tags_categories = JSON.parse(readFileSync(arg, 'utf-8'));
49+
if (!(tags_categories instanceof Object)) {
50+
throw new Error("The given JSON should be an object");
51+
}
52+
return tags_categories;
53+
}))
4254
.coerce("user", (arg) => {
4355
const user = JSON.parse(readFileSync(arg, 'utf-8'));
4456
if (["email", "password"].some(required_field => !user.hasOwnProperty(required_field))) {

default_auto_generated_tags.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"_PLATFORM_": "plateforme",
3+
"_SOURCE_": "source",
4+
"_COURSE_": "cours",
5+
"_EXERCISE-TYPE_": "type d'exercice",
6+
"_PROGRAMMING-LANGUAGE_": "langage",
7+
"_AUTHOR_": "auteur"
8+
}

package-lock.json

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
{
22
"name": "@sourcecodeoer/cli",
33
"version": "1.0.0",
4-
"keywords": ["cli", "sourcecode", "oer" ,"crawler", "uploader", "archiver", "validator", "programming-exercises", "cataloging"],
4+
"keywords": [
5+
"cli",
6+
"sourcecode",
7+
"oer",
8+
"crawler",
9+
"uploader",
10+
"archiver",
11+
"validator",
12+
"programming-exercises",
13+
"cataloging"
14+
],
515
"description": "CLI tools for SourceCode",
616
"bin": {
717
"sourcecode-cli": "./index.js"
@@ -37,6 +47,7 @@
3747
"@hapi/joi": "^16.1.8",
3848
"archiver": "^3.1.1",
3949
"filehound": "^1.17.3",
50+
"is-absolute-url": "^3.0.3",
4051
"js-yaml": "^3.13.1",
4152
"lodash.groupby": "^4.6.0",
4253
"lodash.partition": "^4.6.0",

results/results1.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,7 @@
832832
},
833833
{
834834
"title": "Simple Binary Search Tree",
835-
"description": "For this task, you will implement a simple binary search on an existing\r\nbinary tree. A binary tree has the following structure:\r\n\r\n<img src=\"BST/bst.png\" width=\"540\" height=\"340\" alt=\"image\" />\r\n\r\nThis binary tree is composed of nodes implemented using the following\r\nstructure.\r\n\r\n``` c\r\n/*\r\n* Node has a value, @value, and two children, @left and @right.\r\n* All the children of @left and itself have a smaller value than the node and all the children of @right and itself have a larger value than node\r\n*/\r\ntypedef struct node{\r\n int value;\r\n struct node* left; // to smaller values\r\n struct node* right; // to larger values\r\n} node_t;\r\n```\r\n\r\nThe binary tree itself is defined as follows.\r\n\r\n``` c\r\ntypedef struct bt{\r\n struct node* root;\r\n} bt_t;\r\n```\r\n",
835+
"description": "For this task, you will implement a simple binary search on an existing\r\nbinary tree. A binary tree has the following structure:\r\n\r\n<img src=\"https://inginious.info.ucl.ac.be/course/LSINF1252/BST/bst.png\" width=\"540\" height=\"340\" alt=\"image\" />\r\n\r\nThis binary tree is composed of nodes implemented using the following\r\nstructure.\r\n\r\n``` c\r\n/*\r\n* Node has a value, @value, and two children, @left and @right.\r\n* All the children of @left and itself have a smaller value than the node and all the children of @right and itself have a larger value than node\r\n*/\r\ntypedef struct node{\r\n int value;\r\n struct node* left; // to smaller values\r\n struct node* right; // to larger values\r\n} node_t;\r\n```\r\n\r\nThe binary tree itself is defined as follows.\r\n\r\n``` c\r\ntypedef struct bt{\r\n struct node* root;\r\n} bt_t;\r\n```\r\n",
836836
"tags": [
837837
{
838838
"text": "INGINIOUS",
@@ -2423,7 +2423,7 @@
24232423
},
24242424
{
24252425
"title": "Producteurs/Consommateurs",
2426-
"description": "Le syllabus est accessible depuis l'URL\r\n<http://sites.uclouvain.be/SystInfo>\r\n\r\nLes pages de manuel sont accessibles depuis les URLs suivants : \r\n- <http://sites.uclouvain.be/SystInfo/manpages/man1> (commandes)\r\n- <http://sites.uclouvain.be/SystInfo/manpages/man2> (appels systèmes)\r\n- <http://sites.uclouvain.be/SystInfo/manpages/man3> (fonctions des\r\n librairies)\r\n\r\n**Attention:** veuillez utiliser la version **HTML** du syllabus\r\n\r\n![image](PC/buffer.png)\r\n",
2426+
"description": "Le syllabus est accessible depuis l'URL\r\n<http://sites.uclouvain.be/SystInfo>\r\n\r\nLes pages de manuel sont accessibles depuis les URLs suivants : \r\n- <http://sites.uclouvain.be/SystInfo/manpages/man1> (commandes)\r\n- <http://sites.uclouvain.be/SystInfo/manpages/man2> (appels systèmes)\r\n- <http://sites.uclouvain.be/SystInfo/manpages/man3> (fonctions des\r\n librairies)\r\n\r\n**Attention:** veuillez utiliser la version **HTML** du syllabus\r\n\r\n![image](https://inginious.info.ucl.ac.be/course/LSINF1252/PC/buffer.png)\r\n",
24272427
"tags": [
24282428
{
24292429
"text": "INGINIOUS",
@@ -2575,7 +2575,7 @@
25752575
},
25762576
{
25772577
"title": "Printing data",
2578-
"description": "In this exercise, you will familiarize yourself with the functions\r\n[printf(3)](https://sites.uclouvain.be/SystInfo/manpages/man3/printf.3.html)\r\n(printing on the standard output) and\r\n[sprintf(3)](%60printf%20%3Chttps://sites.uclouvain.be/SystInfo/manpages/man3/sprintf.3.html)\r\n(text formatting).\r\n",
2578+
"description": "In this exercise, you will familiarize yourself with the functions\r\n[printf(3)](https://sites.uclouvain.be/SystInfo/manpages/man3/printf.3.html)\r\n(printing on the standard output) and\r\n[sprintf(3)](https://inginious.info.ucl.ac.be/course/LSINF1252/%60printf%20%3Chttps://sites.uclouvain.be/SystInfo/manpages/man3/sprintf.3.html)\r\n(text formatting).\r\n",
25792579
"tags": [
25802580
{
25812581
"text": "INGINIOUS",
@@ -4656,6 +4656,6 @@
46564656
"1": "Misconception",
46574657
"2": "autres"
46584658
},
4659-
"extraction_date": "2019-12-14T12:02:19.357Z",
4659+
"extraction_date": "2019-12-17T22:37:37.244Z",
46604660
"url": "https://github.com/UCL-INGI/LSINF1252"
46614661
}

0 commit comments

Comments
 (0)