diff --git a/.JuliaFormatter.toml b/.JuliaFormatter.toml new file mode 100644 index 0000000..453925c --- /dev/null +++ b/.JuliaFormatter.toml @@ -0,0 +1 @@ +style = "sciml" \ No newline at end of file diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..700707c --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,7 @@ +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" # Location of package manifests + schedule: + interval: "weekly" diff --git a/.github/workflows/CompatHelper.yml b/.github/workflows/CompatHelper.yml index cba9134..5577817 100644 --- a/.github/workflows/CompatHelper.yml +++ b/.github/workflows/CompatHelper.yml @@ -1,16 +1,43 @@ -name: CompatHelper on: schedule: - cron: 0 0 * * * workflow_dispatch: +permissions: + contents: write + pull-requests: write jobs: CompatHelper: runs-on: ubuntu-latest steps: - - name: Pkg.add("CompatHelper") - run: julia -e 'using Pkg; Pkg.add("CompatHelper")' - - name: CompatHelper.main() + - name: Check if Julia is already available in the PATH + id: julia_in_path + run: which julia + continue-on-error: true + - name: Install Julia, but only if it is not already available in the PATH + uses: julia-actions/setup-julia@v1 + with: + version: "1" + arch: ${{ runner.arch }} + if: steps.julia_in_path.outcome != 'success' + - name: "Add the General registry via Git" + run: | + import Pkg + ENV["JULIA_PKG_SERVER"] = "" + Pkg.Registry.add("General") + shell: julia --color=yes {0} + - name: "Install CompatHelper" + run: | + import Pkg + name = "CompatHelper" + uuid = "aa819f21-2bde-4658-8897-bab36330d9b7" + version = "3" + Pkg.add(; name, uuid, version) + shell: julia --color=yes {0} + - name: "Run CompatHelper" + run: | + import CompatHelper + CompatHelper.main() + shell: julia --color=yes {0} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} COMPATHELPER_PRIV: ${{ secrets.DOCUMENTER_KEY }} - run: julia -e 'using CompatHelper; CompatHelper.main()' diff --git a/.github/workflows/SpellCheck.yml b/.github/workflows/SpellCheck.yml new file mode 100644 index 0000000..9146006 --- /dev/null +++ b/.github/workflows/SpellCheck.yml @@ -0,0 +1,15 @@ +name: Spell Check + +on: [pull_request] + +jobs: + typos-check: + name: Spell Check with Typos + runs-on: ubuntu-latest + steps: + - name: Checkout Actions Repository + uses: actions/checkout@v4 + - name: Check spelling + uses: crate-ci/typos@v1.18.0 + with: + config: ./_typos.toml diff --git a/.github/workflows/TagBot.yml b/.github/workflows/TagBot.yml index f49313b..0cd3114 100644 --- a/.github/workflows/TagBot.yml +++ b/.github/workflows/TagBot.yml @@ -4,6 +4,22 @@ on: types: - created workflow_dispatch: + inputs: + lookback: + default: "3" +permissions: + actions: read + checks: read + contents: write + deployments: read + issues: read + discussions: read + packages: read + pages: read + pull-requests: read + repository-projects: read + security-events: read + statuses: read jobs: TagBot: if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot' diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bc9d939..7315e33 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,8 +1,48 @@ name: CI on: - - push - - pull_request + pull_request: + branches: + - master + - dev + paths-ignore: + - "docs/**" + push: + branches: + - master + paths-ignore: + - "docs/**" jobs: + formatter: + runs-on: ${{ matrix.os }} + strategy: + matrix: + julia-version: [1] + julia-arch: [x86] + os: [ubuntu-latest] + steps: + - uses: julia-actions/setup-julia@v2 + with: + version: ${{ matrix.julia-version }} + + - uses: actions/checkout@v4 + - name: Install JuliaFormatter and format + # This will use the latest version by default but you can set the version like so: + # + # julia -e 'using Pkg; Pkg.add(PackageSpec(name="JuliaFormatter", version="0.13.0"))' + run: | + julia -e 'using Pkg; Pkg.add(PackageSpec(name="JuliaFormatter", version="1.0.50"))' + julia -e 'using JuliaFormatter; format(".", verbose=true)' + - name: Format check + run: | + julia -e ' + out = Cmd(`git diff`) |> read |> String + if out == "" + exit(0) + else + @error "Some files have not been formatted !!!" + write(stdout, out) + exit(1) + end' test: name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} runs-on: ${{ matrix.os }} @@ -10,26 +50,32 @@ jobs: fail-fast: false matrix: version: - - "nightly" + - "lts" + - "1" + - "pre" os: - ubuntu-latest - - macOS-latest - - windows-latest arch: - x64 - x86 - exclude: + include: + # test macOS and Windows with latest Julia only - os: macOS-latest - arch: x86 + arch: x64 + version: 1 + - os: windows-latest + arch: x64 + version: 1 - os: windows-latest arch: x86 + version: 1 steps: - - uses: actions/checkout@v2 - - uses: julia-actions/setup-julia@v1 + - uses: actions/checkout@v4 + - uses: julia-actions/setup-julia@v2 with: version: ${{ matrix.version }} arch: ${{ matrix.arch }} - - uses: actions/cache@v1 + - uses: actions/cache@v4 env: cache-name: cache-artifacts with: @@ -42,15 +88,15 @@ jobs: - uses: julia-actions/julia-buildpkg@v1 - uses: julia-actions/julia-runtest@v1 - uses: julia-actions/julia-processcoverage@v1 - - uses: codecov/codecov-action@v1 + - uses: codecov/codecov-action@v4 with: file: lcov.info docs: name: Documentation runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: julia-actions/setup-julia@v1 + - uses: actions/checkout@v4 + - uses: julia-actions/setup-julia@v2 with: version: "1" - run: | diff --git a/.github/workflows/register.yml b/.github/workflows/register.yml new file mode 100644 index 0000000..5b7cd3b --- /dev/null +++ b/.github/workflows/register.yml @@ -0,0 +1,16 @@ +name: Register Package +on: + workflow_dispatch: + inputs: + version: + description: Version to register or component to bump + required: true +jobs: + register: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: julia-actions/RegisterAction@latest + with: + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/Project.toml b/Project.toml index df9e75a..c8ab13f 100644 --- a/Project.toml +++ b/Project.toml @@ -16,9 +16,19 @@ Gtk4 = "9db2cae5-386f-4011-9d63-a5602296539b" SWPGtkExtension = ["Gtk4"] [compat] -Bibliography = "0.2" +Bibliography = "0.3" DataStructures = "0.18" FTPClient = "1" GitHub = "5" Gtk4 = "0.3" -julia = "1.9" +julia = "1.10" + +[extras] +Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" +ExplicitImports = "7d51a73a-1435-4ff3-83d9-f097790105c7" +JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" +Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" +TestItemRunner = "f8b46487-2199-4994-9208-9a1283c18c0a" + +[targets] +test = ["Aqua", "ExplicitImports", "JET", "Test", "TestItemRunner"] diff --git a/README.md b/README.md index 413199f..26bce48 100644 --- a/README.md +++ b/README.md @@ -151,7 +151,7 @@ The only available theme for the moment is using Zurb foundation responsive fron ### Items -Items are guaranteed to be compatible with the main theme (and hopefully new ones will be too). +Items are guaranteed to be compatible with the main theme (and hopefully new ones will be too). ##### `Publications` : a bibliography based on a bibliography file (uses [Bibliography.jl]((https://github.com/Humans-of-Julia/Bibliography.jl))) @@ -221,7 +221,7 @@ gitrepo = GitRepo( # currently work only with GitHub Please note that GitHub will restrict unidentified requests to a certain amount per IP within a time limit (that I don't know the value). If it happens, a message error from GitHub API will be returned. -To circumvent this issue, you can uncomment the line `local_info["auth_tokens"] = "PATH/TO/token.jl'` in `run.jl` (or add it if necessary) **and** edit the `token.jl` by updating your Personnal [Access Token](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token). +To circumvent this issue, you can uncomment the line `local_info["auth_tokens"] = "PATH/TO/token.jl'` in `run.jl` (or add it if necessary) **and** edit the `token.jl` by updating your Personal [Access Token](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token). `token.jl` aims to store all authentication tokens (for now, just GitHub). It content must be as follow (it is a simple variable containing your PAT): ```julia @@ -229,10 +229,10 @@ To circumvent this issue, you can uncomment the line `local_info["auth_tokens"] # YOUR TOKENS SHOULD NEVER BE SHARED! IF YOU USE GIT, DON'T FORGET TO ADD `token.jl` TO YOUR `.gitignore` FILE! # YOU CAN ALSO STORE `token.jl` OUTSIDE OF THE STATICWEBPAGES FOLDER! -github_pat = "YOUR_PERSONAL_ACCESS_TOKEN" +github_pat = "YOUR_PERSONAL_ACCESS_TOKEN" ``` -If the token is not valid, a `401: Bad Creditential` error from GitHUb API will be returned. +If the token is not valid, a `401: Bad Creditential` error from GitHub API will be returned. As the comment states, take care not to push your token to your git repo! A good practice could be to store `token.jl` outside of your git project. @@ -242,7 +242,7 @@ As the comment states, take care not to push your token to your git repo! A good biography = Block( paragraphs( """ - Jean-François Baffier is an academic researcher at the RIKEN Center for Advanced Intelligence Project (AIP), and a consultant in Artificial Intelligence, Big Data Science, Data Structures, and Algorithms. As an academic, he gives back to society through fundamental research in computer science supplemented by open source libraries and softwares. + Jean-François Baffier is an academic researcher at the RIKEN Center for Advanced Intelligence Project (AIP), and a consultant in Artificial Intelligence, Big Data Science, Data Structures, and Algorithms. As an academic, he gives back to society through fundamental research in computer science supplemented by open source libraries and software. """, """ paragraph 2 @@ -266,7 +266,7 @@ research = Block( Principal Research Projects: Network Interdiction, Compressed Data Structures, Modern Academics, Explainable AI. Other research interest includes Graph Theory, Geometry, Optimization, and Games. """, """ - All of this research is supported by Open-Source Softwares and published as peer-review academic papers. + All of this research is supported by Open-Source Software and published as peer-review academic papers. """ ), images() @@ -388,7 +388,7 @@ email( ##### Link can be an internal or an external link ```julia -link("research project", "research.hmtl") # inner link +link("research project", "research.html") # inner link link("StaticWebPages.jl", "https://github.com/Humans-of-Julia/StaticWebPages.jl") ``` diff --git a/_typos.toml b/_typos.toml new file mode 100644 index 0000000..8223de7 --- /dev/null +++ b/_typos.toml @@ -0,0 +1,27 @@ +[default] +extend-ignore-re = [ + "iMatix" +] + +[files] +extend-exclude = ["*.css", "*.js"] + +[default.extend-words] +annote = "annote" +inbrace = "inbrace" +BA = "BA" +FO = "FO" +ND = "ND" + +[default.extend-identifiers] +"CC-BY-NC-ND-1.0" = "CC-BY-NC-ND-1.0" +"CC-BY-NC-ND-2.0" = "CC-BY-NC-ND-2.0" +"CC-BY-NC-ND-2.5" = "CC-BY-NC-ND-2.5" +"CC-BY-NC-ND-3.0" = "CC-BY-NC-ND-3.0" +"CC-BY-NC-ND-3.0-IGO" = "CC-BY-NC-ND-3.0-IGO" +"CC-BY-NC-ND-4.0" = "CC-BY-NC-ND-4.0" +"CC-BY-ND-1.0" = "CC-BY-ND-1.0" +"CC-BY-ND-2.0" = "CC-BY-ND-2.0" +"CC-BY-ND-2.5" = "CC-BY-ND-2.5" +"CC-BY-ND-3.0" = "CC-BY-ND-3.0" +"CC-BY-ND-4.0" = "CC-BY-ND-4.0" \ No newline at end of file diff --git a/docs/make.jl b/docs/make.jl index 078d23e..f54cbab 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -2,32 +2,33 @@ using StaticWebPages using Bibliography using Documenter -@info "Makeing documentation..." +@info "Making documentation..." makedocs(; - modules=[StaticWebPages, Bibliography], - authors="Jean-François Baffier", - repo="https://github.com/Humans-of-Julia/StaticWebPages.jl/blob/{commit}{path}#L{line}", - sitename="StaticWebPages.jl", - format=Documenter.HTML(; - prettyurls=get(ENV, "CI", "false") == "true", - canonical="https://Humans-of-Julia.github.io/StaticWebPages.jl", - assets = ["assets/favicon.ico"; "assets/github_buttons.js"; "assets/custom.css"], + modules = [StaticWebPages, Bibliography], + authors = "Jean-François Baffier", + repo = "https://github.com/Humans-of-Julia/StaticWebPages.jl/blob/{commit}{path}#L{line}", + sitename = "StaticWebPages.jl", + format = Documenter.HTML(; + prettyurls = get(ENV, "CI", "false") == "true", + canonical = "https://Humans-of-Julia.github.io/StaticWebPages.jl", + assets = ["assets/favicon.ico"; "assets/github_buttons.js"; "assets/custom.css"] ), - pages=[ + pages = [ "Home" => "index.md", "Components" => [ "Theming" => "themes.md", "Items" => "items.md", - "Pages" => "pages.md", + "Pages" => "pages.md" ], "Dependencies" => [ - "Bibliography.jl" => "bibliography.md", + "Bibliography.jl" => "bibliography.md" ], "Library" => [ "public.md", - "internal.md", - ], - ], + "internal.md" + ] + ] ) -deploydocs(; repo = "github.com/Humans-of-Julia/StaticWebPages.jl.git", devbranch = "master") +deploydocs(; + repo = "github.com/Humans-of-Julia/StaticWebPages.jl.git", devbranch = "master") diff --git a/docs/src/items.md b/docs/src/items.md index 9b1940d..6fe7bd6 100644 --- a/docs/src/items.md +++ b/docs/src/items.md @@ -1,8 +1,8 @@ # Items -Items are guaranteed to be compatible with the main theme (and hopefully new ones will be too). +Items are guaranteed to be compatible with the main theme (and hopefully new ones will be too). -##### `Publications` : a bibliography based on a bibliography file (uses [Bibliography.jl]((https://github.com/Humans-of-Julia/Bibliography.jl))) +##### `Publications` : a bibliography based on a bibliography file (uses [Bibliography.jl](https://github.com/Humans-of-Julia/Bibliography.jl)) ```julia # Simply provide a BibTeX file (usually .bib) @@ -70,7 +70,7 @@ gitrepo = GitRepo( # currently work only with GitHub Please note that GitHub will restrict unidentified requests to a certain amount per IP within a time limit (that I don't know the value). If it happens, a message error from GitHub API will be returned. -To circumvent this issue, you can uncomment the line `local_info["auth_tokens"] = "PATH/TO/token.jl'` in `run.jl` (or add it if necessary) **and** edit the `token.jl` by updating your Personnal [Access Token](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token). +To circumvent this issue, you can uncomment the line `local_info["auth_tokens"] = "PATH/TO/token.jl'` in `run.jl` (or add it if necessary) **and** edit the `token.jl` by updating your Personal [Access Token](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token). `token.jl` aims to store all authentication tokens (for now, just GitHub). It content must be as follow (it is a simple variable containing your PAT): ```julia @@ -78,7 +78,7 @@ To circumvent this issue, you can uncomment the line `local_info["auth_tokens"] # YOUR TOKENS SHOULD NEVER BE SHARED! IF YOU USE GIT, DON'T FORGET TO ADD `token.jl` TO YOUR `.gitignore` FILE! # YOU CAN ALSO STORE `token.jl` OUTSIDE OF THE STATICWEBPAGES FOLDER! -github_pat = "YOUR_PERSONAL_ACCESS_TOKEN" +github_pat = "YOUR_PERSONAL_ACCESS_TOKEN" ``` If the token is not valid, a `401: Bad Creditential` error from GitHUb API will be returned. @@ -91,7 +91,7 @@ As the comment states, take care not to push your token to your git repo! A good biography = Block( paragraphs( """ - Jean-François Baffier is an academic researcher at the RIKEN Center for Advanced Intelligence Project (AIP), and a consultant in Artificial Intelligence, Big Data Science, Data Structures, and Algorithms. As an academic, he gives back to society through fundamental research in computer science supplemented by open source libraries and softwares. + Jean-François Baffier is an academic researcher at the RIKEN Center for Advanced Intelligence Project (AIP), and a consultant in Artificial Intelligence, Big Data Science, Data Structures, and Algorithms. As an academic, he gives back to society through fundamental research in computer science supplemented by open source libraries and software. """, """ paragraph 2 @@ -115,7 +115,7 @@ research = Block( Principal Research Projects: Network Interdiction, Compressed Data Structures, Modern Academics, Explainable AI. Other research interest includes Graph Theory, Geometry, Optimization, and Games. """, """ - All of this research is supported by Open-Source Softwares and published as peer-review academic papers. + All of this research is supported by Open-Source Software and published as peer-review academic papers. """ ), images() @@ -171,6 +171,6 @@ email( ##### Link can be an internal or an external link ```julia -link("research project", "research.hmtl") # inner link +link("research project", "research.html") # inner link link("StaticWebPages.jl", "https://github.com/Humans-of-Julia/StaticWebPages.jl") ``` diff --git a/example/content.jl b/example/content.jl index 0fdf8eb..b84a4cd 100644 --- a/example/content.jl +++ b/example/content.jl @@ -1,5 +1,5 @@ ###################################### -# General informations +# General information ###################################### info["avatar"] = "pic.jpg" @@ -128,13 +128,13 @@ grants = TimeLine( biography = Block( paragraphs( """ - Jean-François Baffier is an academic researcher at the RIKEN Center for Advanced Intelligence Project (AIP), and a consultant in Artificial Intelligence, Big Data Science, Data Structures, and Algorithms. As an academic, he gives back to society through fundamental research in computer science supplemented by open source libraries and softwares. + Jean-François Baffier is an academic researcher at the RIKEN Center for Advanced Intelligence Project (AIP), and a consultant in Artificial Intelligence, Big Data Science, Data Structures, and Algorithms. As an academic, he gives back to society through fundamental research in computer science supplemented by open source libraries and software. """, """ Jean-François graduated Master course at University Paris-Sud and got his Ph.D. from the University of Tokyo. He was a member of the ERATO Kawarabayashi Large Project in Tokyo and Sendai, and a JSPS-CNRS research fellow hosted at the Tokyo Institute of Technology (Japan). He also was a JFLI member from October 2011 to August 2018. """, """ - His current $(link("research project", "research.hmtl")) involves the study of the “Analysis of information networks,” the “Smart compression for high-scalability of data structures,” and “Explainable Artificial Intelligence.” Other topic of interest covers modeling of failures and routing in Networks, Game Analysis, and AI for Games. + His current $(link("research project", "research.html")) involves the study of the “Analysis of information networks,” the “Smart compression for high-scalability of data structures,” and “Explainable Artificial Intelligence.” Other topic of interest covers modeling of failures and routing in Networks, Game Analysis, and AI for Games. """, """ Jean-François implemented the StaticWebPages.jl package that was used to generate this website using a simple content file. This is a dummy email: $(email("dummy@example.purpose")) @@ -147,25 +147,25 @@ biography = Block( ) page( - title="index", - sections=[ + title = "index", + sections = [ Section( - title="Biography", - items=biography + title = "Biography", + items = biography ), Double( Section( - title="Positions", - items=work_cards + title = "Positions", + items = work_cards ), Section( - title="Education", - items=education_cards + title = "Education", + items = education_cards ) ), Section( - title="Grants", - items=grants + title = "Grants", + items = grants ) ] ) @@ -175,13 +175,13 @@ page( # option 1: background for the page is set to start with white to emphasize the items ###################################### page( - title="publications", - background=bg_white, - sections=[ + title = "publications", + background = bg_white, + sections = [ Section( - title="Publications", - items=Publications("publications.bib") - ) + title = "Publications", + items = Publications("publications.bib") + ) ] ) @@ -192,10 +192,10 @@ page( topics = Block( paragraphs( """ - Principal Research Projects: Network Interdiction, Compressed Data Sructures, Modern Academics, Explainable AI. Other research interest includes Graph Theory, Geometry, Optimization, and Games. + Principal Research Projects: Network Interdiction, Compressed Data Structures, Modern Academics, Explainable AI. Other research interest includes Graph Theory, Geometry, Optimization, and Games. """, """ - All of this research is supported by Open-Source Softwares and published as peer-review academic papers. + All of this research is supported by Open-Source Software and published as peer-review academic papers. """ ), images() @@ -238,7 +238,7 @@ modernac = Block( context """, """ - resutls + results """ ), images( @@ -252,35 +252,35 @@ explainable = Block( context """, """ - resutls + results """ ), images() ) page( - title="research", - sections=[ + title = "research", + sections = [ Section( - title="Research topics", - items=topics + title = "Research topics", + items = topics ), Section( - title="Network Interdiction", - items=interdiction + title = "Network Interdiction", + items = interdiction ), Section( - title="Compressed Data Sructures", - items=structure + title = "Compressed Data Structures", + items = structure ), Section( - title="Modern Academics", - items=modernac + title = "Modern Academics", + items = modernac ), Section( - title="Explainable Artificial Intelligence", - items=explainable - ),] + title = "Explainable Artificial Intelligence", + items = explainable + )] ) ###################################### @@ -301,14 +301,14 @@ github = GitRepo( ) page( - title="software", - background=bg_white, - sections=[ + title = "software", + background = bg_white, + sections = [ Section( - title="Software", - hide=true, - items=github, - ) + title = "Software", + hide = true, + items = github + ) ] ) diff --git a/example/run.jl b/example/run.jl index 352ee8f..75915a4 100644 --- a/example/run.jl +++ b/example/run.jl @@ -18,7 +18,7 @@ local_info["server"] = "server_address" # `rm_dir = true` will clean up the site folder before generating it again. Default to false. # `opt_in = true` will a link to this generator website in the side menu. Default to false. -StaticWebPages.export_site(d=local_info, rm_dir = true, opt_in = true) +StaticWebPages.export_site(d = local_info, rm_dir = true, opt_in = true) ## upload website (comment/delete if not needed) # unfortunately does not work yet on windows system, please sync manually for the moment diff --git a/example/token.jl b/example/token.jl index a754c12..92ee6c1 100644 --- a/example/token.jl +++ b/example/token.jl @@ -2,4 +2,4 @@ # YOUR TOKENS SHOULD NEVER BE SHARED! IF YOU USE GIT, DON'T FORGET TO ADD `token.jl` TO YOUR `.gitignore` FILE! # YOU CAN ALSO STORE `token.jl` OUTSIDE OF THE STATICWEBPAGES FOLDER! -github_pat = "YOUR_PERSONAL_ACCESS_TOKEN" +github_pat = "YOUR_PERSONAL_ACCESS_TOKEN" diff --git a/ext/SWPGtkExt.jl b/ext/SWPGtkExt.jl index 20e2bbf..0a17f33 100644 --- a/ext/SWPGtkExt.jl +++ b/ext/SWPGtkExt.jl @@ -31,7 +31,8 @@ end set_subtitle!(widget, str) = set_gtk_property!(widget, :subtitle, str) function choose_project_folder(win) - dir = open_dialog("Select content.jl folder", win, action=GtkFileChooserAction.SELECT_FOLDER) + dir = open_dialog( + "Select content.jl folder", win, action = GtkFileChooserAction.SELECT_FOLDER) if isdir(dir) set_subtitle!(header, "$(pwd())") end @@ -51,7 +52,7 @@ end function ui() # ts = GtkTreeStore(String) - # info = GtkTreeStore.append(ts, Dict(:text => "Informations")) + # info = GtkTreeStore.append(ts, Dict(:text => "Information")) # tv = populate_tree_view(content) # # Update the path to your Glade file diff --git a/src/StaticWebPages.jl b/src/StaticWebPages.jl index 8240713..568e85d 100644 --- a/src/StaticWebPages.jl +++ b/src/StaticWebPages.jl @@ -1,8 +1,8 @@ module StaticWebPages -using DataStructures -using FTPClient -using GitHub +import DataStructures: OrderedDict +import FTPClient: FTP +import GitHub: Repo import Base.show @@ -23,8 +23,6 @@ export GitRepo export TimeLine export TimeLineColor -export ui - function load_example() include(joinpath(@__DIR__, "..", "example", "content.jl")) end diff --git a/src/constant.jl b/src/constant.jl index 43aeb07..f98e2a7 100644 --- a/src/constant.jl +++ b/src/constant.jl @@ -95,7 +95,7 @@ end A dictionary to translate the enumeration in ColorLabel to actual HTML/CSS labels. An optional `black-text` color for text is given (it defaults to white-text). """ -const color_to_label = Dict{ColorLabel,String}([ +const color_to_label = Dict{ColorLabel, String}([ red => "label-red", green => "label-green", yellow => "label-yellow black-text", @@ -117,10 +117,9 @@ const color_to_label = Dict{ColorLabel,String}([ navy => "label-navy", grey => "label-grey", white => "label-white black-text", - black => "label-black", + black => "label-black" ]) - """ CardColor @@ -150,7 +149,7 @@ end A dictionary to translate the enumeration in CardColor to actual HTML/CSS attributes. A card can be composed of either one or two colors. """ -const color_to_card = Dict{CardColor,Tuple{String,String}}([ +const color_to_card = Dict{CardColor, Tuple{String, String}}([ card_blue => ("blue-first", "blue-second"), card_green => ("green-first", "green-second"), card_red => ("red-first", "red-second"), @@ -158,7 +157,7 @@ const color_to_card = Dict{CardColor,Tuple{String,String}}([ card_julia_blue => ("julia-blue", "julia-blue"), card_julia_green => ("julia-green", "julia-green"), card_julia_purple => ("julia-purple", "julia-purple"), - card_julia_red => ("julia-red", "julia-red"), + card_julia_red => ("julia-red", "julia-red") ]) """ @@ -192,7 +191,7 @@ end A dictionary to translate the enumeration in `TimeLineColor` to actual HTML/CSS attributes. """ -const color_to_timeline = Dict{TimeLineColor,Tuple{String,String}}([ +const color_to_timeline = Dict{TimeLineColor, Tuple{String, String}}([ tl_blue => ("tl-blue-bg", "tl-blue-border"), tl_green => ("tl-green-bg", "tl-green-border"), tl_red => ("tl-red-bg", "tl-red-border"), @@ -200,7 +199,7 @@ const color_to_timeline = Dict{TimeLineColor,Tuple{String,String}}([ tl_julia_blue => ("julia-blue", "julia-blue-border"), tl_julia_green => ("julia-green", "julia-green-border"), tl_julia_purple => ("julia-purple", "julia-purple-border"), - tl_julia_red => ("julia-red", "julia-red-border"), + tl_julia_red => ("julia-red", "julia-red-border") ]) """ @@ -208,14 +207,14 @@ const color_to_timeline = Dict{TimeLineColor,Tuple{String,String}}([ A dictionary that tracks the HTML/CSS attributes for icons from font-awesome. """ -const academicons = Dict{String,String}([ +const academicons = Dict{String, String}([ "researchgate" => "ai ai-researchgate-square", "googlescholar" => "ai ai-google-scholar-square", "orcid" => "ai ai-orcid-square", "dblp" => "ai ai-dblp-square", "github" => "fa fa-github-square", "linkedin" => "fab fa-linkedin", - "twitter" => "fa fa-twitter-square", + "twitter" => "fa fa-twitter-square" ]) """ @@ -223,7 +222,7 @@ const academicons = Dict{String,String}([ A dictionary, with default values, used to customize personal information. """ -const info = Dict{String,String}([ +const info = Dict{String, String}([ "title" => "title", "avatar" => "pic.jpg", "name" => "name", "lang" => "en" ]) @@ -232,14 +231,14 @@ const info = Dict{String,String}([ An ordered dictionary to store the different web pages. """ -const content = OrderedDict{String,Any}() +const content = OrderedDict{String, Any}() """ local_info A dictionary that stores local information required to build and export the website. """ -const local_info = Dict{String,String}() +const local_info = Dict{String, String}() """ user_to_name @@ -248,11 +247,11 @@ A dictionary to translate user id (such as GitHub id) to real name. Normal use i When a list of id is too long, priority is given to the id with an associated name. """ -const user_to_name = Dict{String,String}() +const user_to_name = Dict{String, String}() """ publication_labels An ordered dictionary to store the attributions of labels to keywords in a `Publications`. """ -const publication_labels = OrderedDict{String,ColorLabel}() +const publication_labels = OrderedDict{String, ColorLabel}() diff --git a/src/inline.jl b/src/inline.jl index 50ff6c4..29336b1 100644 --- a/src/inline.jl +++ b/src/inline.jl @@ -49,6 +49,6 @@ function email(e::Email) end end -function email(address::String; content::String="contact", obfuscated::Bool=true) +function email(address::String; content::String = "contact", obfuscated::Bool = true) return email(Email(address, content, obfuscated)) end diff --git a/src/io.jl b/src/io.jl index 7fcff94..28c62e0 100644 --- a/src/io.jl +++ b/src/io.jl @@ -7,7 +7,7 @@ If `rm_dir` is `true`, the `site` folder will be deleted before the website is g Users can choose to support `StaticWebPages.jl` by setting `opt_in` to `true`. This will add a small banner in the side navigation menu stating "This website was generated using StaticWebPages.jl" and links to the GitHub repository. """ function export_site(; - d::Dict{String,String}=local_info, rm_dir::Bool=false, opt_in::Bool=false + d::Dict{String, String} = local_info, rm_dir::Bool = false, opt_in::Bool = false ) # Loading github pat ; optional if no file is provided ; github_pat variable existence is check in git.jl @@ -17,26 +17,26 @@ function export_site(; @info "\nStaticWebPages.jl's generator is starting ...\n" if rm_dir - rm(d["site"]; recursive=true, force=true) + rm(d["site"]; recursive = true, force = true) mkpath(d["site"]) end for p in [ joinpath(d["site"], "files"), joinpath(d["site"], "img"), joinpath(d["site"], "js"), - joinpath(d["site"], "css"), + joinpath(d["site"], "css") ] !isdir(p) && mkpath(p) end - assets = joinpath(dirname(dirname(pathof(StaticWebPages))), "assets") + assets = joinpath(dirname(dirname(something(pathof(StaticWebPages), ""))), "assets") for p in ["js", "css"] - cp(joinpath(assets, p), joinpath(d["site"], p); force=true) + cp(joinpath(assets, p), joinpath(d["site"], p); force = true) end for p in ["files", "img"] str = joinpath(d["content"], p) - isdir(str) && cp(str, joinpath(d["site"], p); force=true) + isdir(str) && cp(str, joinpath(d["site"], p); force = true) end include(joinpath(d["content"], "content.jl")) @@ -57,7 +57,7 @@ end Will upload the generated website according to the info in `d`. """ -function upload_site(d::Dict{String,String}=local_info) +function upload_site(d::Dict{String, String} = local_info) protocol = d["protocol"] user = d["user"] password = d["password"] @@ -70,16 +70,16 @@ function upload_site(d::Dict{String,String}=local_info) for (root, dirs, files) in walkdir(".") for dir in dirs try - mkdir(ftp, replace(joinpath(root, dir), "\\" => "/")) + FTP.mkdir(ftp, replace(joinpath(root, dir), "\\" => "/")) catch e end end for file in files str = replace(joinpath(root, file), "\\" => "/") println("root:$root, joinpath:$str, file:$file") - upload(ftp, str, str) + FTP.upload(ftp, str, str) end end cd(temppath) - return close(ftp) + return FTP.close(ftp) end diff --git a/src/items.jl b/src/items.jl index 8f0bffa..bc4e524 100644 --- a/src/items.jl +++ b/src/items.jl @@ -18,8 +18,7 @@ include("items/publications.jl") include("items/block.jl") include("items/timeline.jl") -Item = Union{Deck,GitRepo,Publications,Block,TimeLine} - +Item = Union{Deck, GitRepo, Publications, Block, TimeLine} """ to_html(args...) @@ -38,7 +37,7 @@ struct Nest Nest(args...) = new([item for item in args]) end -SectionItems = Union{Item,Nest} +SectionItems = Union{Item, Nest} function to_html(nest::Nest) str = "" @@ -75,11 +74,11 @@ Create a new single column section. ) """ function Section(; - bgcolor::BackgroundColor=bg_none, - hide::Bool=false, - items::SectionItems=Nest(), - title::String="", - title_size=0 + bgcolor::BackgroundColor = bg_none, + hide::Bool = false, + items::SectionItems = Nest(), + title::String = "", + title_size = 0 ) return Section(bgcolor, hide, items, title, title_size) end diff --git a/src/items/block.jl b/src/items/block.jl index 1b80a54..9bdf6f5 100644 --- a/src/items/block.jl +++ b/src/items/block.jl @@ -1,4 +1,4 @@ -Image = Pair{AbstractString,AbstractString} +Image = Pair{AbstractString, AbstractString} """ paragraphs(args::String...) @@ -46,8 +46,8 @@ Construct a `Block` with paragraphs and an iframe. Block(paragraphs, iframe::String) = Block(paragraphs, Vector{Image}(), iframe) function to_html(section::Block) - full = - eltype(section.images) <: Union && isempty(section.iframe) ? "" : "medium-8 large-9" + full = eltype(section.images) <: Union && isempty(section.iframe) ? "" : + "medium-8 large-9" str = """