Replace vars

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
Tilman Vatteroth 2022-03-28 20:40:33 +02:00
parent 7e1f774867
commit e565a548ee
3 changed files with 7 additions and 18 deletions

View file

@ -20,14 +20,11 @@ export const useAdjustedRelativeSplitValue = (
relativeSplitValue: number
): number =>
useMemo(() => {
let splitValue: number
if (!showLeft && showRight) {
splitValue = 0
return 0
} else if (showLeft && !showRight) {
splitValue = 100
return 100
} else {
splitValue = relativeSplitValue
return Math.min(100, Math.max(0, relativeSplitValue))
}
return Math.min(100, Math.max(0, splitValue))
}, [relativeSplitValue, showLeft, showRight])

View file

@ -30,17 +30,9 @@ export class HighlightedCodeReplacer extends ComponentReplacer {
const language = codeNode.attribs['data-highlight-language']
const extraData = codeNode.attribs['data-extra']
const extraInfos = /(=(\d+|\+)?)?(!?)/.exec(extraData)
let showLineNumbers = false
let startLineNumberAttribute = ''
let wrapLines = false
if (extraInfos) {
showLineNumbers = extraInfos[1]?.startsWith('=') || false
startLineNumberAttribute = extraInfos[2]
wrapLines = extraInfos[3] === '!'
}
const showLineNumbers = extraInfos ? extraInfos[1]?.startsWith('=') : false
const startLineNumberAttribute = extraInfos?.[2] ?? ''
const wrapLines = extraInfos?.[3] === '!'
const startLineNumber =
startLineNumberAttribute === '+' ? this.lastLineNumber : parseInt(startLineNumberAttribute) || 1

View file

@ -7,5 +7,5 @@
import type { Document } from 'domhandler'
export abstract class NodeProcessor {
public abstract process(nodes: Document): Document
public abstract process(document: Document): Document
}