-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Rebuild hyperlink #2382
Rebuild hyperlink #2382
Changes from 17 commits
b6fedfa
d0f9ed5
b70a775
958c136
fa437ea
63ae0bd
00e8fbc
a317676
12dccb7
de51fb0
42b9d84
adcd3bd
422e7fa
f400cd2
1c3ee46
fc4e876
b363414
bd227a8
ade9cb7
1a19c2d
071407e
73dec22
73779f7
43967dd
a8c6872
076dd73
2ef4cb9
4932f17
3ddaa42
2438e5b
710188c
972de53
ebede53
9e8fab8
42cb344
cabd893
5321534
7b20e07
21c589f
ab6f6c1
e48c836
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,14 @@ | ||
import React from 'react'; | ||
import TrimEnd from 'lodash/trimEnd'; | ||
import Url from 'url'; | ||
import './PageLinks.scss'; | ||
|
||
const baseURL = 'https://github.com/webpack/webpack.js.org/edit/master/'; | ||
|
||
export default ({ | ||
page = {}, | ||
...props | ||
}) => { | ||
let baseURL = 'https://github.com/webpack/webpack.js.org/edit/master/src/content'; | ||
let indexPath = page.type === 'index' ? '/index' : ''; | ||
let mainPath = page.url.startsWith('/') ? page.url : `/${page.url}`; | ||
let editLink = page.edit || baseURL + TrimEnd(mainPath, '/') + indexPath + '.md'; | ||
const editLink = page.edit || Url.resolve(baseURL, page.path); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice! |
||
|
||
// TODO: Make sure we add `repo` / `edit` and address `type` (above) | ||
return ( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,8 @@ import Footer from '../Footer/Footer'; | |
import Page from '../Page/Page'; | ||
import Gitter from '../Gitter/Gitter'; | ||
import Vote from '../Vote/Vote'; | ||
import Organization from '../Organization/Organization'; | ||
import StarterKits from '../StarterKits/StarterKits'; | ||
|
||
// Load Styling | ||
import '../../styles/index'; | ||
|
@@ -69,6 +71,9 @@ class Site extends React.Component { | |
render={props => ( | ||
<Container className="site__content"> | ||
<Switch> | ||
<Route path="/vote" component={Vote} /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you! |
||
<Route path="/organization" component={Organization} /> | ||
<Route path="/starter-kits" component={StarterKits} /> | ||
{pages.map(page => ( | ||
<Route | ||
key={page.url} | ||
|
@@ -97,7 +102,6 @@ class Site extends React.Component { | |
}} | ||
/> | ||
))} | ||
<Route path="/vote" component={Vote} /> | ||
<Route render={props => '404 Not Found'} /> | ||
</Switch> | ||
</Container> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,7 +63,7 @@ module.exports = { | |
//... | ||
output: { | ||
path: '/home/proj/cdn/assets/[hash]', | ||
publicPath: 'http://cdn.example.com/assets/[hash]/' | ||
publicPath: 'https://cdn.example.com/assets/[hash]/' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this change tho 🌝 |
||
} | ||
}; | ||
``` | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -93,6 +93,6 @@ Use a different service URL in production/development builds: | |
|
||
```javascript | ||
new webpack.DefinePlugin({ | ||
'SERVICE_URL': JSON.stringify('http://dev.example.com') | ||
'SERVICE_URL': JSON.stringify('https://dev.example.com') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This one seems unnecessary. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unnecessary, but showing a good example imo There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah |
||
}); | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,7 @@ if (isClient) { | |
let { pathname } = window.location; | ||
let trimmed = pathname.replace(/(.+)\/$/, '$1'); | ||
let entryPage = findInContent(Content, item => item.url === trimmed); | ||
let entryPath = entryPage.path.replace('src/content/', ''); | ||
let entryPath = entryPage && entryPage.path.replace('src/content/', ''); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why this change? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Correct |
||
|
||
import(`./content/${entryPath}`).then(entryModule => { | ||
render(( | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
module.exports = function processREADME(body) { | ||
const url = require('url'); | ||
|
||
module.exports = function processREADME(body, options = {}) { | ||
return body | ||
.replace(/[^]*?<div align="center">([^]*?)<\/div>/, (match, content) => { | ||
let parsed = content.match(/<p>([^]*?)<\/?p>/); | ||
|
@@ -8,6 +10,10 @@ module.exports = function processREADME(body) { | |
.replace(/<h1.*?>.+?<\/h1>/, '') | ||
.replace(/# .+/, '') | ||
.replace(/.*\n=+/, '') | ||
// Replace local github links with absolute links to the github location | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change broke some readmes: [![npm version](https://badge.fury.io/js/polymer-webpack-loader.svg)](https://badge.fury.io/js/polymer-webpack-loader)
[![build status](https://travis-ci.org/webpack-contrib/polymer-webpack-loader.svg?branch=master)](https://travis-ci.org/webpack-contrib/polymer-webpack-loader)
> [Polymer](https://www.polymer-project.org/) component loader for [webpack](https://webpack.js.org/). After processed by this line: undefined](https://badge.fury.io/js/polymer-webpack-loader)
undefined](https://travis-ci.org/webpack-contrib/polymer-webpack-loader)
> undefined component loader for undefined. @Munter Could you please take a look, we could maybe avoid that transformation at all There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix: #2451 |
||
// EXAMPLE: [Contributing](./.github/CONTRIBUTING.md) | ||
// EXAMPLE: [Contributing](CONTRIBUTING.md) | ||
.replace(/\[([^\]]*)\]\(([^)]+)\)/g, (markdownLink, content, href) => `[${content}](${url.resolve(options.source, href)})`) | ||
// Modify links to keep them within the site | ||
.replace(/https?:\/\/github.com\/(webpack|webpack-contrib)\/([-A-za-z0-9]+-loader\/?)([)"])/g, '/loaders/$2/$3') | ||
.replace(/https?:\/\/github.com\/(webpack|webpack-contrib)\/([-A-za-z0-9]+-plugin\/?)([)"])/g, '/plugins/$2/$3') | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,12 @@ const contentTree = require('./src/_content.json'); | |
const common = require('./webpack.common.js'); | ||
|
||
// content tree to path array | ||
const paths = flattenContentTree(contentTree); | ||
const paths = [ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice catch! |
||
...flattenContentTree(contentTree), | ||
'/vote', | ||
'/organization', | ||
'/starter-kits' | ||
]; | ||
|
||
// Prod only config | ||
const prod = { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why add
markdown
in the first place?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems all the basic styles are now scoped under
.markdown
where they previously existed underpage__content
(now removed).I'm not happy with this solution, but I'm not going to redo the CSS architecture as well when my focus is fixing broken links
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Me neither, will fix :)