File size: 707 Bytes
70e483f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import { normalizeHtml } from '#shared/utils/html';
import { read, samples, write } from './common';

function normalizeOutPath(input: string): string {
  const segments = input.split('/');
  segments[segments.length - 1] = 'output/normalize-' + segments[segments.length - 1];
  return segments.join('/');
}

function run() {
  for (const group of samples.filter(group => group.hasContent)) {
    console.group(group.name);
    for (const samplePath of group.samples) {
      const html = read(samplePath);
      const result = normalizeHtml(html);
      write(normalizeOutPath(samplePath), result);
      console.log(samplePath, '已处理');
    }
    console.groupEnd();
    console.log();
  }
}

run();