Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
8492720a
Commit
8492720a
authored
Sep 23, 2020
by
derek-knox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Apply review feedback
parent
2b60bc30
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletion
+7
-1
app/assets/javascripts/static_site_editor/services/front_matterify.js
...avascripts/static_site_editor/services/front_matterify.js
+7
-1
No files found.
app/assets/javascripts/static_site_editor/services/front_matterify.js
View file @
8492720a
...
@@ -2,6 +2,12 @@ import jsYaml from 'js-yaml';
...
@@ -2,6 +2,12 @@ import jsYaml from 'js-yaml';
const
NEW_LINE
=
'
\n
'
;
const
NEW_LINE
=
'
\n
'
;
const
hasMatter
=
(
firstThreeChars
,
fourthChar
)
=>
{
const
isYamlDelimiter
=
firstThreeChars
===
'
---
'
;
const
isFourthCharNewline
=
fourthChar
===
NEW_LINE
;
return
isYamlDelimiter
&&
isFourthCharNewline
;
};
export
const
frontMatterify
=
source
=>
{
export
const
frontMatterify
=
source
=>
{
let
index
=
3
;
let
index
=
3
;
let
offset
;
let
offset
;
...
@@ -16,7 +22,7 @@ export const frontMatterify = source => {
...
@@ -16,7 +22,7 @@ export const frontMatterify = source => {
type
:
null
,
type
:
null
,
};
};
if
(
!
type
||
source
.
charAt
(
index
)
!==
NEW_LINE
)
{
if
(
!
hasMatter
(
delimiter
,
source
.
charAt
(
index
))
)
{
return
NO_FRONTMATTER
;
return
NO_FRONTMATTER
;
}
}
...
...
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