Skip to content

fix(cover): Compatible with legacy styles, fixed #677 #678

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

Merged
merged 2 commits into from
Nov 1, 2018
Merged
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
2 changes: 0 additions & 2 deletions src/core/render/compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,6 @@ export class Compiler {
result = helperTpl('tip', text)
} else if (/^\?>/.test(text)) {
result = helperTpl('warn', text)
} else if (/^</.test(text)) {
return text
} else {
result = `<p>${text}</p>`
}
Expand Down
13 changes: 1 addition & 12 deletions src/core/render/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ export function renderMixin(proto) {

const m = html
.trim()
.match('<img.*?data-origin="(.*?)"[^a]+alt="(.*?)">([^<]*?)$')
.match('<p><img.*?data-origin="(.*?)"[^a]+alt="(.*?)">([^<]*?)</p>$')

if (m) {
if (m[2] === 'color') {
Expand All @@ -198,17 +198,6 @@ export function renderMixin(proto) {
html = html.replace(m[0], '')
}

// XXX: A Workaround
html = html
.split('\n')
.map(part => {
if (/^<a/.test(part)) {
return part.replace('<a', '<a data-button')
}
return part
})
.join('\n')

this._renderTo('.cover-main', html)
sticky()
}
Expand Down
2 changes: 1 addition & 1 deletion src/themes/basic/_coverpage.styl
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ section.cover
max-width 500px
padding 0

.cover-main > a[data-button]
.cover-main > p:last-child a
border-color var(--theme-color, $color-primary)
border-radius 2rem
border-style solid
Expand Down