Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
O
official
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
吕祺
official
Commits
cc67d178
Commit
cc67d178
authored
Jul 24, 2023
by
吕祺
⛹🏽
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
portfolio cms change
parent
f22e22a9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
68 additions
and
0 deletions
+68
-0
yaml.js
utils/yaml.js
+68
-0
No files found.
utils/yaml.js
0 → 100644
View file @
cc67d178
const
yaml
=
require
(
'js-yaml'
);
const
fs
=
require
(
'fs'
);
const
doc
=
yaml
.
loadAll
(
fs
.
readFileSync
(
'../content/portfolioPage.md'
,
'utf8'
));
// console.log(doc)
console
.
log
(
doc
[
0
].
portfolio
)
portfolio
=
doc
[
0
].
portfolio
portfolioChi
=
portfolio
.
map
(
item
=>
{
return
{
logo
:
item
.
logo
,
logo2
:
item
.
logo2
,
sinceDate
:
item
.
sinceDate
,
name
:
item
.
name
,
type
:
item
.
type
,
website
:
item
.
website
,
description
:
item
.
description
,
}
})
try
{
let
str
=
yaml
.
dump
(
portfolioChi
)
str
=
`---
portfolio:
${
str
}
---`
fs
.
writeFile
(
'../content/portfolioChi.md'
,
str
,
function
(
error
)
{
if
(
error
)
{
console
.
log
(
'写入失败'
)
}
else
{
console
.
log
(
'写入成功了'
)
}
})
}
catch
(
e
)
{
console
.
log
(
e
)
}
portfolioEN
=
portfolio
.
map
(
item
=>
{
return
{
logo
:
item
.
logo
,
logo2
:
item
.
logo2
,
sinceDate
:
item
.
sinceDate
,
nameEN
:
item
.
nameEN
,
type
:
item
.
type
,
website
:
item
.
website
,
descriptionEN
:
item
.
descriptionEN
,
}
})
// const portfolio = {
try
{
let
str
=
yaml
.
dump
(
portfolioEN
)
str
=
`---
portfolioEN:
${
str
}
---`
fs
.
writeFile
(
'../content/portfolioEN.md'
,
str
,
function
(
error
)
{
if
(
error
)
{
console
.
log
(
'写入失败'
)
}
else
{
console
.
log
(
'写入成功了'
)
}
})
}
catch
(
e
)
{
console
.
log
(
e
)
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment