mirror of https://github.com/jpanther/congo.git
Compare commits
20 Commits
e9552734d8
...
9f956cad85
Author | SHA1 | Date |
---|---|---|
Wen Junhua | 9f956cad85 | |
James Panther | 587f85e2e0 | |
James Panther | e8a701a215 | |
James Panther | 17e9df5f4d | |
James Panther | 98902cf06b | |
James Panther | b2f82274ed | |
James Panther | 25f82b2f28 | |
James Panther | d659edb7df | |
James Panther | f9c29f8a21 | |
Robert Boscacci | b04ca3fb3d | |
Wen Junhua | c514283044 | |
Wen Junhua | 2cf1371c3e | |
Wen Junhua | a1a2e10481 | |
Wen Junhua | 97a3f0064c | |
Wen Junhua | a7fa3be37d | |
Wen Junhua | 679898570c | |
Wen Junhua | db07288d01 | |
Wen Junhua | 3c81e00bed | |
Wen Junhua | eb527de54b | |
Wen Junhua | 3a998b4598 |
|
@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
## [2.8.0] - 2024-01-22
|
||||
|
||||
### Added
|
||||
|
||||
- Quicklink support ([#646](https://github.com/jpanther/congo/pull/646))
|
||||
|
@ -16,6 +18,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|||
- Weibo sharing links ([#756](https://github.com/jpanther/congo/pull/756))
|
||||
- Support for Tailwind '950' colour variants ([#751](https://github.com/jpanther/congo/pull/751))
|
||||
- Table of contents will now scroll if taller than the browser height ([#733](https://github.com/jpanther/congo/pull/733))
|
||||
- External URL article stubs now auto-redirect if leaf pages are generated ([#778](https://github.com/jpanther/congo/pull/778))
|
||||
- Korean translation ([#731](https://github.com/jpanther/congo/pull/731))
|
||||
- Chinese translation of Example site and Docs ([#776](https://github.com/jpanther/congo/pull/776))
|
||||
|
||||
|
@ -838,7 +841,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|||
- Advanced customisation using simple Tailwind colour definitions and styles
|
||||
- Fully documented
|
||||
|
||||
[Unreleased]: https://github.com/jpanther/congo/compare/v2.7.6...HEAD
|
||||
[Unreleased]: https://github.com/jpanther/congo/compare/v2.8.0...HEAD
|
||||
[2.8.0]: https://github.com/jpanther/congo/compare/v2.7.6...v2.8.0
|
||||
[2.7.6]: https://github.com/jpanther/congo/compare/v2.7.5...v2.7.6
|
||||
[2.7.5]: https://github.com/jpanther/congo/compare/v2.7.4...v2.7.5
|
||||
[2.7.4]: https://github.com/jpanther/congo/compare/v2.7.3...v2.7.4
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*! Congo v2.7.6 | MIT License | https://github.com/jpanther/congo */
|
||||
/*! Congo v2.8.0 | MIT License | https://github.com/jpanther/congo */
|
||||
|
||||
/*! tailwindcss v3.4.1 | MIT License | https://tailwindcss.com */
|
||||
|
||||
|
@ -1798,10 +1798,6 @@ code {
|
|||
top: 5rem;
|
||||
}
|
||||
|
||||
.top-8 {
|
||||
top: 2rem;
|
||||
}
|
||||
|
||||
.top-\[100vh\] {
|
||||
top: 100vh;
|
||||
}
|
||||
|
@ -2000,22 +1996,14 @@ code {
|
|||
height: 3rem;
|
||||
}
|
||||
|
||||
.h-2 {
|
||||
height: 0.5rem;
|
||||
}
|
||||
|
||||
.h-24 {
|
||||
height: 6rem;
|
||||
}
|
||||
|
||||
.h-36 {
|
||||
height: 9rem;
|
||||
}
|
||||
|
||||
.h-8 {
|
||||
height: 2rem;
|
||||
}
|
||||
|
||||
.h-auto {
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.h-full {
|
||||
height: 100%;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*! Congo v2.7.6 | MIT License | https://github.com/jpanther/congo */
|
||||
/*! Congo v2.8.0 | MIT License | https://github.com/jpanther/congo */
|
||||
|
||||
@tailwind base;
|
||||
@tailwind components;
|
||||
|
|
|
@ -70,5 +70,6 @@ La lista a continuación es solo un puñado de sitios web creados con el tema Co
|
|||
| [jnsgr.uk](https://jnsgr.uk) | Personal site and blog |
|
||||
| [stupidjoey.net](https://stupidjoey.net) | Personal Site and Tech blog |
|
||||
| [aminelch.github.io](https://aminelch.github.io) | Personal Site and Blog |
|
||||
| [robertboscacci.com](https://robertboscacci.com) | Personal Site and Blog |
|
||||
|
||||
**¿Usuaria de congo?** Para agregar tu sitio a esta lista, [haz un pull request](https://github.com/jpanther/congo/blob/dev/exampleSite/content/users/index.md).
|
||||
|
|
|
@ -70,5 +70,6 @@ Congoを使用して構築された実際のウェブサイト。
|
|||
| [jnsgr.uk](https://jnsgr.uk) | Personal site and blog |
|
||||
| [stupidjoey.net](https://stupidjoey.net) | Personal Site and Tech blog |
|
||||
| [aminelch.github.io](https://aminelch.github.io) | Personal Site and Blog |
|
||||
| [robertboscacci.com](https://robertboscacci.com) | Personal Site and Blog |
|
||||
|
||||
**Congoを使っていますか?** あなたのウェブサイトを加えるために[Pull Request](https://github.com/jpanther/congo/blob/dev/exampleSite/content/users/index.md)を投げてください。
|
||||
|
|
|
@ -70,5 +70,6 @@ The list below is just a handful of the websites that are built using the Congo
|
|||
| [jnsgr.uk](https://jnsgr.uk) | Personal site and blog |
|
||||
| [stupidjoey.net](https://stupidjoey.net) | Personal Site and Tech blog |
|
||||
| [aminelch.github.io](https://aminelch.github.io) | Personal Site and Blog |
|
||||
| [robertboscacci.com](https://robertboscacci.com) | Personal Site and Blog |
|
||||
|
||||
**Congo user?** To add your site to this list, [submit a pull request](https://github.com/jpanther/congo/blob/dev/exampleSite/content/users/index.md).
|
||||
|
|
|
@ -70,5 +70,6 @@ showEdit: false
|
|||
| [jnsgr.uk](https://jnsgr.uk) | Personal site and blog |
|
||||
| [stupidjoey.net](https://stupidjoey.net) | Personal Site and Tech blog |
|
||||
| [aminelch.github.io](https://aminelch.github.io) | Personal Site and Blog |
|
||||
| [robertboscacci.com](https://robertboscacci.com) | Personal Site and Blog |
|
||||
|
||||
**想成为Congo的用户?** 要将您的网站添加到此列表中,请提交[Pull Request](https://github.com/jpanther/congo/blob/dev/exampleSite/content/users/index.md)来添加。
|
||||
|
|
|
@ -120,6 +120,9 @@
|
|||
{{ with .Site.Params.verification.yandex }}
|
||||
<meta name="yandex-verification" content="{{ . }}" />
|
||||
{{ end }}
|
||||
{{ with $.Params.externalUrl }}
|
||||
<meta http-equiv="refresh" content="0; url={{ . }}" />
|
||||
{{ end }}
|
||||
{{/* Social */}}
|
||||
{{ template "_internal/opengraph.html" . }}
|
||||
{{ template "_internal/twitter_cards.html" . }}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "hugo-congo-theme",
|
||||
"version": "2.7.6",
|
||||
"version": "2.8.0",
|
||||
"description": "Congo theme for Hugo",
|
||||
"scripts": {
|
||||
"preinstall": "rimraf assets/lib",
|
||||
|
@ -9,7 +9,8 @@
|
|||
"dev": "NODE_ENV=development ./node_modules/tailwindcss/lib/cli.js -i ./assets/css/main.css -o ./assets/css/compiled/main.css --jit -w",
|
||||
"build": "NODE_ENV=production ./node_modules/tailwindcss/lib/cli.js -i ./assets/css/main.css -o ./assets/css/compiled/main.css --jit",
|
||||
"example": "hugo server --bind 0.0.0.0 -p 8008 --source exampleSite --themesDir ../.. --buildDrafts -b http://localhost/congo/ ",
|
||||
"lighthouse": "lhci autorun"
|
||||
"lighthouse": "lhci autorun",
|
||||
"add-icon": "node scripts/index.js add-icon"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -32,6 +33,7 @@
|
|||
"@tailwindcss/typography": "^0.5.10",
|
||||
"chart.js": "^4.4.1",
|
||||
"fuse.js": "^7.0.0",
|
||||
"jsdom": "^23.0.1",
|
||||
"katex": "^0.16.9",
|
||||
"mermaid": "^10.7.0",
|
||||
"prettier": "^3.2.4",
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
#!/usr/bin/env node
|
||||
const { program } = require("commander");
|
||||
const { add_icon_to_congo } = require("./update_icon");
|
||||
|
||||
// Adds an icon to the project.
|
||||
program
|
||||
.command("add-icon <icon_name>")
|
||||
.description("Add icon to the project")
|
||||
.action(add_icon_to_congo);
|
||||
|
||||
program.parse(process.argv);
|
|
@ -0,0 +1,97 @@
|
|||
const jsdom = require("jsdom");
|
||||
const fs = require("fs");
|
||||
|
||||
const DOC_DIR = "./exampleSite/content/samples/icons";
|
||||
const FONTAWESOME_VERSION = "v6.5.1";
|
||||
const DEFAULT_TABLE_DELIMITER = "| -------------------- | --------------------------------- |";
|
||||
|
||||
/**
|
||||
* Saves an icon to the congo project and update documentation.
|
||||
* @param {string} icon_name Icon name from Font Awesome to download
|
||||
* @returns null
|
||||
*/
|
||||
const add_icon_to_congo = async (icon_name) => {
|
||||
try {
|
||||
const icon_url = create_icon_url(icon_name, FONTAWESOME_VERSION);
|
||||
const file = await get_file(icon_url);
|
||||
const final_svg = modify_svg_string(file);
|
||||
const icon_download_path = create_icon_download_path(icon_name);
|
||||
save_file(icon_download_path, final_svg);
|
||||
add_documentation(icon_name);
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
const modify_svg_string = (svg_string) => {
|
||||
try {
|
||||
dom = new jsdom.JSDOM(svg_string);
|
||||
svg = dom.window.document.documentElement.querySelector("svg");
|
||||
svg.querySelector("path").setAttribute("fill", "currentColor");
|
||||
return svg.outerHTML;
|
||||
} catch (e) {
|
||||
throw new Error("Invalid SVG file");
|
||||
}
|
||||
};
|
||||
|
||||
const create_icon_url = (icon_name, fontawesome_version) => {
|
||||
return `https://site-assets.fontawesome.com/releases/${fontawesome_version}/svgs/brands/${icon_name}.svg`;
|
||||
};
|
||||
|
||||
const create_icon_download_path = (icon_name) => {
|
||||
return `./assets/icons/${icon_name}.svg`;
|
||||
};
|
||||
|
||||
const get_file = async (url) => {
|
||||
console.log("Getting file at " + url + "...");
|
||||
const response = await fetch(url);
|
||||
if (response.status >= 400) {
|
||||
throw new Error("Could not download icon / icon not found");
|
||||
}
|
||||
console.log("File retrieved!");
|
||||
return response.text();
|
||||
};
|
||||
|
||||
const save_file = (file_path, file) => {
|
||||
console.log("Saving file at " + file_path + "...");
|
||||
fs.writeFile(file_path, file, function (err) {
|
||||
if (err) throw err;
|
||||
console.log("File saved!");
|
||||
});
|
||||
};
|
||||
|
||||
const add_documentation = async (icon_name) => {
|
||||
files = get_md_docs();
|
||||
|
||||
for (const file of files) {
|
||||
const file_path = `${DOC_DIR}/${file}`;
|
||||
const file_contents = fs.readFileSync(file_path, "utf8");
|
||||
const file_result = process_file(file_contents, icon_name);
|
||||
// Save file_result to file_path
|
||||
fs.writeFile(file_path, file_result, function (err) {
|
||||
if (err) throw err;
|
||||
});
|
||||
console.log(`Updated ${file_path}`);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Process the file contents to include the icon name.
|
||||
* @param {string} file_contents contents of the documentation files.
|
||||
* @returns {string} processed file contents.
|
||||
*/
|
||||
const process_file = (file_contents, icon_name) => {
|
||||
const [headers, table] = file_contents.split(DEFAULT_TABLE_DELIMITER);
|
||||
const table_rows = table.split("\n").map((x) => x.trim()).filter((row) => row !== "");
|
||||
table_rows.push(table_rows[0].replace("amazon", icon_name));
|
||||
table_rows.sort();
|
||||
const new_table = table_rows.join("\n");
|
||||
return `${headers.trimEnd()}\n${DEFAULT_TABLE_DELIMITER}\n${new_table}\n`;
|
||||
};
|
||||
|
||||
const get_md_docs = () => {
|
||||
return fs.readdirSync(DOC_DIR).filter((file) => file.endsWith(".md"));
|
||||
};
|
||||
|
||||
module.exports = { add_icon_to_congo };
|
Loading…
Reference in New Issue