Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
ffbs-gluon
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
darkbit
ffbs-gluon
Commits
933cc3d7
Unverified
Commit
933cc3d7
authored
7 years ago
by
Matthias Schiffer
Browse files
Options
Downloads
Patches
Plain Diff
gluon-web: use ' instead of " for strings in generated Lua code
We need a bit less escaping this way.
parent
3e292ba0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
package/gluon-web/src/template_parser.c
+5
-5
5 additions, 5 deletions
package/gluon-web/src/template_parser.c
package/gluon-web/src/template_utils.c
+12
-15
12 additions, 15 deletions
package/gluon-web/src/template_utils.c
with
17 additions
and
20 deletions
package/gluon-web/src/template_parser.c
+
5
−
5
View file @
933cc3d7
...
...
@@ -73,12 +73,12 @@ struct template_parser {
/* leading and trailing code for different types */
static
const
char
*
const
gen_code
[][
2
]
=
{
[
T_TYPE_INIT
]
=
{
NULL
,
NULL
},
[
T_TYPE_TEXT
]
=
{
"write(
\"
"
,
"
\"
)"
},
[
T_TYPE_TEXT
]
=
{
"write(
'
"
,
"'
)"
},
[
T_TYPE_COMMENT
]
=
{
NULL
,
NULL
},
[
T_TYPE_EXPR
]
=
{
"write(tostring("
,
" or
\"\"
))"
},
[
T_TYPE_INCLUDE
]
=
{
"include(
\"
"
,
"
\"
)"
},
[
T_TYPE_I18N
]
=
{
"write(
\"
"
,
"
\"
)"
},
[
T_TYPE_I18N_RAW
]
=
{
"write(
\"
"
,
"
\"
)"
},
[
T_TYPE_EXPR
]
=
{
"write(tostring("
,
" or
''
))"
},
[
T_TYPE_INCLUDE
]
=
{
"include(
'
"
,
"'
)"
},
[
T_TYPE_I18N
]
=
{
"write(
'
"
,
"'
)"
},
[
T_TYPE_I18N_RAW
]
=
{
"write(
'
"
,
"'
)"
},
[
T_TYPE_CODE
]
=
{
NULL
,
" "
},
[
T_TYPE_EOF
]
=
{
NULL
,
NULL
},
};
...
...
This diff is collapsed.
Click to expand it.
package/gluon-web/src/template_utils.c
+
12
−
15
View file @
933cc3d7
...
...
@@ -267,8 +267,7 @@ char * pcdata(const char *s, size_t l, size_t *outl)
if
(
!
buf
)
return
NULL
;
for
(
o
=
0
;
o
<
l
;
o
++
)
{
for
(
o
=
0
;
o
<
l
;
o
++
)
{
/* Invalid XML bytes */
if
((
*
ptr
<=
0x08
)
||
((
*
ptr
>=
0x0B
)
&&
(
*
ptr
<=
0x0C
))
||
...
...
@@ -279,11 +278,11 @@ char * pcdata(const char *s, size_t l, size_t *outl)
}
/* Escapes */
else
if
((
*
ptr
==
0x26
)
||
(
*
ptr
==
0x27
)
||
(
*
ptr
==
0x22
)
||
(
*
ptr
==
0x3C
)
||
(
*
ptr
==
0x3E
))
else
if
((
*
ptr
==
'\''
)
||
(
*
ptr
==
'"'
)
||
(
*
ptr
==
'&'
)
||
(
*
ptr
==
'<'
)
||
(
*
ptr
==
'>'
))
{
esl
=
snprintf
(
esq
,
sizeof
(
esq
),
"&#%i;"
,
*
ptr
);
...
...
@@ -319,26 +318,24 @@ void luastr_escape(struct template_buffer *out, const char *s, size_t l, bool es
char
esq
[
8
];
const
char
*
ptr
;
for
(
ptr
=
s
;
ptr
<
(
s
+
l
);
ptr
++
)
{
switch
(
*
ptr
)
{
for
(
ptr
=
s
;
ptr
<
(
s
+
l
);
ptr
++
)
{
switch
(
*
ptr
)
{
case
'\\'
:
buf_append
(
out
,
"
\\\\
"
,
2
);
break
;
case
'
"
'
:
case
'
\'
'
:
if
(
escape_xml
)
buf_append
(
out
,
"
4
;"
,
5
);
buf_append
(
out
,
"
9
;"
,
5
);
else
buf_append
(
out
,
"
\\\
"
"
,
2
);
buf_append
(
out
,
"
\\\
'
"
,
2
);
break
;
case
'\n'
:
buf_append
(
out
,
"
\\
n"
,
2
);
break
;
case
'
\'
'
:
case
'
"
'
:
case
'&'
:
case
'<'
:
case
'>'
:
...
...
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