mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-18 14:00:39 -07:00
docs: remove translations & update homepage (#904)
* docs: add GitHub buttons and improve option docs
* chore: replace husky with prepush check
* docs: revamp homepage and switch to custom GitHub buttons
- Make the docs English-only by removing all zh-cn content, the language switcher UI, and related JS/config
- Rework homepage feature cards (Safe & Typed, Pure JavaScript, Shopify & Jekyll, Streaming) and refresh section colors/layout
- Replace buttons.github.io with custom Star/Sponsor buttons featuring a live star count and dark-mode support
- Drop the buttons.js script and tidy banner, header, footer, and share partials
Co-authored-by: Cursor <[email protected]>
* fix: restore tsconfig settings and changelog build
Re-add suppressImplicitAnyIndexErrors and downlevelIteration removed in
a75033e2c, which broke the rollup TypeScript build on CI. Drop zh-cn
changelog output now that translations were removed.
Co-authored-by: Cursor <[email protected]>
* fix: resolve TS errors without deprecated tsconfig options
Co-authored-by: Cursor <[email protected]>
---------
Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -4,7 +4,7 @@ import type { Limiter } from './limiter'
|
||||
|
||||
const rFormat = /%([-_0^#:]+)?(\d+)?([EO])?(.)/
|
||||
interface FormatOptions {
|
||||
flags: object;
|
||||
flags: Record<string, boolean>;
|
||||
width?: string;
|
||||
modifier?: string;
|
||||
memoryLimit?: Pick<Limiter, 'use'>;
|
||||
@@ -50,7 +50,7 @@ function century (d: LiquidDate) {
|
||||
}
|
||||
|
||||
// default to 0
|
||||
const padWidths = {
|
||||
const padWidths: Record<string, number> = {
|
||||
d: 2,
|
||||
e: 2,
|
||||
H: 2,
|
||||
@@ -77,7 +77,9 @@ function getTimezoneOffset (d: LiquidDate, opts: FormatOptions) {
|
||||
(opts.flags[':'] ? ':' : '') +
|
||||
padStart(m, 2, '0')
|
||||
}
|
||||
const formatCodes = {
|
||||
type FormatCodeHandler = (d: LiquidDate, opts: FormatOptions) => unknown
|
||||
|
||||
const formatCodes: Record<string, FormatCodeHandler> = {
|
||||
a: (d: LiquidDate) => d.getShortWeekdayName(),
|
||||
A: (d: LiquidDate) => d.getLongWeekdayName(),
|
||||
b: (d: LiquidDate) => d.getShortMonthName(),
|
||||
@@ -118,8 +120,8 @@ const formatCodes = {
|
||||
't': () => '\t',
|
||||
'n': () => '\n',
|
||||
'%': () => '%'
|
||||
};
|
||||
(formatCodes as any).h = formatCodes.b
|
||||
}
|
||||
formatCodes.h = formatCodes.b
|
||||
|
||||
export function strftime (d: LiquidDate, formatStr: string, memoryLimit?: Pick<Limiter, 'use'>) {
|
||||
let output = ''
|
||||
@@ -137,11 +139,11 @@ function format (d: LiquidDate, match: RegExpExecArray, memoryLimit?: Pick<Limit
|
||||
const [input, flagStr = '', width, modifier, conversion] = match
|
||||
const convert = formatCodes[conversion]
|
||||
if (!convert) return input
|
||||
const flags = {}
|
||||
const flags: Record<string, boolean> = {}
|
||||
for (const flag of flagStr) flags[flag] = true
|
||||
let ret = String(convert(d, { flags, width, modifier, memoryLimit }))
|
||||
let padChar = padSpaceChars.has(conversion) ? ' ' : '0'
|
||||
let padWidth = width || padWidths[conversion] || 0
|
||||
let padWidth = Number(width) || padWidths[conversion] || 0
|
||||
if (flags['^']) ret = ret.toUpperCase()
|
||||
else if (flags['#']) ret = changeCase(ret)
|
||||
if (flags['_']) padChar = ' '
|
||||
|
||||
Reference in New Issue
Block a user