Merge lp:~mefrio-g/scratch/bug-139057 into lp:~elementary-apps/scratch/scratch

Proposed by Mario Guerriero
Status: Rejected
Rejected by: Gero.Bare
Proposed branch: lp:~mefrio-g/scratch/bug-139057
Merge into: lp:~elementary-apps/scratch/scratch
Diff against target: 165 lines (+122/-0)
4 files modified
CMakeLists.txt (+2/-0)
data/language-specs/mustache.lang (+109/-0)
src/Services/Document.vala (+10/-0)
src/config.vala.cmake (+1/-0)
To merge this branch: bzr merge lp:~mefrio-g/scratch/bug-139057
Reviewer Review Type Date Requested Status
Gero.Bare (community) Disapprove
Review via email: mp+278195@code.launchpad.net

Description of the change

Fix bug #139057

Make adding support for new languages easier. You just need to add the .lang file in the data/language-specs if you want to add support for a new language.

To post a comment you must log in.
lp:~mefrio-g/scratch/bug-139057 updated
1594. By Mario Guerriero

using personal language-specs folder

Revision history for this message
Gero.Bare (gero-bare) wrote :

Ok this seems to work fine, but it's missing something important.
A license.

The first time I saw it, I missed it, but there's no license.
The license needs to be free software (or equivalent that allow redistribution, modify, etc).

Contact the creator, we don't need a permission, that wont work we need a free license (or equivalent, MIT, apache, lgpl, gpl3, BSD).

The lang spec, needs to have the copyright notice, and if the license is not gpl 2, it should be packed with scratch... that part goes beyond my knowledge so you will need to ask ric*tz, or c*dy, or daniel.

Also I didn't know you only need it to copy the lang spec file to /home/<user>/.local/share/gtksourceview-3.0/language-specs

Which defeat most of the purpose of this. I don't know, we might need to discuss this part further.

review: Needs Fixing
Revision history for this message
Gero.Bare (gero-bare) wrote :

Ok, I don't think this is a good Idea.

I discussed this, the proper action is to add the file to GtkSourceView, and not here.

The license issue remains, so if you want to add it to Gtksourceview you have 2 path.
Contact the people of GtkSourceview, or convince some one that is responsible to pack Gtksourceview for elementary to be added there.

Ideally this should be fixed upstream.

I need to disapprove this.

review: Disapprove
Revision history for this message
Mario Guerriero (mefrio-g) wrote :

Thanks for the review. I posted a patch for the upstream project.

https://bugzilla.gnome.org/show_bug.cgi?id=741626

Unmerged revisions

1594. By Mario Guerriero

using personal language-specs folder

1593. By Mario Guerriero

fixed #1390577

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2015-09-01 09:34:28 +0000
+++ CMakeLists.txt 2015-11-21 15:15:56 +0000
@@ -6,6 +6,7 @@
6enable_testing ()6enable_testing ()
7include (GNUInstallDirs)7include (GNUInstallDirs)
8set (DATADIR "${CMAKE_INSTALL_FULL_DATAROOTDIR}/scratch")8set (DATADIR "${CMAKE_INSTALL_FULL_DATAROOTDIR}/scratch")
9set (LANGUAGE_SPECS_DIR "${DATADIR}/language-specs")
9set (SCRIPTDIR "${CMAKE_INSTALL_FULL_DATAROOTDIR}/scratch/scripts")10set (SCRIPTDIR "${CMAKE_INSTALL_FULL_DATAROOTDIR}/scratch/scripts")
10set (PKGDATADIR "${DATADIR}/scratch")11set (PKGDATADIR "${DATADIR}/scratch")
11set (GETTEXT_PACKAGE "scratch-text-editor")12set (GETTEXT_PACKAGE "scratch-text-editor")
@@ -101,3 +102,4 @@
101102
102# Data103# Data
103install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/scratch-text-editor.desktop DESTINATION ${CMAKE_INSTALL_FULL_DATAROOTDIR}/applications)104install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/scratch-text-editor.desktop DESTINATION ${CMAKE_INSTALL_FULL_DATAROOTDIR}/applications)
105install (DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data/language-specs DESTINATION ${DATADIR})
104106
=== added directory 'data/language-specs'
=== added file 'data/language-specs/mustache.lang'
--- data/language-specs/mustache.lang 1970-01-01 00:00:00 +0000
+++ data/language-specs/mustache.lang 2015-11-21 15:15:56 +0000
@@ -0,0 +1,109 @@
1<?xml version="1.0" encoding="UTF-8"?> <!--
2
3 ╔══════════════════════════════════════════════════════════╗
4 ║ Author: denim2x <https://github.com/denim2x> ║
5 ╟──────────────────────────────────────────────────────────╢
6 ║ This file provides syntax highlighting for the Mustache ║
7 ║ language within editors based on GtkSourceView; based on ║
8 ║ asp.lang <https://goo.gl/1lrGu6>. ║
9 ╚══════════════════════════════════════════════════════════╝
10
11-->
12<language id="mustache" _name="Mustache" version="2.0" _section="Markup">
13 <metadata>
14 <property name="mimetypes">text/x-handlebars-template;text/html</property>
15 <property name="globs">*.handlebars;*.hbs;*.hgn;*.hjs;*.mu;*.mustache;*.stache</property>
16 <property name="block-comment-start">{{!</property>
17 <property name="block-comment-end">}}</property>
18 </metadata>
19
20 <styles>
21 <style id="comment" _name="Comment" map-to="def:comment" />
22 <style id="delimiter" _name="Delimiter" map-to="def:type" />
23 <style id="key" _name="Key" map-to="def:identifier" />
24 <style id="operator" _name="Operator" map-to="def:operator" />
25 <style id="partial" _name="Partial" map-to="def:preprocessor" />
26 <style id="section" _name="Section" map-to="def:statement" />
27 <style id="tag" _name="Tag" map-to="def:keyword" />
28 <style id="variable" _name="Variable" map-to="def:function" />
29 <style id="unescaped" _name="Unescaped" map-to="def:constant" />
30 </styles>
31
32 <definitions>
33 <context id="comment" style-ref="comment">
34 <start>\{\{\!</start>
35 <end>\}\}</end>
36 <include>
37 <context ref="def:in-comment"/>
38 </include>
39 </context>
40
41 <context id="delimiter" style-ref="delimiter">
42 <start>\{\{=</start>
43 <end>=\}\}</end>
44 <include>
45 <context ref="def:string"/>
46 </include>
47 </context>
48
49 <context id="key" style-ref="key">
50 <match>[a-zA-Z_][a-zA-Z0-9_]*</match>
51 </context>
52
53 <context id="partial" style-ref="partial">
54 <start>\{\{&gt;</start>
55 <end>\}\}</end>
56 <include>
57 <context ref="key"/>
58 </include>
59 </context>
60
61 <context id="section" style-ref="section">
62 <start>\{\{([#^/])</start>
63 <end>(\?)?\}\}</end>
64 <include>
65 <context sub-pattern="0" where="start" style-ref="operator"/>
66 <context sub-pattern="0" where="end" style-ref="operator"/>
67 <context ref="key"/>
68 </include>
69 </context>
70
71 <context id="unescaped" style-ref="unescaped">
72 <start>\{\{\{</start>
73 <end>\}\}\}</end>
74 <include>
75 <context ref="key"/>
76 </include>
77 </context>
78
79 <context id="unescaped-amp" style-ref="unescaped">
80 <start>\{\{&amp;</start>
81 <end>\}\}</end>
82 <include>
83 <context ref="key"/>
84 </include>
85 </context>
86
87 <context id="variable" style-ref="variable">
88 <start>\{\{</start>
89 <end>\}\}</end>
90 <include>
91 <context ref="key"/>
92 </include>
93 </context>
94
95 <context id="mustache" class="no-spell-check">
96 <include>
97 <context ref="comment" />
98 <context ref="delimiter" />
99 <context ref="partial" />
100 <context ref="section" />
101 <context ref="unescaped" />
102 <context ref="unescaped-amp" />
103 <context ref="variable" />
104 <context ref="html:html" />
105 </include>
106 </context>
107
108 </definitions>
109</language>
0\ No newline at end of file110\ No newline at end of file
1111
=== modified file 'src/Services/Document.vala'
--- src/Services/Document.vala 2015-09-16 01:11:55 +0000
+++ src/Services/Document.vala 2015-11-21 15:15:56 +0000
@@ -90,6 +90,16 @@
90 this.main_actions = actions;90 this.main_actions = actions;
91 this.file = file;91 this.file = file;
9292
93 // Change directories list where gtksourceview looks for language files
94 Gtk.SourceLanguageManager manager = Gtk.SourceLanguageManager.get_default ();
95 string[] search_path = manager.get_search_path ();
96 string[] custom_search_path = new string[search_path.length + 1];
97 int i;
98 for (i = 0; i < search_path.length; i++)
99 custom_search_path[i] = search_path[i];
100 custom_search_path[i] = Constants.LANGUAGE_SPECS_DIR;
101 manager.set_search_path (custom_search_path);
102
93 open.begin ();103 open.begin ();
94 }104 }
95105
96106
=== modified file 'src/config.vala.cmake'
--- src/config.vala.cmake 2014-11-12 11:20:08 +0000
+++ src/config.vala.cmake 2015-11-21 15:15:56 +0000
@@ -8,6 +8,7 @@
8 public const string VERSION_INFO = "@VERSION_INFO@";8 public const string VERSION_INFO = "@VERSION_INFO@";
9 public const string PLUGINDIR = "@PLUGINDIR@";9 public const string PLUGINDIR = "@PLUGINDIR@";
10 public const string INSTALL_PREFIX = "@CMAKE_INSTALL_PREFIX@";10 public const string INSTALL_PREFIX = "@CMAKE_INSTALL_PREFIX@";
11 public const string LANGUAGE_SPECS_DIR = "@LANGUAGE_SPECS_DIR@";
1112
12 /* Translatable launcher (.desktop) strings to be added to */13 /* Translatable launcher (.desktop) strings to be added to */
13 /* template (.pot) file. These strings should reflect any */14 /* template (.pot) file. These strings should reflect any */

Subscribers

People subscribed via source and target branches