1
0
mirror of synced 2026-01-29 12:00:58 -05:00

Merge pull request #7397 from github/repo-sync

repo sync
This commit is contained in:
Octomerger Bot
2021-06-16 03:42:10 +10:00
committed by GitHub
13 changed files with 3851 additions and 3829 deletions

View File

@@ -14,8 +14,8 @@ export const LandingSection = ({ title, children, className, sectionLink, descri
return (
<div className={cx('container-xl px-3 px-md-6', className)} id={sectionLink}>
{title && (
<h2 className={cx('font-mktg', !description ? 'mb-3' : 'mb-4')}>
{sectionLink ? <a href={`#${sectionLink}`}>{title}</a> : title}
<h2 className={cx('font-mktg h1 color-text-primary', !description ? 'mb-3' : 'mb-4')}>
{sectionLink ? <a className="color-unset" href={`#${sectionLink}`}>{title}</a> : title}
</h2>
)}
{description && (

View File

@@ -34,7 +34,7 @@ const ArticleList = ({ treeNode }: { treeNode: ProductTreeNode }) => {
return (
<div className="col-12 col-lg-4 mb-6 height-full">
<h4 className="mb-3">
<Link href={treeNode.href}>{treeNode.renderedFullTitle}</Link>
<Link className="color-unset" href={treeNode.href}>{treeNode.renderedFullTitle}</Link>
</h4>
<ul className="list-style-none">

View File

@@ -37,7 +37,7 @@ export const ProductLanding = () => {
</LandingSection>
{productCodeExamples.length > 0 && (
<LandingSection title={t('code_examples')} className="my-6 pb-6">
<LandingSection title={t('code_examples')} sectionLink="code-examples" className="my-6 pb-6">
<CodeExamples />
</LandingSection>
)}
@@ -62,13 +62,13 @@ export const ProductLanding = () => {
{guideCards.length > 0 && (
<div className="color-bg-tertiary py-6">
<LandingSection title={t('guides')} className="my-6">
<LandingSection title={t('guides')} sectionLink="guides-2" className="my-6">
<GuideCards />
</LandingSection>
</div>
)}
<LandingSection sectionLink="all-docs" title={`All ${shortTitle} docs`} className="pt-9">
<LandingSection title={`All ${shortTitle} docs`} sectionLink="all-docs" className="pt-9">
<ProductArticlesList />
</LandingSection>
</DefaultLayout>

View File

@@ -56,7 +56,7 @@ While using the Service, under no circumstances will you:
Please see our [Community Guidelines](/github/site-policy/github-community-guidelines#what-is-not-allowed) for more details.
### 4. Spam and Inauthentic Activity on GitHub
## 4. Spam and Inauthentic Activity on GitHub
Automated excessive bulk activity and coordinated inauthentic activity, such as spamming, are prohibited on GitHub. Prohibited activities include:
* bulk distribution of promotions and advertising prohibited by GitHub terms and policies
* inauthentic interactions, such as fake accounts and automated inauthentic activity
@@ -65,10 +65,10 @@ Automated excessive bulk activity and coordinated inauthentic activity, such as
* using GitHub as a platform for propagating abuse on other platforms
* phishing or attempted phishing
### 5. Services Usage Limits
## 5. Services Usage Limits
You will not reproduce, duplicate, copy, sell, resell or exploit any portion of the Service, use of the Service, or access to the Service without our express written permission.
### 6. Information Usage Restrictions
## 6. Information Usage Restrictions
You may use information from our Service for the following reasons, regardless of whether the information was scraped, collected through our API, or obtained otherwise:
- Researchers may use public, non-personal information from the Service for research purposes, only if any publications resulting from that research are [open access](https://en.wikipedia.org/wiki/Open_access).
@@ -80,15 +80,15 @@ You may not use information from the Service (whether scraped, collected through
Your use of information from the Service must comply with the [GitHub Privacy Statement](/github/site-policy/github-privacy-statement).
### 7. Privacy
## 7. Privacy
Misuse of User Personal Information is prohibited.
Any person, entity, or service collecting data from the Service must comply with the [GitHub Privacy Statement](/articles/github-privacy-statement), particularly in regards to the collection of User Personal Information. If you collect any User Personal Information from the Service, you agree that you will only use that User Personal Information for the purpose for which that User has authorized it. You agree that you will reasonably secure any User Personal Information you have gathered from the Service, and you will respond promptly to complaints, removal requests, and "do not contact" requests from us or other users.
### 8. Excessive Bandwidth Use
## 8. Excessive Bandwidth Use
The Service's bandwidth limitations vary based on the features you use. If we determine your bandwidth usage to be significantly excessive in relation to other users of similar features, we reserve the right to suspend your Account, throttle your file hosting, or otherwise limit your activity until you can reduce your bandwidth consumption. We also reserve the right—after providing advance notice—to delete repositories that we determine to be placing undue strain on our infrastructure. For guidance on acceptable use of object storage in repositories, refer to "[What is my disk quota?](/github/managing-large-files/what-is-my-disk-quota)". For more details on specific features' bandwidth limitations, see the [GitHub Additional Product Terms](/github/site-policy/github-additional-product-terms).
### 9. Advertising on GitHub
## 9. Advertising on GitHub
**Short version:** *We do not generally prohibit use of GitHub for advertising. However, we expect our users to follow certain limitations, so GitHub does not become a spam haven. No one wants that.*
While we understand that you may want to promote your Content by posting supporters' names or logos in your Account, the primary focus of the Content posted in or through your Account to the Service should not be advertising or promotional marketing. This includes Content posted in or through Pages, Packages, repositories, and all other parts of the Service. You may include static images, links, and promotional text in the README documents or project description sections associated with your Account, but they must be related to the project you are hosting on GitHub. You may not advertise in other Users' Accounts, such as by posting monetized or excessive bulk content in issues.

View File

@@ -19,11 +19,10 @@ function getApplicableVersions (frontmatterVersions, filepath) {
let isNextVersionOnly = false
// where frontmatter is something like:
// free-pro-team: '*'
// enterprise-server: '>=2.19'
// enterprise-cloud: '*'
// private-instances: '*'
// ^ where each key corresponds to a plan
// fpt: '*'
// ghes: '>=2.19'
// ghae: '*'
// ^ where each key corresponds to a plan's short name (defined in lib/all-versions.js)
Object.entries(frontmatterVersions)
.forEach(([plan, planValue]) => {
// Special handling for frontmatter that evalues to the next GHES release number or a hardcoded `next`.
@@ -31,7 +30,7 @@ function getApplicableVersions (frontmatterVersions, filepath) {
// For each plan (e.g., enterprise-server), get matching versions from allVersions object
Object.values(allVersions)
.filter(relevantVersion => relevantVersion.plan === plan)
.filter(relevantVersion => relevantVersion.plan === plan || relevantVersion.shortName === plan)
.forEach(relevantVersion => {
// Use a dummy value of '1.0' for non-numbered versions like free-pro-team and github-ae
// This will evaluate to true against '*' but false against 'next', which is what we want.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -92,7 +92,7 @@ class Page {
}
// derive array of Permalink objects
this.permalinks = Permalink.derive(this.languageCode, this.relativePath, this.title, this.versions)
this.permalinks = Permalink.derive(this.languageCode, this.relativePath, this.title, this.applicableVersions)
if (this.relativePath.endsWith('index.md')) {
// get an array of linked items in product and category TOCs

View File

@@ -1,7 +1,6 @@
const assert = require('assert')
const path = require('path')
const patterns = require('./patterns')
const getApplicableVersions = require('./get-applicable-versions')
const allVersions = require('./all-versions')
const nonEnterpriseDefaultVersion = require('./non-enterprise-default-version')
const removeFPTFromPath = require('./remove-fpt-from-path')
@@ -23,11 +22,10 @@ class Permalink {
return this
}
static derive (languageCode, relativePath, title, frontmatterVersions) {
static derive (languageCode, relativePath, title, applicableVersions) {
assert(relativePath, 'relativePath is required')
assert(languageCode, 'languageCode is required')
const applicableVersions = getApplicableVersions(frontmatterVersions, path.join(languageCode, relativePath))
const permalinks = applicableVersions
// skip the Dotcom homepage here because a special homepage permalink is added below
.filter(pageVersion => !(pageVersion === nonEnterpriseDefaultVersion && relativePath === 'index.md'))

View File

@@ -1,3 +1,7 @@
.color-unset {
color: unset;
}
.line-break-anywhere {
line-break: anywhere;
}

6
tests/fixtures/short-versions.md vendored Normal file
View File

@@ -0,0 +1,6 @@
---
title: This is an article
versions:
fpt: '*'
ghes: '>3.0'
---

View File

@@ -501,6 +501,20 @@ describe('Page class', () => {
expect(page.versions['enterprise-server']).toBe('>=2.21')
})
test('pages that use short names in versions frontmatter', async () => {
const page = await Page.init({
relativePath: 'short-versions.md',
basePath: path.join(__dirname, '../fixtures'),
languageCode: 'en'
})
expect(page.versions.fpt).toBe('*')
expect(page.versions.ghes).toBe('>3.0')
expect(page.versions.ghae).toBeUndefined()
expect(page.applicableVersions.includes('free-pro-team@latest')).toBe(true)
expect(page.applicableVersions.includes(`enterprise-server@${latest}`)).toBe(true)
expect(page.applicableVersions.includes(`github-ae@latest`)).toBe(false)
})
test('index page', async () => {
const page = await Page.init({
relativePath: 'index.md',

View File

@@ -1,6 +1,7 @@
const Permalink = require('../../lib/permalink')
const enterpriseServerReleases = require('../../lib/enterprise-server-releases')
const nonEnterpriseDefaultVersion = require('../../lib/non-enterprise-default-version')
const getApplicableVersions = require('../../lib/get-applicable-versions')
// Permalink constructor requires: languageCode, pageVersion, relativePath, title
// Permalink.derive requires: languageCode, relativePath, title, versions (<- FM prop)
@@ -12,7 +13,7 @@ describe('Permalink class', () => {
'free-pro-team': '*',
'enterprise-server': '*'
}
const permalinks = Permalink.derive('en', 'index.md', 'Hello World', versions)
const permalinks = Permalink.derive('en', 'index.md', 'Hello World', getApplicableVersions(versions))
expect(permalinks.length).toBeGreaterThan(1)
const homepagePermalink = permalinks.find(permalink => permalink.pageVersion === 'homepage')
expect(homepagePermalink.href).toBe('/en')