402 lines
10 KiB
Python
402 lines
10 KiB
Python
#!/usr/bin/python
|
|
|
|
# please keep these in alphabetical order so it is easy to follow
|
|
# see available languages: /usr/share/gtksourceview-3.0/language-specs
|
|
# or run in python >>> GtkSource.LanguageManager().get_language_ids()
|
|
|
|
|
|
samples = {}
|
|
|
|
samples['ada'] = """
|
|
with Ada.Text_Io; use Ada.Text_Io;
|
|
|
|
procedure Doors is
|
|
type Door_State is (Closed, Open);
|
|
type Door_List is array(Positive range 1..100) of Door_State;
|
|
The_Doors : Door_List := (others => Closed);
|
|
|
|
begin
|
|
for I in 1..100 loop
|
|
for J in The_Doors'range loop
|
|
if J mod I = 0 then
|
|
if The_Doors(J) = Closed then
|
|
The_Doors(J) := Open;
|
|
else
|
|
The_Doors(J) := Closed;
|
|
end if;
|
|
end if;
|
|
end loop;
|
|
end loop;
|
|
|
|
for I in The_Doors'range loop
|
|
Put_Line(Integer'Image(I) & " is " & Door_State'Image(The_Doors(I)));
|
|
end loop;
|
|
end Doors;
|
|
"""
|
|
|
|
samples['asp'] = """
|
|
<html>
|
|
<body>
|
|
<form action="demo_reqquery.asp" method="get">
|
|
Your name: <input type="text" name="fname" size="20" />
|
|
<input type="submit" value="Submit" />
|
|
</form>
|
|
<%
|
|
dim fname
|
|
fname=Request.QueryString("fname")
|
|
If fname<>"" Then
|
|
Response.Write("Hello " & fname & "!<br />")
|
|
Response.Write("How are you today?")
|
|
End If
|
|
%>
|
|
</body>
|
|
</html>
|
|
"""
|
|
|
|
# samples['automake'] = """
|
|
|
|
samples['awk'] = """
|
|
BEGIN {
|
|
for(i = 1; i <= 100; i++) {
|
|
doors[i] = 0 # close the doors
|
|
}
|
|
|
|
for(i = 1; i <= 100; i++) {
|
|
if ( int(sqrt(i)) == sqrt(i) ) {
|
|
doors[i] = 1
|
|
}
|
|
}
|
|
|
|
for(i = 1; i <= 100; i++) {
|
|
print i, doors[i] ? "open" : "close"
|
|
}
|
|
}
|
|
"""
|
|
|
|
# samples['bennugd'] = """
|
|
# samples['bibtex'] = """
|
|
# samples['boo'] = """
|
|
|
|
# do not remove this language since it is the fallback entry
|
|
samples['c'] = """
|
|
/* Some comments */
|
|
#include <stdio.h>
|
|
|
|
int main() {
|
|
int square = 1, increment = 3, door;
|
|
for (door = 1; door <= 100; ++door) {
|
|
printf("door #%d", door);
|
|
|
|
if (door == square) {
|
|
printf(" is open.");
|
|
square += increment;
|
|
increment += 2;
|
|
} else {
|
|
printf(" is closed.");
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
"""
|
|
|
|
samples['c-sharp'] = """
|
|
// Creates and initializes a new integer Array
|
|
int[] intArray = new int[5] { 1, 2, 3, 4, 5 };
|
|
//same as
|
|
int[] intArray = new int[]{ 1, 2, 3, 4, 5 };
|
|
//same as
|
|
int[] intArray = { 1, 2, 3, 4, 5 };
|
|
|
|
//Arrays are zero-based
|
|
string[] stringArr = new string[5];
|
|
stringArr[0] = "string";
|
|
"""
|
|
|
|
# samples['cg'] = """
|
|
# samples['changelog'] = """
|
|
# samples['chdr'] = """
|
|
# samples['cmake'] = """
|
|
# samples['cobol'] = """
|
|
# samples['cpp'] = """
|
|
# samples['css'] = """
|
|
# samples['cuda'] = """
|
|
# samples['d'] = """
|
|
# samples['def'] = """
|
|
# samples['desktop'] = """
|
|
|
|
samples['diff'] = """
|
|
--- xinetd.d/tftp 2003-12-17 13:11:20.000000000 -0500
|
|
+++ ./tftp 2004-01-22 11:46:14.479497688 -0500
|
|
@@ -10,7 +10,7 @@
|
|
wait = yes
|
|
user = root
|
|
server = /usr/sbin/in.tftpd
|
|
- server_args = -s /tftpboot
|
|
+ server_args = -p -u tftpd -s /tftpboot
|
|
disable = yes
|
|
per_source = 11
|
|
cps = 100 2
|
|
"""
|
|
# samples['docbook'] = """
|
|
# samples['dosbatch'] = """
|
|
# samples['dot'] = """
|
|
# samples['dpatch'] = """
|
|
# samples['dtd'] = """
|
|
# samples['eiffel'] = """
|
|
# samples['erlang'] = """
|
|
# samples['fcl'] = """
|
|
# samples['forth'] = """
|
|
# samples['fortran'] = """
|
|
# samples['fsharp'] = """
|
|
# samples['gap'] = """
|
|
# samples['gdb-log'] = """
|
|
# samples['gettext-translation'] = """
|
|
# samples['glsl'] = """
|
|
# samples['go'] = """
|
|
# samples['gtk-doc'] = """
|
|
# samples['gtkrc'] = """
|
|
# samples['haddock'] = """
|
|
# samples['haskell'] = """
|
|
# samples['haskell-literate'] = """
|
|
|
|
samples['html'] = """
|
|
<html>
|
|
<body>
|
|
|
|
<table border="1">
|
|
<caption>Monthly savings</caption>
|
|
<tr>
|
|
<th>Month</th>
|
|
<th>Savings</th>
|
|
</tr>
|
|
<tr>
|
|
<td>January</td>
|
|
<td>$100</td>
|
|
</tr>
|
|
<tr>
|
|
<td>February</td>
|
|
<td>$50</td>
|
|
</tr>
|
|
</table>
|
|
|
|
</body>
|
|
</html>
|
|
"""
|
|
|
|
# samples['idl'] = """
|
|
# samples['imagej'] = """
|
|
# samples['ini'] = """
|
|
samples['java'] = """
|
|
package com.itdominator.api;
|
|
|
|
|
|
import org.springframework.context.annotation.Bean;
|
|
import org.springframework.context.annotation.Primary;
|
|
import org.springframework.core.env.Environment;
|
|
import org.springframework.context.annotation.Configuration;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.jdbc.datasource.DriverManagerDataSource;
|
|
|
|
@Configuration
|
|
public class DataSourceConfig {
|
|
|
|
@Autowired
|
|
Environment env;
|
|
|
|
@Bean
|
|
@Primary
|
|
public javax.sql.DataSource dataSource() {
|
|
final DriverManagerDataSource dataSource = new DriverManagerDataSource();
|
|
dataSource.setDriverClassName(env.getProperty("driverClassName"));
|
|
dataSource.setUrl(env.getProperty("url"));
|
|
// dataSource.setUsername(env.getProperty("user"));
|
|
// dataSource.setPassword(env.getProperty("password"));
|
|
return dataSource;
|
|
}
|
|
}
|
|
|
|
"""
|
|
samples['js'] = """
|
|
const loadBackground = () => {
|
|
const bgElm = document.getElementById("bg");
|
|
const bgPath = getCookie('bgSlug');
|
|
|
|
if (!bgPath) {
|
|
const path = '/static/imgs/backgrounds/background.png';
|
|
setCookie('bgSlug', path);
|
|
setBackgroundElement(bgElm, path);
|
|
} else {
|
|
// NOTE: Probably in IFRAME and unloaded the background...
|
|
if (!bgElm) return ;
|
|
setBackgroundElement(bgElm, bgPath);
|
|
}
|
|
}
|
|
"""
|
|
|
|
samples['json'] = """
|
|
{
|
|
"load_defaults":false,
|
|
"config":{
|
|
"base_of_home":"",
|
|
"hide_hidden_files":"true",
|
|
"thumbnailer_path":"ffmpegthumbnailer",
|
|
"blender_thumbnailer_path":"",
|
|
"go_past_home":"true",
|
|
"lock_folder":"false",
|
|
"locked_folders":[
|
|
"venv",
|
|
"flasks"
|
|
],
|
|
"mplayer_options":"-quiet -really-quiet -xy 1600 -geometry 50%:50%",
|
|
"remux_folder_max_disk_usage":"8589934592",
|
|
"make_transparent":0,
|
|
"main_window_x":2288,
|
|
"main_window_y":199,
|
|
"main_window_min_width":720,
|
|
"main_window_min_height":480,
|
|
"main_window_width":800,
|
|
"main_window_height":600,
|
|
"application_dirs":[
|
|
"/usr/share/applications",
|
|
"/home/abaddon/.local/share/applications"
|
|
]
|
|
},
|
|
"filters":{
|
|
"meshs":[
|
|
".blend",
|
|
".dae",
|
|
".fbx",
|
|
".gltf",
|
|
".obj",
|
|
".stl"
|
|
],
|
|
"code":[
|
|
".cpp",
|
|
".css",
|
|
".c",
|
|
".go",
|
|
".pom"
|
|
]
|
|
},
|
|
"debugging":{
|
|
"ch_log_lvl":10,
|
|
"fh_log_lvl":20.0,
|
|
"target_file": null,
|
|
"is_debugging": true
|
|
}
|
|
}
|
|
"""
|
|
# samples['latex'] = """
|
|
# samples['libtool'] = """
|
|
# samples['lua'] = """
|
|
# samples['m4'] = """
|
|
# samples['makefile'] = """
|
|
# samples['mallard'] = """
|
|
# samples['markdown'] = """
|
|
# samples['matlab'] = """
|
|
# samples['nemerle'] = """
|
|
# samples['nsis'] = """
|
|
# samples['objc'] = """
|
|
# samples['objective-caml'] = """
|
|
# samples['objj'] = """
|
|
# samples['ocl'] = """
|
|
# samples['octave'] = """
|
|
# samples['ooc'] = """
|
|
# samples['opal'] = """
|
|
# samples['opencl'] = """
|
|
# samples['pascal'] = """
|
|
# samples['perl'] = """
|
|
|
|
samples['php'] = """
|
|
<?php
|
|
|
|
/* ygtyuy */
|
|
print 'hello world';
|
|
|
|
>
|
|
"""
|
|
# samples['pkgconfig'] = """
|
|
# samples['prolog'] = """
|
|
# samples['proto'] = """
|
|
|
|
samples['python'] = """
|
|
def on_save_clicked(self, param):
|
|
if not self.currentSchemeFile:
|
|
filename = runSaveAsDialog(self.window, self.entryId.get_text() + '.xml')
|
|
|
|
if filename and not '.' in os.path.basename(filename):
|
|
filename = filename + '.xml'
|
|
|
|
if filename:
|
|
self.write_scheme(filename, self.entryId.get_text())
|
|
self.currentSchemeFile = filename
|
|
else:
|
|
self.write_scheme(self.currentSchemeFile, self.entryId.get_text())
|
|
|
|
# TODO handle case where there is a permissions issue
|
|
"""
|
|
|
|
samples['python3'] = """
|
|
def on_save_clicked(self, param):
|
|
if not self.currentSchemeFile:
|
|
filename = runSaveAsDialog(self.window, self.entryId.get_text() + '.xml')
|
|
|
|
if filename and not '.' in os.path.basename(filename):
|
|
filename = filename + '.xml'
|
|
|
|
if filename:
|
|
self.write_scheme(filename, self.entryId.get_text())
|
|
self.currentSchemeFile = filename
|
|
else:
|
|
self.write_scheme(self.currentSchemeFile, self.entryId.get_text())
|
|
|
|
# TODO handle case where there is a permissions issue
|
|
"""
|
|
|
|
# samples['r'] = """
|
|
# samples['rpmspec'] = """
|
|
# samples['ruby'] = """
|
|
# samples['scheme'] = """
|
|
# samples['scilab'] = """
|
|
# samples['sh'] = """
|
|
# samples['sml'] = """
|
|
# samples['sparql'] = """
|
|
# samples['sql'] = """
|
|
# samples['systemverilog'] = """
|
|
# samples['t2t'] = """
|
|
# samples['tcl'] = """
|
|
# samples['texinfo'] = """
|
|
# samples['vala'] = """
|
|
# samples['vbnet'] = """
|
|
# samples['verilog'] = """
|
|
# samples['vhdl'] = """
|
|
samples['xml'] = """
|
|
|
|
{% if current_directory %}
|
|
<nav class="navbar navbar-dark bg-dark navbar-expand-lg justify-content-center text-center fixed-bottom">
|
|
<div class="container-fluid">
|
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarTogglerFooter"
|
|
aria-controls="navbarTogglerFooter" aria-expanded="false" aria-label="Toggle Footer Navigation">
|
|
<span class="navbar-toggler-icon"></span>
|
|
</button>
|
|
|
|
<div id="navbarTogglerFooter" class="row collapse navbar-collapse">
|
|
<ul class="navbar-nav">
|
|
<li class="nav-item mx-3">
|
|
<span id="tggl-faves-btn" class="btn btn-secondary btn-sm" title="Add/Delete from favorites..." >☆</span>
|
|
</li>
|
|
<li class="nav-item mx-auto">
|
|
<span id="path">{{current_directory}}</span>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
{% endif %}
|
|
|
|
|
|
"""
|
|
# samples['xslt'] = """
|
|
# samples['yacc'] = """
|