mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 08:10:11 +01:00
Merge pull request #2847 from blutorange/lang-freemarker
Implements #2383 Add syntax modes for FreeMarker template language
This commit is contained in:
commit
93c7165c32
16 changed files with 24866 additions and 0 deletions
|
|
@ -0,0 +1,61 @@
|
|||
<#ftl stripText=false>
|
||||
|
||||
<#-- Free marker demo -->
|
||||
|
||||
<#comment>
|
||||
This demonstrates the FreeMarker language. The default theme is not very
|
||||
colorful and displays many different token types in the same color, but keep in
|
||||
mind that you can define your own theme (or extend an existing one).
|
||||
|
||||
Note that free marker actually defines 6 similar but different syntax modes:
|
||||
|
||||
- 3 tag syntax modes: Angle (<#if>), Bracket ([#if]), and Auto.
|
||||
- 2 interpolation modes: Dollar (${...}) and Bracket ([=...])
|
||||
|
||||
In auto mode, the first tag determines the tag syntax. You can use the language
|
||||
IDs "freemarker.tag-bracket.interpolation-dollar" etc. to force a specific mode.
|
||||
|
||||
The default FreeMarker mode is Angle/Dollar.
|
||||
</#comment>
|
||||
|
||||
<#macro greet name>
|
||||
<font size="+2">Hello [=name]!</font>
|
||||
</#macro>
|
||||
|
||||
<#macro border>
|
||||
<table border=4 cellspacing=0 cellpadding=4><tr><td>
|
||||
<#nested>
|
||||
</tr></td></table>
|
||||
</#macro>
|
||||
|
||||
<#function avg x y>
|
||||
<#return (x + y) / 2>
|
||||
</#function>
|
||||
|
||||
<#assign user = "Juila Smith">
|
||||
<#assign animals = [{"name": "Tanuki", "price": 200}, {"name": "Phoenix", "price": 1111}]>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Welcome!</title>
|
||||
</head>
|
||||
<body>
|
||||
<#-- Greet the user with his/her name -->
|
||||
<h1>
|
||||
<@greet user />
|
||||
</h1>
|
||||
|
||||
<p>We have these animals:
|
||||
|
||||
<ul>
|
||||
<#list animals as animal>
|
||||
<li>[=animal.name] for [=animal.price] Euros
|
||||
</#list>
|
||||
</ul>
|
||||
|
||||
<@border>The bordered text</@border>
|
||||
|
||||
The average of 35 and 49 is [=avg(35, 49)].
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
<#ftl stripText=false>
|
||||
|
||||
<#-- Free marker demo -->
|
||||
|
||||
<#comment>
|
||||
This demonstrates the FreeMarker language. The default theme is not very
|
||||
colorful and displays many different token types in the same color, but keep in
|
||||
mind that you can define your own theme (or extend an existing one).
|
||||
|
||||
Note that free marker actually defines 6 similar but different syntax modes:
|
||||
|
||||
- 3 tag syntax modes: Angle (<#if>), Bracket ([#if]), and Auto.
|
||||
- 2 interpolation modes: Dollar (${...}) and Bracket ([=...])
|
||||
|
||||
In auto mode, the first tag determines the tag syntax. You can use the language
|
||||
IDs "freemarker.tag-bracket.interpolation-dollar" etc. to force a specific mode.
|
||||
|
||||
The default FreeMarker mode is Angle/Dollar.
|
||||
</#comment>
|
||||
|
||||
<#macro greet name>
|
||||
<font size="+2">Hello ${name}!</font>
|
||||
</#macro>
|
||||
|
||||
<#macro border>
|
||||
<table border=4 cellspacing=0 cellpadding=4><tr><td>
|
||||
<#nested>
|
||||
</tr></td></table>
|
||||
</#macro>
|
||||
|
||||
<#function avg x y>
|
||||
<#return (x + y) / 2>
|
||||
</#function>
|
||||
|
||||
<#assign user = "Juila Smith">
|
||||
<#assign animals = [{"name": "Tanuki", "price": 200}, {"name": "Phoenix", "price": 1111}]>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Welcome!</title>
|
||||
</head>
|
||||
<body>
|
||||
<#-- Greet the user with his/her name -->
|
||||
<h1>
|
||||
<@greet user />
|
||||
</h1>
|
||||
|
||||
<p>We have these animals:
|
||||
|
||||
<ul>
|
||||
<#list animals as animal>
|
||||
<li>${animal.name} for ${animal.price} Euros
|
||||
</#list>
|
||||
</ul>
|
||||
|
||||
<@border>The bordered text</@border>
|
||||
|
||||
The average of 35 and 49 is ${avg(35, 49)}.
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
Auto mode detect the tag syntax mode automatically.
|
||||
Try exchanging the order of the next two lines and see what happens!
|
||||
|
||||
[#ftl stripText=false]
|
||||
<#ftl stripText=false>
|
||||
|
||||
<#-- Free marker demo -->
|
||||
|
||||
<#comment>
|
||||
This demonstrates the FreeMarker language. The default theme is not very
|
||||
colorful and displays many different token types in the same color, but keep in
|
||||
mind that you can define your own theme (or extend an existing one).
|
||||
|
||||
Note that free marker actually defines 6 similar but different syntax modes:
|
||||
|
||||
- 3 tag syntax modes: Angle (<#if>), Bracket ([#if]), and Auto.
|
||||
- 2 interpolation modes: Dollar (${...}) and Bracket ([=...])
|
||||
|
||||
In auto mode, the first tag determines the tag syntax. You can use the language
|
||||
IDs "freemarker.tag-bracket.interpolation-dollar" etc. to force a specific mode.
|
||||
|
||||
The default FreeMarker mode is Angle/Dollar.
|
||||
</#comment>
|
||||
|
||||
<#macro greet name>
|
||||
<font size="+2">Hello [=name]!</font>
|
||||
</#macro>
|
||||
|
||||
<#macro border>
|
||||
<table border=4 cellspacing=0 cellpadding=4><tr><td>
|
||||
<#nested>
|
||||
</tr></td></table>
|
||||
</#macro>
|
||||
|
||||
<#function avg x y>
|
||||
<#return (x + y) / 2>
|
||||
</#function>
|
||||
|
||||
<#assign user = "Juila Smith">
|
||||
<#assign animals = [{"name": "Tanuki", "price": 200}, {"name": "Phoenix", "price": 1111}]>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Welcome!</title>
|
||||
</head>
|
||||
<body>
|
||||
<#-- Greet the user with his/her name -->
|
||||
<h1>
|
||||
<@greet user />
|
||||
</h1>
|
||||
|
||||
<p>We have these animals:
|
||||
|
||||
<ul>
|
||||
<#list animals as animal>
|
||||
<li>[=animal.name] for [=animal.price] Euros
|
||||
</#list>
|
||||
</ul>
|
||||
|
||||
<@border>The bordered text</@border>
|
||||
|
||||
The average of 35 and 49 is [=avg(35, 49)].
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
Auto mode detect the tag syntax mode automatically.
|
||||
Try exchanging the order of the next two lines and see what happens!
|
||||
|
||||
<#ftl stripText=false>
|
||||
[#ftl stripText=false]
|
||||
|
||||
<#-- Free marker demo -->
|
||||
|
||||
<#comment>
|
||||
This demonstrates the FreeMarker language. The default theme is not very
|
||||
colorful and displays many different token types in the same color, but keep in
|
||||
mind that you can define your own theme (or extend an existing one).
|
||||
|
||||
Note that free marker actually defines 6 similar but different syntax modes:
|
||||
|
||||
- 3 tag syntax modes: Angle (<#if>), Bracket ([#if]), and Auto.
|
||||
- 2 interpolation modes: Dollar (${...}) and Bracket ([=...])
|
||||
|
||||
In auto mode, the first tag determines the tag syntax. You can use the language
|
||||
IDs "freemarker.tag-bracket.interpolation-dollar" etc. to force a specific mode.
|
||||
|
||||
The default FreeMarker mode is Angle/Dollar.
|
||||
</#comment>
|
||||
|
||||
<#macro greet name>
|
||||
<font size="+2">Hello ${name}!</font>
|
||||
</#macro>
|
||||
|
||||
<#macro border>
|
||||
<table border=4 cellspacing=0 cellpadding=4><tr><td>
|
||||
<#nested>
|
||||
</tr></td></table>
|
||||
</#macro>
|
||||
|
||||
<#function avg x y>
|
||||
<#return (x + y) / 2>
|
||||
</#function>
|
||||
|
||||
<#assign user = "Juila Smith">
|
||||
<#assign animals = [{"name": "Tanuki", "price": 200}, {"name": "Phoenix", "price": 1111}]>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Welcome!</title>
|
||||
</head>
|
||||
<body>
|
||||
<#-- Greet the user with his/her name -->
|
||||
<h1>
|
||||
<@greet user />
|
||||
</h1>
|
||||
|
||||
<p>We have these animals:
|
||||
|
||||
<ul>
|
||||
<#list animals as animal>
|
||||
<li>${animal.name} for ${animal.price} Euros
|
||||
</#list>
|
||||
</ul>
|
||||
|
||||
<@border>The bordered text</@border>
|
||||
|
||||
The average of 35 and 49 is ${avg(35, 49)}.
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
[#ftl stripText=false]
|
||||
|
||||
[#-- Free marker demo --]
|
||||
|
||||
[#comment]
|
||||
This demonstrates the FreeMarker language. The default theme is not very
|
||||
colorful and displays many different token types in the same color, but keep in
|
||||
mind that you can define your own theme (or extend an existing one).
|
||||
|
||||
Note that free marker actually defines 6 similar but different syntax modes:
|
||||
|
||||
- 3 tag syntax modes: Angle (<#if>), Bracket ([#if]), and Auto.
|
||||
- 2 interpolation modes: Dollar (${...}) and Bracket ([=...])
|
||||
|
||||
In auto mode, the first tag determines the tag syntax. You can use the language
|
||||
IDs "freemarker.tag-bracket.interpolation-dollar" etc. to force a specific mode.
|
||||
|
||||
The default FreeMarker mode is Angle/Dollar.
|
||||
[/#comment]
|
||||
|
||||
[#macro greet name]
|
||||
<font size="+2">Hello [=name]!</font>
|
||||
[/#macro[
|
||||
|
||||
[#macro border]
|
||||
<table border=4 cellspacing=0 cellpadding=4><tr><td>
|
||||
[#nested]
|
||||
</tr></td></table>
|
||||
[/#macro]
|
||||
|
||||
[#function avg x y]
|
||||
[#return (x + y) / 2]
|
||||
[/#function]
|
||||
|
||||
[#assign user = "Juila Smith"]
|
||||
[#assign animals = [{"name": "Tanuki", "price": 200}, {"name": "Phoenix", "price": 1111}]]
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Welcome!</title>
|
||||
</head>
|
||||
<body>
|
||||
[#-- Greet the user with his/her name --]
|
||||
<h1>
|
||||
<@greet user />
|
||||
</h1>
|
||||
|
||||
<p>We have these animals:
|
||||
|
||||
<ul>
|
||||
[#list animals as animal]
|
||||
<li>[=animal.name] for [=animal.price] Euros
|
||||
[/#list][
|
||||
</ul>
|
||||
|
||||
<@border>The bordered text</@border>
|
||||
|
||||
The average of 35 and 49 is [=avg(35, 49]}.
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
[#ftl stripText=false]
|
||||
|
||||
[#-- Free marker demo --]
|
||||
|
||||
[#comment]
|
||||
This demonstrates the FreeMarker language. The default theme is not very
|
||||
colorful and displays many different token types in the same color, but keep in
|
||||
mind that you can define your own theme (or extend an existing one).
|
||||
|
||||
Note that free marker actually defines 6 similar but different syntax modes:
|
||||
|
||||
- 3 tag syntax modes: Angle (<#if>), Bracket ([#if]), and Auto.
|
||||
- 2 interpolation modes: Dollar (${...}) and Bracket ([=...])
|
||||
|
||||
In auto mode, the first tag determines the tag syntax. You can use the language
|
||||
IDs "freemarker.tag-bracket.interpolation-dollar" etc. to force a specific mode.
|
||||
|
||||
The default FreeMarker mode is Angle/Dollar.
|
||||
[/#comment]
|
||||
|
||||
[#macro greet name]
|
||||
<font size="+2">Hello ${name}!</font>
|
||||
[/#macro[
|
||||
|
||||
[#macro border]
|
||||
<table border=4 cellspacing=0 cellpadding=4><tr><td>
|
||||
[#nested]
|
||||
</tr></td></table>
|
||||
[/#macro]
|
||||
|
||||
[#function avg x y]
|
||||
[#return (x + y) / 2]
|
||||
[/#function]
|
||||
|
||||
[#assign user = "Juila Smith"]
|
||||
[#assign animals = [{"name": "Tanuki", "price": 200}, {"name": "Phoenix", "price": 1111}]]
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Welcome!</title>
|
||||
</head>
|
||||
<body>
|
||||
[#-- Greet the user with his/her name --]
|
||||
<h1>
|
||||
<@greet user />
|
||||
</h1>
|
||||
|
||||
<p>We have these animals:
|
||||
|
||||
<ul>
|
||||
[#list animals as animal]
|
||||
<li>${animal.name} for ${animal.price} Euros
|
||||
[/#list][
|
||||
</ul>
|
||||
|
||||
<@border>The bordered text</@border>
|
||||
|
||||
The average of 35 and 49 is ${avg(35, 49)}.
|
||||
|
||||
</body>
|
||||
</html>
|
||||
61
website/index/samples/sample.freemarker2.txt
Normal file
61
website/index/samples/sample.freemarker2.txt
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
<#ftl stripText=false>
|
||||
|
||||
<#-- Free marker demo -->
|
||||
|
||||
<#comment>
|
||||
This demonstrates the FreeMarker language. The default theme is not very
|
||||
colorful and displays many different token types in the same color, but keep in
|
||||
mind that you can define your own theme (or extend an existing one).
|
||||
|
||||
Note that free marker actually defines 6 similar but different syntax modes:
|
||||
|
||||
- 3 tag syntax modes: Angle (<#if>), Bracket ([#if]), and Auto.
|
||||
- 2 interpolation modes: Dollar (${...}) and Bracket ([=...])
|
||||
|
||||
In auto mode, the first tag determines the tag syntax. You can use the language
|
||||
IDs "freemarker.tag-bracket.interpolation-dollar" etc. to force a specific mode.
|
||||
|
||||
The default FreeMarker mode is Angle/Dollar.
|
||||
</#comment>
|
||||
|
||||
<#macro greet name>
|
||||
<font size="+2">Hello ${name}!</font>
|
||||
</#macro>
|
||||
|
||||
<#macro border>
|
||||
<table border=4 cellspacing=0 cellpadding=4><tr><td>
|
||||
<#nested>
|
||||
</tr></td></table>
|
||||
</#macro>
|
||||
|
||||
<#function avg x y>
|
||||
<#return (x + y) / 2>
|
||||
</#function>
|
||||
|
||||
<#assign user = "Juila Smith">
|
||||
<#assign animals = [{"name": "Tanuki", "price": 200}, {"name": "Phoenix", "price": 1111}]>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Welcome!</title>
|
||||
</head>
|
||||
<body>
|
||||
<#-- Greet the user with his/her name -->
|
||||
<h1>
|
||||
<@greet user />
|
||||
</h1>
|
||||
|
||||
<p>We have these animals:
|
||||
|
||||
<ul>
|
||||
<#list animals as animal>
|
||||
<li>${animal.name} for ${animal.price} Euros
|
||||
</#list>
|
||||
</ul>
|
||||
|
||||
<@border>The bordered text</@border>
|
||||
|
||||
The average of 35 and 49 is ${avg(35, 49)}.
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue