Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
stroeer
VMS-XML-Generator
Commits
35398fbf
Verified
Commit
35398fbf
authored
Nov 15, 2018
by
Marco Kellershoff
🤸
Browse files
Add precompiled ejs template
parent
a2043c02
Changes
4
Hide whitespace changes
Inline
Side-by-side
Taskfile
View file @
35398fbf
...
...
@@ -36,7 +36,7 @@ function clean {
}
function
build
{
cp
src/app.js src/app.css src/index.html src/xml.txt
\
cp
src/app.js src/app.css src/index.html src/xml.txt
src/xml.txt.js
\
dist/
cp
-r
src/assets
\
dist/
...
...
src/app.js
View file @
35398fbf
(
function
(
window
,
document
)
{
"
use strict
"
;
const
ALLOWED_CHARACTERS_IN_FILENAME
=
"
A-z0-9_.-
"
;
const
getValue
=
function
(
id
)
{
...
...
@@ -87,8 +86,7 @@
const
data
=
fetchData
();
const
filename
=
generateFilenameFromTitle
(
data
.
title
);
const
_generateXML
=
function
(
xml
)
{
const
template
=
ejs
.
compile
(
xml
);
const
generatedXML
=
template
(
data
);
const
generatedXML
=
xml_txt
(
data
);
downloadXML
(
filename
,
generatedXML
);
};
const
_fetchXML
=
function
()
{
...
...
src/index.html
View file @
35398fbf
...
...
@@ -11,6 +11,7 @@
<script
src=
"assets/jquery/jquery-3.2.1.min.js"
></script>
<script
src=
"assets/bootstrap/bootstrap.min.js"
></script>
<script
src=
"lib/moment-with-locales.min.js"
></script>
<script
src=
"xml.txt.js"
></script>
<script
src=
"lib/ejs.min.js"
></script>
<script
src=
"lib/jquery-ui-1.12.1/jquery-ui.min.js"
></script>
<script
src=
"lib/jquery-ui-timepicker-addon.js"
></script>
...
...
src/xml.txt.js
0 → 100644
View file @
35398fbf
function
xml_txt
(
locals
,
escapeFn
,
include
,
rethrow
)
{
var
escapeFn
=
escapeFn
||
function
(
markup
)
{
return
markup
==
undefined
?
""
:
String
(
markup
).
replace
(
_MATCH_HTML
,
encode_char
);
};
var
_ENCODE_HTML_RULES
=
{
"
&
"
:
"
&
"
,
"
<
"
:
"
<
"
,
"
>
"
:
"
>
"
,
'
"
'
:
"
"
"
,
"
'
"
:
"
'
"
},
_MATCH_HTML
=
/
[
&<>'"
]
/g
;
function
encode_char
(
c
)
{
return
_ENCODE_HTML_RULES
[
c
]
||
c
;
}
var
__output
=
[],
__append
=
__output
.
push
.
bind
(
__output
);
with
(
locals
||
{})
{
__append
(
'
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
\n
<video:video xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">
\n
<video:thumbnail_loc>
'
);
__append
(
escapeFn
(
thumbnail
));
__append
(
"
</video:thumbnail_loc>
\n
<video:title>
"
);
__append
(
escapeFn
(
title
));
__append
(
"
</video:title>
\n
<video:description>
"
);
__append
(
escapeFn
(
description
));
__append
(
"
</video:description>
\n
<video:content_loc>
"
);
__append
(
escapeFn
(
video
));
__append
(
"
</video:content_loc>
\n
<video:duration>
"
);
__append
(
escapeFn
(
video_length
));
__append
(
"
</video:duration>
\n
<video:expiration_date>
"
);
__append
(
escapeFn
(
expdate
));
__append
(
"
</video:expiration_date>
\n
<video:publication_date>
"
);
__append
(
escapeFn
(
pubdate
));
__append
(
"
</video:publication_date>
\n
<video:family_friendly>
"
);
__append
(
escapeFn
(
famfriendly
));
__append
(
"
</video:family_friendly>
\n
</video:video>
\n
"
);
}
return
__output
.
join
(
""
);
}
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