-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #89 from UNopenGIS:dev
Add presentations to resources as a part of the build process
- Loading branch information
Showing
9 changed files
with
242 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,172 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 33, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"['../docs/events/2023-05-22.md', '../docs/events/2023-05-26.md', '../docs/events/2023-06-16.md', '../docs/events/2023-06-19.md', '../docs/events/2023-07-17.md', '../docs/events/2023-07-21.md', '../docs/events/2023-08-09.md', '../docs/events/2023-08-18.md', '../docs/events/2023-08-20.md', '../docs/events/index.md']\n", | ||
"input_date::: 2023-08-09\n", | ||
"creating file\n", | ||
"input_date::: 2023-08-20\n", | ||
"creating file\n", | ||
"Processed 3 lines.\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"import os\n", | ||
"import csv\n", | ||
"participation_link = \"https://ucla.zoom.us/meeting/register/tJcoc-mvrTovG920aIcgb-64RaKdVWKTb1Ik\"\n", | ||
"current_markdown_files = []\n", | ||
"\n", | ||
"def process_csv(file):\n", | ||
" with open(file) as csv_file:\n", | ||
" csv_reader = csv.reader(csv_file, delimiter=',')\n", | ||
" line_count = 0\n", | ||
" for row in csv_reader:\n", | ||
" if line_count != 0:\n", | ||
" create_markdown_from_csv(row,\"en\")\n", | ||
" line_count += 1\n", | ||
" print(f'Processed {line_count} lines.')\n", | ||
"\n", | ||
"def get_files_in_folder(folder):\n", | ||
" current_markdown_files = []\n", | ||
" for r, d, f in os.walk(folder):\n", | ||
" for file in f:\n", | ||
" if '.md' in file:\n", | ||
" if file not in current_markdown_files:\n", | ||
" current_markdown_files.append(os.path.join(r, file))\n", | ||
" return current_markdown_files\n", | ||
"\n", | ||
"def check_list_of_presentation_markdown_files(path):\n", | ||
" return get_files_in_folder(path)\n", | ||
"\n", | ||
"def create_markdown_from_csv(input_csv,language):\n", | ||
" input_date = input_csv[1]\n", | ||
"\n", | ||
" print('input_date::: '+str(input_date))\n", | ||
" if input_date not in current_markdown_files:\n", | ||
" print('creating file')\n", | ||
" generate_markdown_file(input_csv,language)\n", | ||
"\n", | ||
"def generate_markdown_file(input_csv,language):\n", | ||
" outfile = None\n", | ||
" outfile_path = \"\"\n", | ||
" \n", | ||
" if language == \"en\":\n", | ||
" outfile_path = \"../docs/events/\"+input_csv[1]+\".md\"\n", | ||
" # outfile = open(\"../docs/events/\"+input_csv[1]+\".md\", \"w\")\n", | ||
" else:\n", | ||
" outfile_path = \"../i18n/\"+language+\"/docusarus-plugin-content-docs/current/\"+input_csv[1]+\".md\"\n", | ||
" # outfile = open(, \"w\")\n", | ||
" if outfile_path is not None:\n", | ||
" append_copy = open(outfile_path, \"r\")\n", | ||
" original_text = append_copy.read()\n", | ||
" append_copy.close()\n", | ||
" append_copy = open(outfile_path, \"w\")\n", | ||
" # outfile.write(original_text)\n", | ||
" # write_markdown_header(outfile,input_csv)\n", | ||
" # outfile.write(old_content.read())\n", | ||
" write_presentation_contents(append_copy,input_csv)\n", | ||
" \n", | ||
"\n", | ||
"def write_presentation_contents(outfile,input_csv):\n", | ||
" outfile.write(\"\\n ## Presentation \\n\"+input_csv[2]+\"\\n\")\n", | ||
" outfile.write(\"\\n View the [recording](\"+input_csv[3]+\") \\n\")\n", | ||
" outfile.write(\" Download the [slides](\"+input_csv[5]+\") \\n\")\n", | ||
"\n", | ||
"def write_markdown_header(outfile,input_csv):\n", | ||
" outfile.write(\"---\\n\")\n", | ||
" outfile.write(\"id: \"+input_csv[1]+\"\\n\")\n", | ||
" outfile.write(\"title: \"+input_csv[0]+\"\\n\")\n", | ||
" outfile.write(\"authors: \"+input_csv[2]+\"\\n\")\n", | ||
" outfile.write(\"sidebar_label: \"+input_csv[0]+\"\\n\")\n", | ||
" outfile.write(\"hide_title: false\\n\")\n", | ||
" outfile.write(\"hide_table_of_contents: false\\n\")\n", | ||
" outfile.write(\"keywords:\\n\")\n", | ||
" outfile.write(\" - \"+input_csv[4]+\"\\n\")\n", | ||
" outfile.write(\"---\\n\")\n", | ||
"\n", | ||
"def write_markdown_body(outfile,input_csv):\n", | ||
" outfile.write(\"\\n # \"+input_csv[0]+\"\\n\")\n", | ||
" outfile.write(\"\\n ## Date \"+input_csv[1]+\"\\n\")\n", | ||
" this_date = input_csv[1]\n", | ||
" this_time = input_csv[2]\n", | ||
" add_padded_zero_for_date(this_date)\n", | ||
" utc_format_the_time(this_time)\n", | ||
" outfile.write(\"\\n Time [\"+input_csv[3]+\" UTC](https://www.timeanddate.com/worldclock/fixedtime.html?msg=\"+input_csv[0]+\"&iso=\"+add_padded_zero_for_date(this_date)+\"T\"+this_time.split(\":\")[0]+\"&p1=1440&ah=1) \\n\")\n", | ||
" outfile.write(\"\\n ## How to join \\n Join via the this [Zoom link](\"+participation_link+\"). \\n\")\n", | ||
"\n", | ||
"\n", | ||
"def add_padded_zero_for_date(this_date):\n", | ||
" this_date = this_date.split(\"-\")\n", | ||
" if len(this_date[1]) == 1:\n", | ||
" this_date[1] = \"0\"+this_date[1]\n", | ||
" if len(this_date[2]) == 1:\n", | ||
" this_date[2] = \"0\"+this_date[2]\n", | ||
" this_date = \"-\".join(this_date)\n", | ||
" return this_date\n", | ||
"\n", | ||
"\n", | ||
"def utc_format_the_time(this_time):\n", | ||
" this_time = this_time.split(\":\")\n", | ||
" if len(this_time[0]) == 1:\n", | ||
" this_time[0] = \"0\"+this_time[0]\n", | ||
" if len(this_time[1]) == 1:\n", | ||
" this_time[1] = \"0\"+this_time[1]\n", | ||
" this_time = \"\".join(this_time)\n", | ||
" return this_time\n", | ||
"\n", | ||
"def __main__():\n", | ||
" current_markdown_files_eng = check_list_of_presentation_markdown_files(\"../docs/events/\")\n", | ||
" \n", | ||
" print(current_markdown_files_eng)\n", | ||
" process_csv(\"../presentations.csv\")\n", | ||
"\n", | ||
"if __name__ == \"__main__\":\n", | ||
" __main__()\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"def " | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.9.7" | ||
}, | ||
"orig_nbformat": 4 | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Presentations | ||
|
||
| Title | Date |Speaker | Link | Keywords | | ||
| ----- | ---- | ------- | ---- | -------- | | ||
| Documentation Update | 2023-08-20 | Albert Kochaphum | [Link](https://hackmd.io/@MXxudfFtSvSvSonMo4L3qQ/SyT0kFwqn#/1) | documentation, UN Smartmaps | | ||
| UN Smart Maps Quarterly #1 | 2023-08-09 | Hidenori Fujimura and Yuiseki Matsumura | [Link](https://docs.google.com/presentation/d/1OwuZeywXDsbAmpsuYT3m70hp4psQag7O8nfHJZNzvrs/edit?usp=sharing) | UN, Smartmaps, quarterly | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
const fs = require('fs'); | ||
const csv = require('csv-parser'); | ||
|
||
const presentations = []; | ||
|
||
fs.createReadStream('presentations.csv') | ||
.pipe(csv()) | ||
.on('data', (row) => { | ||
presentations.push(row); | ||
}) | ||
.on('end', () => { | ||
// Sort presentations by date in descending order | ||
presentations.sort((a, b) => new Date(b.date) - new Date(a.date)); | ||
|
||
let markdownEN = '# Presentations\n\n'; | ||
let markdownJP = '# プレゼンテーション\n\n'; // Translated "Presentations" | ||
|
||
markdownEN += '| Title | Date |Speaker | Link | Keywords |\n'; | ||
markdownEN += '| ----- | ---- | ------- | ---- | -------- |\n'; | ||
|
||
markdownJP += '| タイトル | 日付 | スピーカー | リンク | キーワード |\n'; // Translated headers | ||
markdownJP += '| ------ | ---- | -------- | ---- | -------- |\n'; | ||
|
||
presentations.forEach((presentation) => { | ||
markdownEN += `| ${presentation["presentation title"]} | ${presentation.date} | ${presentation.speaker} | [Link](${presentation.link}) | ${presentation.keywords} |\n`; | ||
|
||
markdownJP += `| ${presentation["presentation title"]} | ${presentation.date} | ${presentation.speaker} | [リンク](${presentation.link}) | ${presentation.keywords} |\n`; // Translated "Link" | ||
}); | ||
|
||
fs.writeFileSync('docs/resources/presentations/index.md', markdownEN); | ||
fs.writeFileSync('i18n/ja/docusaurus-plugin-content-docs/current/resources/presentations/index.md', markdownJP); | ||
console.log('Markdown files have been updated successfully! 🎉'); | ||
}); |
6 changes: 6 additions & 0 deletions
6
i18n/ja/docusaurus-plugin-content-docs/current/resources/presentations/index.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# プレゼンテーション | ||
|
||
| タイトル | 日付 | スピーカー | リンク | キーワード | | ||
| ------ | ---- | -------- | ---- | -------- | | ||
| Documentation Update | 2023-08-20 | Albert Kochaphum | [リンク](https://hackmd.io/@MXxudfFtSvSvSonMo4L3qQ/SyT0kFwqn#/1) | documentation, UN Smartmaps | | ||
| UN Smart Maps Quarterly #1 | 2023-08-09 | Hidenori Fujimura and Yuiseki Matsumura | [リンク](https://docs.google.com/presentation/d/1OwuZeywXDsbAmpsuYT3m70hp4psQag7O8nfHJZNzvrs/edit?usp=sharing) | UN, Smartmaps, quarterly | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
"presentation title",date,speaker,link,keywords | ||
"UN Smart Maps Quarterly #1",2023-08-09,"Hidenori Fujimura and Yuiseki Matsumura ","https://docs.google.com/presentation/d/1OwuZeywXDsbAmpsuYT3m70hp4psQag7O8nfHJZNzvrs/edit?usp=sharing","UN, Smartmaps, quarterly" | ||
"Documentation Update",2023-08-20,"Albert Kochaphum","https://hackmd.io/@MXxudfFtSvSvSonMo4L3qQ/SyT0kFwqn#/1","documentation, UN Smartmaps" | ||
"presentation title",date,time,speaker,link,keywords | ||
"UN Smart Maps Quarterly #1",2023-08-09,16:45,"Hidenori Fujimura and Yuiseki Matsumura ","https://docs.google.com/presentation/d/1OwuZeywXDsbAmpsuYT3m70hp4psQag7O8nfHJZNzvrs/edit?usp=sharing","UN, Smartmaps, quarterly" | ||
"Documentation Update",2023-08-20,03:00,"Albert Kochaphum","https://hackmd.io/@MXxudfFtSvSvSonMo4L3qQ/SyT0kFwqn#/1","documentation, UN Smartmaps" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5181,6 +5181,13 @@ csstype@^3.0.2: | |
resolved "https://registry.npmjs.org/csstype/-/csstype-3.1.2.tgz" | ||
integrity sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ== | ||
|
||
csv-parser@^3.0.0: | ||
version "3.0.0" | ||
resolved "https://registry.yarnpkg.com/csv-parser/-/csv-parser-3.0.0.tgz#b88a6256d79e090a97a1b56451f9327b01d710e7" | ||
integrity sha512-s6OYSXAK3IdKqYO33y09jhypG/bSDHPuyCme/IdEHfWpLf/jKcpitVFyOC6UemgGk8v7Q5u2XE0vvwmanxhGlQ== | ||
dependencies: | ||
minimist "^1.2.0" | ||
|
||
cytoscape-cose-bilkent@^4.1.0: | ||
version "4.1.0" | ||
resolved "https://registry.npmjs.org/cytoscape-cose-bilkent/-/cytoscape-cose-bilkent-4.1.0.tgz" | ||
|
@@ -9807,7 +9814,6 @@ [email protected], react-router@^5.3.3, react-router@^5.3.4: | |
react-is "^16.6.0" | ||
tiny-invariant "^1.0.2" | ||
tiny-warning "^1.0.0" | ||
|
||
react-textarea-autosize@~8.3.2: | ||
version "8.3.4" | ||
resolved "https://registry.yarnpkg.com/react-textarea-autosize/-/react-textarea-autosize-8.3.4.tgz#270a343de7ad350534141b02c9cb78903e553524" | ||
|