Kotlin 语言中文站
Switch branches/tags
Nothing to show
Clone or download
Pull request Compare This branch is 1049 commits ahead of JetBrains:master.
hltj Merge branch 'master' of https://github.com/JetBrains/kotlin-web-site
# Conflicts (resolved):
#	templates/inc/nav/header-banner-nav.html
Latest commit ddf2594 Dec 13, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github 修订 PR 模板,避免生成不必要的引用记录 Nov 15, 2018
.idea Added 28 Kotlin talks and 6 UGs Jan 19, 2018
assets Merge branch 'master' of https://github.com/JetBrains/kotlin-web-site Nov 22, 2018
data 补充导航条翻译 Dec 12, 2018
external fix(kopy): drop unused file Dec 11, 2018
kotlin-features 修正不当意译 Sep 29, 2017
pages 修正哈希引用 Dec 12, 2018
pdf Merge branch 'master' of https://github.com/JetBrains/kotlin-web-site Nov 22, 2018
scripts Use Docker as dev environment Feb 12, 2018
src fix site Dec 12, 2018
static Merge branch 'master' of https://github.com/JetBrains/kotlin-web-site Dec 4, 2018
templates Merge branch 'master' of https://github.com/JetBrains/kotlin-web-site Dec 13, 2018
tests Move visual-regression tests dependencies to separate package Aug 11, 2017
.babelrc Migrate to webpack 3 Aug 16, 2017
.dockerignore Fix missing navigation & other fixes (JetBrains#1110) Sep 10, 2018
.env.sample Use Docker as dev environment Feb 12, 2018
.gitignore ignores for kotlin-for-py Dec 5, 2018
.npmrc Use webpack for asset building. Oct 26, 2016
.nvmrc Bump Node.js version in .nvmrc Aug 16, 2017
Dockerfile Add option DEBIAN_FRONTEND=noninteractive Feb 13, 2018
LICENSE Add missing license file Apr 28, 2017
README.md Typo Feb 12, 2018
build-assets.sh feat(scripts): additional scripts to start and simplify development Dec 5, 2018
build-devserver.sh fix(scripts): make sure error exit code is handled Dec 5, 2018
docker-compose.yml Use Docker as dev environment Feb 12, 2018
kotlin-website.py Merge branch 'master' of https://github.com/JetBrains/kotlin-web-site Dec 12, 2018
mysettings.py feat(404): add template Nov 1, 2018
package.json chore(pdf): update styles Dec 3, 2018
postcss.config.js Migrate to webpack 3 Aug 16, 2017
requirements.txt chore(deps): update flask version Sep 19, 2018
robots.txt 解禁搜索 Jan 26, 2017
wdio.conf.js JS-5532 Visual regression testing for Kotlin site Apr 12, 2017
webpack.config.js Use Docker as dev environment Feb 12, 2018
yarn.lock chore(pdf): update styles Dec 3, 2018

README.md

Kotlin website

Official project Slack

This is the source for the http://kotlinlang.org.

Installation

  1. You will need Docker to run site lifecycle tasks. Installation for macOS and Windows.
  2. If you want to develop frontend Yarn package manager is also needed (installation instructions). Don't forget to install frontend dependencies - yarn install.
  3. All specific app parameters stored in env-file. Copy sample file .env.sample and rename it to .env. Change variables values if needed.

How to run

  • All in one option (suitable for content authors/writers):
    • docker-compose up. It will build all stuff and create site on localhost:5000.
  • Developer has 2-step option:
    • docker-compose up website will run only site at localhost:5000.
    • yarn start will run webpack-dev-server on localhost:9000. This address should be used for development. All pages from origin server will be proxied.

Project structure & overview

Data

All data is stored in the *.yml files in folder _data:

  • _nav.yml site navigation and PDF building.
  • releases.yml info about releases.
  • videos.yml data for the Videos page. The content property is used to create categories. It contains a list of videos or other categories. Maximum tree depth level is 3.
  • events.yml event data.

Templates

Kotlinlang uses Jinja2 templates that can be found in templates folder. Note that all Markdown files are processed as Jinja templates before being converted to HTML. This allows you to use all Jinja power inside Markdown (for example, build urls with url_for function).

Page metadata

Every page can have an unlimited number of metadata fields. More information here. The most important of them are the page template (e.g. layout: reference) and its type (e.g. type: tutorial). category and title fields are added for future development.

Kotlin grammar reference

The Kotlin grammar reference (grammar.xml) is generated by the Kotlin grammar generator from the Kotlin grammar definition.

Writing content

Markup

kramdown with some additions (like GitHub fenced code blocks) is used as Markdown parser. See the complete syntax reference at the kramdown site.

Specifying page element attributes

With kramdown you can assign HTML attributes to page elements via {:%param%}. E.g.:

  • *important text*{:.important} - produces <em class="important">important text</em>
  • *important text*{:#id} - produces <em id="id">important text</em>

For block elements this instruction must be specified on the line following element definition:

This is a paragraph
{:.important}

This is a paragraph

More information about attributes can be found here.

Custom element styles

Inline elements

  • {:.keyword} highlights a keyword.
  • {:.error} highlights an error.
  • {:.warning} highlights a warning.

Tables

  • {:.wide} stretches a table to occupy the entire width of a page.
  • {:.zebra} interleaves table rows.

E.g.:

| Expression | Translated to |
|------------|---------------|
| `a++` | `a.inc()` + see below |
| `a--` | `a.dec()` + see below |
{:.wide.zebra}

Quotation blocks

They're used in a slightly other manner that they were originally designed for: as universal block container elements.

  • {:.note} highlights a note block.

E.g.:

> **`inc()/dec()` shouldn't mutate the receiver object**.
>
> By "changing the receiver" we mean `the receiver-variable`, not the receiver object.
{:.note}

Filing Bugs

We use YouTrack for bug reports and suggestions. Click here to report an issue.