Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
JUNCA24 RevealJS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PGI15-Teaching
JUNCA24 RevealJS
Commits
571fb678
Commit
571fb678
authored
11 years ago
by
Hakim El Hattab
Browse files
Options
Downloads
Patches
Plain Diff
fix bug where markdown notes in last slide would not parse #574
parent
d62093c2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
plugin/markdown/markdown.js
+15
-26
15 additions, 26 deletions
plugin/markdown/markdown.js
with
15 additions
and
26 deletions
plugin/markdown/markdown.js
+
15
−
26
View file @
571fb678
...
...
@@ -75,12 +75,12 @@
/**
* Helper function for constructing a markdown slide.
*/
function
createMarkdownSlide
(
data
)
{
function
createMarkdownSlide
(
content
,
options
)
{
var
content
=
data
.
content
||
data
;
var
notesMatch
=
content
.
split
(
new
RegExp
(
options
.
notesSeparator
,
'
mgi
'
)
)
;
if
(
data
.
notes
)
{
content
+
=
'
<aside class="notes" data-markdown>
'
+
data
.
notes
+
'
</aside>
'
;
if
(
notes
Match
.
length
===
2
)
{
content
=
notesMatch
[
0
]
+
'
<aside class="notes" data-markdown>
'
+
notes
Match
[
1
].
trim
()
+
'
</aside>
'
;
}
return
'
<script type="text/template">
'
+
content
+
'
</script>
'
;
...
...
@@ -99,17 +99,13 @@
options
.
attributes
=
options
.
attributes
||
''
;
var
separatorRegex
=
new
RegExp
(
options
.
separator
+
(
options
.
verticalSeparator
?
'
|
'
+
options
.
verticalSeparator
:
''
),
'
mg
'
),
horizontalSeparatorRegex
=
new
RegExp
(
options
.
separator
),
notesSeparatorRegex
=
new
RegExp
(
options
.
notesSeparator
,
'
mgi
'
);
horizontalSeparatorRegex
=
new
RegExp
(
options
.
separator
);
var
matches
,
noteMatch
,
lastIndex
=
0
,
isHorizontal
,
wasHorizontal
=
true
,
content
,
notes
,
slide
,
sectionStack
=
[];
// iterate until all blocks between separators are stacked up
...
...
@@ -126,25 +122,14 @@
// pluck slide content from markdown input
content
=
markdown
.
substring
(
lastIndex
,
matches
.
index
);
noteMatch
=
content
.
split
(
notesSeparatorRegex
);
if
(
noteMatch
.
length
===
2
)
{
content
=
noteMatch
[
0
];
notes
=
noteMatch
[
1
].
trim
();
}
slide
=
{
content
:
content
,
notes
:
notes
||
''
};
if
(
isHorizontal
&&
wasHorizontal
)
{
// add to horizontal stack
sectionStack
.
push
(
slide
);
sectionStack
.
push
(
content
);
}
else
{
// add to vertical stack
sectionStack
[
sectionStack
.
length
-
1
].
push
(
slide
);
sectionStack
[
sectionStack
.
length
-
1
].
push
(
content
);
}
lastIndex
=
separatorRegex
.
lastIndex
;
...
...
@@ -160,12 +145,16 @@
for
(
var
i
=
0
,
len
=
sectionStack
.
length
;
i
<
len
;
i
++
)
{
// vertical
if
(
sectionStack
[
i
].
propertyIsEnumerable
(
length
)
&&
typeof
sectionStack
[
i
].
splice
===
'
function
'
)
{
markdownSections
+=
'
<section
'
+
options
.
attributes
+
'
>
'
+
'
<section data-markdown>
'
+
sectionStack
[
i
].
map
(
createMarkdownSlide
).
join
(
'
</section><section data-markdown>
'
)
+
'
</section>
'
+
'
</section>
'
;
markdownSections
+=
'
<section
'
+
options
.
attributes
+
'
>
'
;
sectionStack
[
i
].
forEach
(
function
(
child
)
{
markdownSections
+=
'
<section data-markdown>
'
+
createMarkdownSlide
(
child
,
options
)
+
'
</section>
'
;
}
);
markdownSections
+=
'
</section>
'
;
}
else
{
markdownSections
+=
'
<section
'
+
options
.
attributes
+
'
data-markdown>
'
+
createMarkdownSlide
(
sectionStack
[
i
]
)
+
'
</section>
'
;
markdownSections
+=
'
<section
'
+
options
.
attributes
+
'
data-markdown>
'
+
createMarkdownSlide
(
sectionStack
[
i
]
,
options
)
+
'
</section>
'
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment