Skip to content

style: format code with Prettier and StandardJS #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,26 @@
Thank you for your interest in contributing to CC Open Source! This document is
a set of guidelines to help you contribute to this project.


## Code of Conduct

By participating in this project, you are expected to uphold our [Code of
Conduct][code_of_conduct].

[code_of_conduct]: https://opensource.creativecommons.org/community/code-of-conduct/


## Project Documentation

The `README` in the root of the repository should contain or link to project
documentation. If you cannot find the documentation you're looking for, please
file a GitHub issue with details of what you'd like to see documented.


## How to Contribute

Please follow the processes in our general [Contributing Code][contributing]
guidelines on the Creative Common Open Source website.

[contributing]: https://opensource.creativecommons.org/contributing-code/


## Questions or Thoughts?

Talk to us on [one of our community forums][community].
Expand Down
81 changes: 35 additions & 46 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@

Source for `creativecommons.github.io`


## Overview

> **:warning: DO *NOT* MAKE CHANGES TO THE
> **:warning: DO _NOT_ MAKE CHANGES TO THE
> [creativecommons/creativecommons.github.io][ccghiorepo] REPO DIRECTLY**.

[ccghiorepo]: https://github.com/creativecommons/creativecommons.github.io
Expand All @@ -19,10 +18,10 @@ via lektor (see [Deployment](#deployment), below).
[ccgithubio]: https://creativecommons.github.io/
[ccopensource]: https://opensource.creativecommons.org/


## Code of Conduct

[`CODE_OF_CONDUCT.md`](CODE_OF_CONDUCT.md):

> The Creative Commons team is committed to fostering a welcoming community.
> This project and all other Creative Commons open source projects are governed
> by our [Code of Conduct][code_of_conduct]. Please report unacceptable
Expand All @@ -32,7 +31,6 @@ via lektor (see [Deployment](#deployment), below).
[code_of_conduct]: https://opensource.creativecommons.org/community/code-of-conduct/ "CC Open Source Code of Conduct — Creative Commons on GitHub"
[reporting_guide]: https://opensource.creativecommons.org/community/code-of-conduct/enforcement/ "Codes of Conduct Enforcement — Creative Commons on GitHub"


## Contributing

- See [`CONTRIBUTING.md`](CONTRIBUTING.md) for information on how to contribute
Expand All @@ -42,34 +40,35 @@ via lektor (see [Deployment](#deployment), below).

[contributors]: https://github.com/creativecommons/creativecommons.github.io-source/graphs/contributors "Contributors to creativecommons/creativecommons.github.io-source"


## Installation

### Prerequisites

Make sure you have:

- [pipenv][pipenvdocs]
- [Node.js][nodejswebsite] **v12+** and [npm][npmdocs] installed.

To install these, execute the following commands:

- macOS:
1. Install [Homebrew][homebrew]
1. Install pipenv and node:
```
brew install pipenv node
```
```
brew install pipenv node
```
- GNU/Linux:
1. [Installing Pipenv][pipenvinstall]
2. [Install Node.js][nodeinstall] (or see the
[detailed instructions][nodedetailed])
3. Upate packges:
```
sudo apt update
```
```
sudo apt update
```
4. Install npm:
```
sudo apt install npm
```
```
sudo apt install npm
```

[pipenvdocs]: https://pipenv.pypa.io/en/latest/
[nodejswebsite]: https://nodejs.org/en/
Expand All @@ -79,53 +78,50 @@ To install these, execute the following commands:
[nodeinstall]: https://github.com/nodesource/distributions/blob/master/README.md#table-of-contents
[nodedetailed]: https://github.com/nodesource/distributions/blob/master/README.md#installation-instructions


### Installing Project Requirements

1. Clone this repository.
2. Open your command line interface change directories to the repository root
directory.
3. Create a Python virtual environment and install the requirements for this
project:
```
pipenv install --dev
```

```
pipenv install --dev
```

### pipenv Troubleshooting

`pipenv` doesn't always provide the best error messages ([Provide better error
message if the project’s virtual environment is broken][pipenverror]). If all
else fails, try removing the virtual environment and reinstalling:

1. Remove virtual environment:
```
pipenv --rm
```
```
pipenv --rm
```
2. Install virtual environment (including dev packages):
```
pipenv install --dev
```
```
pipenv install --dev
```

[pipenverror]: https://github.com/pypa/pipenv/issues/1918


## Development

- Start the Lektor development server:
```
pipenv run lektor server -f webpack
```
```
pipenv run lektor server -f webpack
```
- You will be able to see the website at [`127.0.0.1:5000/`][local5000].
- The Lektor server will rebuild the site every time you change any content.

[local5000]: http://127.0.0.1:5000/


### Troubleshooting Possible Errors

- Should you get series of type errors that looks something like `npm ERR!
typeerror Error: Missing required argument #1`, after running `pipenv run
lektor server -f webpack`, this is most likely due to running an older
typeerror Error: Missing required argument #1`, after running `pipenv run
lektor server -f webpack`, this is most likely due to running an older
version of Node.js.

As stated above in [Prerequisites](#prerequisites), you should be running
Expand All @@ -137,19 +133,19 @@ else fails, try removing the virtual environment and reinstalling:
files.

The solution is to run:
```
sudo sysctl fs.inotify.max_user_watches=524288
```

```
sudo sysctl fs.inotify.max_user_watches=524288
```

This increases your `inotify` watch limit (for the session) to 524288, which
is the maximum value and is also enough to allow the setup go through. You
is the maximum value and is also enough to allow the setup go through. You
can learn more about file watchers [from this blog post][inotifyblog]
or [from the VS Code documentation][watchchanges].

[inotifyblog]: https://unixia.wordpress.com/2018/04/28/inotify-watch-limit-reached-wait-what/
[watchchanges]: https://code.visualstudio.com/docs/setup/linux#_visual-studio-code-is-unable-to-watch-for-file-changes-in-this-large-workspace-error-enospc


## Deployment

We have continuous deployment set up. To deploy, push your code to the `main`
Expand All @@ -162,7 +158,6 @@ The GitHub Actions configuration is located at

[lektorbuild]: .github/workflows/lektor-build-deploy.yml


### Manual Deployment

> :warning: **For reference only, you should not need to not do this.**
Expand All @@ -172,10 +167,10 @@ When you are ready to deploy a new version of the site, run `lektor deploy`
the [creativecommons/creativecommons.github.io][ccghiorepo] repository). That's
it, it's live on production!


## Project Structure

Here's how the code is structured in the top level of the repository:

- **`assets`**: This directory contains the JavaScript and CSS files for the
project built via webpack. Most of the JavaScript and CSS is third-party code
and loaded via CDN so this is pretty empty.
Expand All @@ -197,7 +192,6 @@ Here's how the code is structured in the top level of the repository:
[jinja2]: http://jinja.pocoo.org/
[lektortemplate]: https://www.getlektor.com/docs/templates/


### Lektor Plugins

- [Lektor Plugins][plugins]:
Expand Down Expand Up @@ -227,7 +221,6 @@ Here's how the code is structured in the top level of the repository:
[striphtml]: https://github.com/terminal-labs/lektor-strip-html-tags
[webpacksupport]: https://github.com/lektor/lektor-webpack-support


## Redirects

- `/cc-vocabulary/` to https://cc-vocabulary.netlify.com/
Expand All @@ -240,10 +233,10 @@ Here's how the code is structured in the top level of the repository:
- Added so that the `opensource.creativecommons.org/cc-fonts/` will
continue to work with that project moving to utilize Netlify.


## External Data

The following load external data:

- [`webpack/js/components.js`](webpack/js/components.js)
- [`creativecommons/ccos-scripts/main/ccos/norm/labels.yml`][labels-yml]
- [`creativecommons/ccos-scripts/main/ccos/norm/skills.yml`][skills-yml]
Expand All @@ -255,17 +248,14 @@ The following load external data:
[gh-creativecommons]: https://github.com/creativecommons/
[octokit]: https://www.npmjs.com/package/octokit


## License


### Code

- [`LICENSE`](LICENSE) (Expat/[MIT][mit] License)

[mit]: http://www.opensource.org/licenses/MIT "The MIT License | Open Source Initiative"


### Content

![CC BY 4.0 license button][cc-by-png]
Expand All @@ -277,7 +267,6 @@ specified.
[cc-by-png]: https://licensebuttons.net/l/by/4.0/88x31.png "CC BY 4.0 license button"
[cc-by]: https://creativecommons.org/licenses/by/4.0/ "Creative Commons — Attribution-ShareAlike 4.0 International — CC BY 4.0"


### Font Awesome

This repository contains PNG icons that were converted from Font Awesome SVGs:
Expand Down
1 change: 1 addition & 0 deletions packages/markdown-table/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ This plugin adds styling to markdown tables, by adding bootstrap classes. Stylin
table = 'table table-striped'
thead = 'thead-dark'
```

Unless specified, the default styles `table table-striped` and `thead-dark` are applied.
15 changes: 7 additions & 8 deletions themes/vocabulary_theme/templates/404.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
{% extends "layout.html" %}
{% block body %}
<div class="container padding-vertical-xxl has-text-centered">
<h1>404</h1>
<h2>Page Not Found!</h2>
<p class="body-big">Sorry. The page you are looking for doesn't exist.</p>
<a class="button is-success margin-vertical-big" href="/">Return Home</a>
</div>
{% extends "layout.html" %} {% block body %}
<div class="container padding-vertical-xxl has-text-centered">
<h1>404</h1>
<h2>Page Not Found!</h2>
<p class="body-big">Sorry. The page you are looking for doesn't exist.</p>
<a class="button is-success margin-vertical-big" href="/">Return Home</a>
</div>
<!-- Creative commons -->
{% endblock %}
28 changes: 14 additions & 14 deletions themes/vocabulary_theme/templates/author.html
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
{% extends "layout.html" %}

{% from "macros/author_posts.html" import render_author_posts %}
{% from "macros/author_name.html" import render_author_name %}

{% block title %}{{ render_author_name(this) }}{% endblock %}

{% block body %}
{% extends "layout.html" %} {% from "macros/author_posts.html" import
render_author_posts %} {% from "macros/author_name.html" import
render_author_name %} {% block title %}{{ render_author_name(this) }}{% endblock
%} {% block body %}
<div class="author-posts">
<div class="header">
<div class="container">
<div class="columns">
<div class="column is-one-quarter-tablet-only is-2-desktop">
<figure class="image profile">
<img class="profile" src="https://secure.gravatar.com/avatar/{{ this.md5_hashed_email }}?size=200&d=mp" alt="gravatar">
<img
class="profile"
src="https://secure.gravatar.com/avatar/{{ this.md5_hashed_email }}?size=200&d=mp"
alt="gravatar"
/>
</figure>
</div>
<div class="column content is-8">
<h2>{{ render_author_name(this) }}</h2>
{% if this.about %}
<div class="about">{{ this.about }}</div>
<div class="about">{{ this.about }}</div>
{% endif %}
<a class="button small" href="{{ this.parent|url }}">See all authors</a>
<a class="button small" href="{{ this.parent|url }}"
>See all authors</a
>
</div>
</div>
</div>
</div>
<div class="posts container">
{{ render_author_posts(this.children) }}
</div>
<div class="posts container">{{ render_author_posts(this.children) }}</div>
</div>
{% endblock %}
27 changes: 11 additions & 16 deletions themes/vocabulary_theme/templates/authors.html
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
{% extends "layout.html" %}

{% from "macros/authors.html" import render_authors %}

{% block title %} Authors {% endblock %}

{% block body %}
<div class="all-authors">
<div class="header">
<h1 class="container">Authors</h1>
</div>
<div class="authors-list">
<div class="container">
<div class="columns is-multiline is-mobile">
{{ render_authors(this) }}
</div>
{% extends "layout.html" %} {% from "macros/authors.html" import render_authors
%} {% block title %} Authors {% endblock %} {% block body %}
<div class="all-authors">
<div class="header">
<h1 class="container">Authors</h1>
</div>
<div class="authors-list">
<div class="container">
<div class="columns is-multiline is-mobile">
{{ render_authors(this) }}
</div>
</div>
</div>
</div>
{% endblock %}
Loading