", new Options());
52 | assertEquals("takezoe@gmail.com
", result);
53 | }
54 |
55 | @Test
56 | public void testReflink() throws Exception {
57 | String result = Marked.marked("[FOO], [bar][Foo], [Bar]\n\n[Foo]: http://example.com");
58 | assertEquals("FOO, bar, [Bar]
", result);
59 | }
60 |
61 | @Test
62 | public void testIns() throws Exception {
63 | String result = Marked.marked("~~123~~");
64 | assertEquals("\n 123
", result);
65 | }
66 |
67 | @Test
68 | public void testStrong() throws Exception {
69 | String result = Marked.marked("**123**");
70 | assertEquals("123
", result);
71 | }
72 |
73 | @Test
74 | public void testEm() throws Exception {
75 | {
76 | String result = Marked.marked("_aa__a__aa_", new Options());
77 | assertEquals("aaaaa
", result);
78 | }
79 | {
80 | String result = Marked.marked("*aa*o*aa*", new Options());
81 | assertEquals("aaoaa
", result);
82 | }
83 | {
84 | String result = Marked.marked("_aa__aa_", new Options());
85 | assertEquals("aa__aa
", result);
86 | }
87 | }
88 |
89 | @Test
90 | public void testStackoverFlow() throws Exception {
91 | Marked.marked(loadResourceAsString("stackoverflow.txt"), new Options());
92 | }
93 |
94 | @Test
95 | public void testStackoverFlow2() throws Exception {
96 | Marked.marked(loadResourceAsString("stackoverflow2.txt"), new Options());
97 | }
98 |
99 | @Test
100 | public void testNptable() throws Exception {
101 | String result = Marked.marked(loadResourceAsString("nptable.md"), new Options());
102 | String expect = loadResourceAsString("nptable.html");
103 | assertEquals(expect, result);
104 | }
105 |
106 | @Test
107 | public void testBreaks() throws Exception {
108 | {
109 | String md = "first line\nsecond line";
110 | Options options = new Options();
111 | //options.setBreaks(false); // default is false
112 | //options.setGfm(true); // default is true
113 | String result = Marked.marked(md, options);
114 |
115 | assertEquals("first line second line
", result);
116 | }
117 | {
118 | String md = "first line\nsecond line";
119 | Options options = new Options();
120 | options.setBreaks(true);
121 | //options.setGfm(true); // default is true
122 | String result = Marked.marked(md, options);
123 |
124 | assertEquals("first line
\n second line
", result);
125 | }
126 | }
127 |
128 | @Test
129 | public void testInvalidColumnTable() throws Exception {
130 | {
131 | String result = Marked.marked(loadResourceAsString("table.md"), new Options());
132 | assertEquals(loadResourceAsString("table.html"), result);
133 | }
134 | }
135 |
136 | @Test
137 | public void testCodeBlock() throws Exception {
138 | String result = Marked.marked(
139 | " public class HelloWorld {\n" +
140 | " }", new Options());
141 | assertEquals(
142 | "public class HelloWorld {\n" +
143 | "}\n" +
144 | "
", result);
145 | }
146 |
147 | @Test
148 | public void testFencedCodeBlock() throws Exception {
149 | String md = "``` {#id .class1 attribute1=value1}\ntest\n```";
150 | String result = Marked.marked(md, new Options());
151 | String expect = "test\n
";
152 | assertEquals(expect, result);
153 | }
154 |
155 | @Test
156 | public void testEmptyItemOfList() throws Exception {
157 | String result = Marked.marked(loadResourceAsString("empty_item_of_list.md"), new Options());
158 | assertEquals(loadResourceAsString("empty_item_of_list.html"), result);
159 | }
160 |
161 | @Test
162 | public void testParagraphSeparation() throws Exception {
163 | String result = Marked.marked(
164 | "Message A\n" +
165 | "- List A\n" +
166 | "- List B", new Options());
167 |
168 | assertEquals(
169 | "Message A
\n" +
170 | "\n" +
171 | " - List A
\n" +
172 | " - List B
\n" +
173 | "
", result);
174 | }
175 |
176 | @Test
177 | public void testNestedContentOfList() throws Exception {
178 | String result = Marked.marked(loadResourceAsString("nested_content_of_list.md"), new Options());
179 | assertEquals(loadResourceAsString("nested_content_of_list.html"), result);
180 | }
181 |
182 | @Test
183 | public void testEmptyTableCell() throws Exception {
184 | String result = Marked.marked(
185 | "|ID|name|note|\n" +
186 | "|-|-|-|\n" +
187 | "|1|foo|This is foo|\n" +
188 | "|2|bar||");
189 |
190 |
191 | assertEquals(
192 | "\n" +
193 | " \n" +
194 | " \n" +
195 | " | ID | \n" +
196 | " name | \n" +
197 | " note | \n" +
198 | "
\n" +
199 | " \n" +
200 | " \n" +
201 | " \n" +
202 | " | 1 | \n" +
203 | " foo | \n" +
204 | " This is foo | \n" +
205 | "
\n" +
206 | " \n" +
207 | " | 2 | \n" +
208 | " bar | \n" +
209 | " | \n" +
210 | "
\n" +
211 | " \n" +
212 | "
", result);
213 | }
214 |
215 | @Test
216 | public void testSanitize() throws Exception {
217 | {
218 | Options options = new Options();
219 | options.setSanitize(true);
220 | String result = Marked.marked("bold", options);
221 | assertEquals("<b>bold</b><script>alert('test!');</script>
", result);
222 | }
223 | {
224 | Options options = new Options();
225 | options.setSanitize(false);
226 | String result = Marked.marked("bold", options);
227 | assertEquals("bold
", result);
228 | }
229 | {
230 | Options options = new Options();
231 | options.setSanitize(false);
232 | String result = Marked.marked("- test", options);
233 | // It's not clean but tag is closed at least.
234 | assertEquals("\n" +
235 | " - test
\n" +
236 | "
", result);
237 | }
238 | }
239 |
240 | @Test
241 | public void testHr() throws Exception {
242 | String result = Marked.marked(
243 | "This is a paragraph\n" +
244 | "\n" +
245 | "--------------------------\n" +
246 | "This is a paragraph after a horizontal rule");
247 |
248 | assertEquals("This is a paragraph
\n" +
249 | "
\n" +
250 | "This is a paragraph after a horizontal rule
", result);
251 | }
252 |
253 | private String loadResourceAsString(String path) throws IOException {
254 | InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(path);
255 | try {
256 | ByteArrayOutputStream out = new ByteArrayOutputStream();
257 | byte[] buf = new byte[1024 * 8];
258 | int length = 0;
259 | while((length = in.read(buf)) != -1){
260 | out.write(buf, 0, length);
261 | }
262 | return new String(out.toByteArray(), "UTF-8");
263 | } finally {
264 | in.close();
265 | }
266 | }
267 |
268 | @Test
269 | public void testHardLineBreakWithSpaces() {
270 | String result = Marked.marked("Line 1 \n" +
271 | "Line 2");
272 | assertEquals("Line 1
\n" +
273 | " Line 2
", result);
274 | }
275 |
276 | @Test
277 | public void testHardLineBreakWithBackslash() {
278 | String result = Marked.marked("Line 1\\\n" +
279 | "Line 2");
280 | assertEquals("Line 1
\n" +
281 | " Line 2
", result);
282 | }
283 | }
284 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "{}"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright {yyyy} {name of copyright owner}
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
203 |
--------------------------------------------------------------------------------
/src/test/resources/gitbucket.md:
--------------------------------------------------------------------------------
1 | GitBucket [](https://gitter.im/takezoe/gitbucket) [](https://travis-ci.org/takezoe/gitbucket)
2 | =========
3 |
4 | GitBucket is the easily installable GitHub clone powered by Scala.
5 |
6 |
7 | Features
8 | --------
9 | The current version of GitBucket provides a basic features below:
10 |
11 | - Public / Private Git repository (http and ssh access)
12 | - Repository viewer and online file editing
13 | - Repository search (Code and Issues)
14 | - Wiki
15 | - Issues
16 | - Fork / Pull request
17 | - Email notification
18 | - Activity timeline
19 | - Simple user and group management with LDAP integration
20 | - Gravatar support
21 | - Plug-in system
22 |
23 | Following features are not implemented, but we will make them in the future release!
24 |
25 | - Network graph
26 | - Statistics
27 | - Watch / Star
28 |
29 | If you want to try the development version of GitBucket, see the documentation for developers at [Wiki](https://github.com/takezoe/gitbucket/wiki).
30 |
31 | Installation
32 | --------
33 |
34 | 1. Download latest **gitbucket.war** from [the release page](https://github.com/takezoe/gitbucket/releases).
35 | 2. Deploy it to the Servlet 3.0 container such as Tomcat 7.x, Jetty 8.x, GlassFish 3.x or higher.
36 | 3. Access **http://[hostname]:[port]/gitbucket/** using your web browser.
37 |
38 | If you are using Gitbucket behind a webserver please make sure you have increased the **client_max_body_size** (on nginx)
39 |
40 | The default administrator account is **root** and password is **root**.
41 |
42 | or you can start GitBucket by `java -jar gitbucket.war` without servlet container. In this case, GitBucket URL is **http://[hostname]:8080/**. You can specify following options.
43 |
44 | - --port=[NUMBER]
45 | - --prefix=[CONTEXTPATH]
46 | - --host=[HOSTNAME]
47 | - --gitbucket.home=[DATA_DIR]
48 |
49 | To upgrade GitBucket, only replace gitbucket.war. All GitBucket data is stored in HOME/.gitbucket. So if you want to back up GitBucket data, copy this directory to the other disk.
50 |
51 | For Installation on Windows Server with IIS see [this wiki page](https://github.com/takezoe/gitbucket/wiki/Installation-on-IIS-and-Helicontech-Zoo)
52 |
53 | ### Mac OS X
54 | #### Installing Via Homebrew
55 |
56 | ```
57 | $ brew install gitbucket
58 | ==> Downloading https://github.com/takezoe/gitbucket/releases/download/1.10/gitbucket.war
59 | ######################################################################## 100.0%
60 | ==> Caveats
61 | Note: When using launchctl the port will be 8080.
62 |
63 | To have launchd start gitbucket at login:
64 | ln -sfv /usr/local/opt/gitbucket/*.plist ~/Library/LaunchAgents
65 | Then to load gitbucket now:
66 | launchctl load ~/Library/LaunchAgents/homebrew.mxcl.gitbucket.plist
67 | Or, if you don't want/need launchctl, you can just run:
68 | java -jar /usr/local/opt/gitbucket/libexec/gitbucket.war
69 | ==> Summary
70 | /usr/local/Cellar/gitbucket/1.10: 3 files, 42M, built in 11 seconds
71 | ```
72 |
73 | #### Manual Installation
74 | On OS X, copy the [gitbucket.plist](https://raw.github.com/takezoe/gitbucket/master/contrib/macosx/gitbucket.plist) file to `~/Library/LaunchAgents/`
75 |
76 | Run the following commands in `Terminal` to
77 |
78 | - start gitbucket: `launchctl load ~/Library/LaunchAgents/gitbucket.plist`
79 | - stop gitbucket: `launchctl unload ~/Library/LaunchAgents/gitbucket.plist`
80 |
81 | Plug-ins
82 | --------
83 | GitBucket has the plug-in system to extend GitBucket from outside of GitBucket. Some plug-ins are available now:
84 |
85 | - [gitbucket-gist-plugin](https://github.com/takezoe/gitbucket-gist-plugin)
86 | - [gitbucket-announce-plugin](https://github.com/McFoggy/gitbucket-announce-plugin)
87 | - [gitbucket-h2-backup-plugin](https://github.com/McFoggy/gitbucket-h2-backup-plugin)
88 | - [gitbucket-desktopnotify-plugin](https://github.com/yoshiyoshifujii/gitbucket-desktopnotify-plugin)
89 |
90 | You can find community plugins other than them at [gitbucket community plugins](http://gitbucket-plugins.github.io/).
91 |
92 | Release Notes
93 | --------
94 | ### 3.6 - 30 Aug 2015
95 | - User interface Improvements: Especially, commit list, issues and pull request have been updated largely.
96 | - Installed plugins list has been available at the system administration console.
97 | - Pages and repository list in the sidebar have been limited and more pages and repositories link is available.
98 | - More reference link notation in Markdown has been supported.
99 |
100 | ### 3.5 - 1 Aug 2015
101 | - Octicons has been applied
102 | - Global header has been enhanced. Now it's further similar to GitHub.
103 | - Default compare / pull request target has been changed to the parent repository
104 | - A lot of updates for [gitbucket-gist-plugin](https://github.com/takezoe/gitbucket-gist-plugin)
105 |
106 | ### 3.4 - 27 Jun 2015
107 | - Declarative style plug-in definition
108 | - New extension point to add markup render
109 | - go-import support
110 |
111 | ### 3.3 - 31 May 2015
112 | - Rich graphical diff for images
113 | - File finder is available in the repository viewer
114 | - Blame is displayed at the source viewer
115 | - Remain user data and repositories even if user is disabled
116 | - Mobile view improvement
117 |
118 | ### 3.2 - 3 May 2015
119 | - Directory history button
120 | - Compare / pull request button
121 | - Limit of activity log
122 |
123 | ### 3.1.1 - 4 Apr 2015
124 | - Rolled back H2 version to avoid version compatibility issue
125 | - Plug-ins became possible to access ServletContext
126 |
127 | ### 3.1 - 28 Mar 2015
128 | - Web APIs for Jenkins github pull-request builder
129 | - Improved diff view
130 | - Bump Scalatra to 2.3.1, sbt to 0.13.8
131 |
132 | ### 3.0 - 3 Mar 2015
133 | - New plug-in system is available
134 | - Connection pooling by c3p0
135 | - New branch UI
136 | - Compare between specified commit ids
137 |
138 | ### 2.8 - 1 Feb 2015
139 | - New logo and icons
140 | - New system setting options to control visibility
141 | - Comment on side-by-side diff
142 | - Information message on sign-in page
143 | - Fork repository by group account
144 |
145 | ### 2.7 - 29 Dec 2014
146 | - Comment for commit and diff
147 | - Fix security issue in markdown rendering
148 | - Some bug fix and improvements
149 |
150 | ### 2.6 - 24 Nov 2014
151 | - Search box at issues and pull requests
152 | - Information from administrator
153 | - Pull request UI has been updated
154 | - Move to TravisCI from Buildhive
155 | - Some bug fix and improvements
156 |
157 | ### 2.5 - 4 Nov 2014
158 | - New Dashboard
159 | - Change datetime format
160 | - Create branch from Web UI
161 | - Task list in Markdown
162 | - Some bug fix and improvements
163 |
164 | ### 2.4.1 - 6 Oct 2014
165 | - Bug fix
166 |
167 | ### 2.4 - 6 Oct 2014
168 | - New UI is applied to Issues and Pull requests
169 | - Side-by-side diff is available
170 | - Fix relative path problem in Markdown links and images
171 | - Plugin System is disabled in default
172 | - Some bug fix and improvements
173 |
174 | ### 2.3 - 1 Sep 2014
175 | - Scala based plugin system
176 | - Embedded Jetty war extraction directory moved to `GITBUCKET_HOME/tmp`
177 | - Some bug fix and improvements
178 |
179 | ### 2.2.1 - 5 Aug 2014
180 | - Bug fix
181 |
182 | ### 2.2 - 4 Aug 2014
183 | - Plug-in system is available
184 | - Move to Scala 2.11, Scalatra 2.3 and Slick 2.1
185 | - tar.gz export for repository contents
186 | - LDAP authentication improvement (mail address became optional)
187 | - Show news feed of a private repository to members
188 | - Some bug fix and improvements
189 |
190 | ### 2.1 - 6 Jul 2014
191 | - Upgrade to Slick 2.0 from 1.9
192 | - Base part of the plug-in system is merged
193 | - Many bug fix and improvements
194 |
195 | ### 2.0 - 31 May 2014
196 | - Modern Github UI
197 | - Preview in AceEditor
198 | - Select lines by clicking line number in blob view
199 |
200 | ### 1.13 - 29 Apr 2014
201 | - Direct file editing in the repository viewer using AceEditor
202 | - File attachment for issues
203 | - Atom feed of user activity
204 | - Fix some bugs
205 |
206 | ### 1.12 - 29 Mar 2014
207 | - SSH repository access is available
208 | - Allow users can create and management their groups
209 | - Git submodule support
210 | - Close issues via commit messages
211 | - Show repository description below the name on repository page
212 | - Fix presentation of the source viewer
213 | - Upgrade to sbt 0.13
214 | - Fix some bugs
215 |
216 | ### 1.11.1 - 06 Mar 2014
217 | - Bug fix
218 |
219 | ### 1.11 - 01 Mar 2014
220 | - Base URL for redirection, notification and repository URL box is configurable
221 | - Remove ```--https``` option because it's possible to substitute in the base url
222 | - Headline anchor is available for Markdown contents such as Wiki page
223 | - Improve H2 connectivity
224 | - Label is available for pull requests not only issues
225 | - Delete branch button is added
226 | - Repository icons are updated
227 | - Select lines of source code by URL hash like `#L10` or `#L10-L15` in repository viewer
228 | - Display reference to issue from others in comment list
229 | - Fix some bugs
230 |
231 | ### 1.10 - 01 Feb 2014
232 | - Rename repository
233 | - Transfer repository owner
234 | - Change default data directory to `HOME/.gitbucket` from `HOME/gitbucket` to avoid problem like #243, but if data directory already exist at HOME/gitbucket, it continues being used.
235 | - Add LDAP display name attribute
236 | - Response performance improvement
237 | - Fix some bugs
238 |
239 | ### 1.9 - 28 Dec 2013
240 | - Display GITBUCKET_HOME on the system settings page
241 | - Fix some bugs
242 |
243 | ### 1.8 - 30 Nov 2013
244 | - Add user and group deletion
245 | - Improve pull request performance
246 | - Pull request synchronization (when source repository is updated after pull request, it's applied to the pull request)
247 | - LDAP StartTLS support
248 | - Enable hard wrapping in Markdown
249 | - Add new some options to specify the data directory. See details in [Wiki](https://github.com/takezoe/gitbucket/wiki/DirectoryStructure).
250 | - Fix some bugs
251 |
252 | ### 1.7 - 26 Oct 2013
253 | - Support working on Java6 in embedded Jetty mode
254 | - Add `--host` option to bind specified host name in embedded Jetty mode
255 | - Add `--https=true` option to force https scheme when using embedded Jetty mode at the back of https proxy
256 | - Add full name as user property
257 | - Change link color for absent Wiki pages
258 | - Add ZIP download button to the repository viewer tab
259 | - Improve ZIP exporting performance
260 | - Expand issue and comment textarea for long text automatically
261 | - Add conflict detection in Wiki
262 | - Add reverting wiki page from history
263 | - Match committer to user name by email address
264 | - Mail notification sender is customizable
265 | - Add link to changeset in refs comment for issues
266 | - Fix some bugs
267 |
268 | ### 1.6 - 1 Oct 2013
269 | - Web hook
270 | - Performance improvement for pull request
271 | - Executable war file
272 | - Specify suitable Content-Type for downloaded files in the repository viewer
273 | - Fix some bugs
274 |
275 | ### 1.5 - 4 Sep 2013
276 | - Fork and pull request
277 | - LDAP authentication
278 | - Mail notification
279 | - Add an option to turn off the gravatar support
280 | - Add the branch tab in the repository viewer
281 | - Encoding auto detection for the file content in the repository viewer
282 | - Add favicon, header logo and icons for the timeline
283 | - Specify data directory via environment variable GITBUCKET_HOME
284 | - Fix some bugs
285 |
286 | ### 1.4 - 31 Jul 2013
287 | - Group management
288 | - Repository search for code and issues
289 | - Display user related issues on the dashboard
290 | - Display participants avatar of issues on the issue page
291 | - Performance improvement for repository viewer
292 | - Alert by milestone due date
293 | - H2 database administration console
294 | - Fix some bugs
295 |
296 | ### 1.3 - 18 Jul 2013
297 | - Batch updating for issues
298 | - Display assigned user on issue list
299 | - User icon and Gravatar support
300 | - Convert @xxxx to link to the account page
301 | - Add copy to clipboard button for git clone URL
302 | - Allow multi-byte characters as wiki page name
303 | - Allow to create the empty repository
304 | - Fix some bugs
305 |
306 | ### 1.2 - 09 Jul 2013
307 | - Add activity timeline
308 | - Bugfix for Git 1.8.1.5 or later
309 | - Allow multi-byte characters as label
310 | - Fix some bugs
311 |
312 | ### 1.1 - 05 Jul 2013
313 | - Fix some bugs
314 | - Upgrade to JGit 3.0
315 |
316 | ### 1.0 - 04 Jul 2013
317 | - This is a first public release
318 |
319 | Sponsors
320 | --------
321 | [](https://www.jetbrains.com/idea/)
322 |
--------------------------------------------------------------------------------
/src/test/resources/stackoverflow.txt:
--------------------------------------------------------------------------------
1 | 2015-10-10 08:25:23,915 INFO [org.jboss.modules] (main) JBoss Modules version 1.4.3.Final
2 | 2015-10-10 08:25:24,262 INFO [org.jboss.msc] (main) JBoss MSC version 1.2.6.Final
3 | 2015-10-10 08:25:24,359 INFO [org.jboss.as] (MSC service thread 1-7) WFLYSRV0049: WildFly Full 9.0.1.Final (WildFly Core 1.0.1.Final) starting
4 | 2015-10-10 08:25:24,362 DEBUG [org.jboss.as.config] (MSC service thread 1-7) Configured system properties:
5 | awt.toolkit = sun.awt.windows.WToolkit
6 | file.encoding = MS932
7 | file.encoding.pkg = sun.io
8 | file.separator = \
9 | java.awt.graphicsenv = sun.awt.Win32GraphicsEnvironment
10 | java.awt.printerjob = sun.awt.windows.WPrinterJob
11 | java.class.path = C:\work\wildfly-9.0.1.Final\wildfly-9.0.1.Final\jboss-modules.jar
12 | java.class.version = 52.0
13 | java.endorsed.dirs = C:\work\Java\jdk1.8.0_51\jre\lib\endorsed
14 | java.ext.dirs = C:\work\Java\jdk1.8.0_51\jre\lib\ext;C:\WINDOWS\Sun\Java\lib\ext
15 | java.home = C:\work\Java\jdk1.8.0_51\jre
16 | java.io.tmpdir = C:\Users\testuser\AppData\Local\Temp\
17 | java.library.path = C:\work\Java\jdk1.8.0_51\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\ProgramData\Oracle\Java\javapath;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\ATI Stream\bin\x86_64;C:\Program Files (x86)\ATI Stream\bin\x86;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\WIDCOMM\Bluetooth Software\;C:\Program Files\WIDCOMM\Bluetooth Software\syswow64;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\Sony\VAIO Improvement;C:\Program Files (x86)\Justsystems\JSLIB32\;C:\Program Files (x86)\Sony\VAIO Startup Setting Tool;C:\Program Files (x86)\Common Files\Roxio Shared\10.0\DLLShared\;C:\Program Files (x86)\Common Files\Roxio Shared\DLLShared\;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;C:\work\Java\jdk1.8.0_51\bin;C:\work\gradle\gradle-2.3\bin;C:\WINDOWS\system32\config\systemprofile\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Program Files (x86)\nodejs\;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;C:\Program Files (x86)\Microsoft SQL Server\130\DTS\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;C:\Users\testuser\AppData\Roaming\npm;C:\Users\testuser\AppData\Local\atom\bin;.
18 | java.net.preferIPv4Stack = true
19 | java.runtime.name = Java(TM) SE Runtime Environment
20 | java.runtime.version = 1.8.0_51-b16
21 | java.specification.name = Java Platform API Specification
22 | java.specification.vendor = Oracle Corporation
23 | java.specification.version = 1.8
24 | java.util.logging.manager = org.jboss.logmanager.LogManager
25 | java.vendor = Oracle Corporation
26 | java.vendor.url = http://java.oracle.com/
27 | java.vendor.url.bug = http://bugreport.sun.com/bugreport/
28 | java.version = 1.8.0_51
29 | java.vm.info = mixed mode
30 | java.vm.name = Java HotSpot(TM) 64-Bit Server VM
31 | java.vm.specification.name = Java Virtual Machine Specification
32 | java.vm.specification.vendor = Oracle Corporation
33 | java.vm.specification.version = 1.8
34 | java.vm.vendor = Oracle Corporation
35 | java.vm.version = 25.51-b03
36 | javax.management.builder.initial = org.jboss.as.jmx.PluggableMBeanServerBuilder
37 | javax.xml.datatype.DatatypeFactory = __redirected.__DatatypeFactory
38 | javax.xml.parsers.DocumentBuilderFactory = __redirected.__DocumentBuilderFactory
39 | javax.xml.parsers.SAXParserFactory = __redirected.__SAXParserFactory
40 | javax.xml.stream.XMLEventFactory = __redirected.__XMLEventFactory
41 | javax.xml.stream.XMLInputFactory = __redirected.__XMLInputFactory
42 | javax.xml.stream.XMLOutputFactory = __redirected.__XMLOutputFactory
43 | javax.xml.transform.TransformerFactory = __redirected.__TransformerFactory
44 | javax.xml.validation.SchemaFactory:http://www.w3.org/2001/XMLSchema = __redirected.__SchemaFactory
45 | javax.xml.xpath.XPathFactory:http://java.sun.com/jaxp/xpath/dom = __redirected.__XPathFactory
46 | jboss.home.dir = C:\work\wildfly-9.0.1.Final\wildfly-9.0.1.Final
47 | jboss.host.name = vaioz
48 | jboss.modules.dir = C:\work\wildfly-9.0.1.Final\wildfly-9.0.1.Final\modules
49 | jboss.modules.system.pkgs = org.jboss.byteman
50 | jboss.node.name = vaioz
51 | jboss.qualified.host.name = vaioz
52 | jboss.server.base.dir = C:\work\wildfly-9.0.1.Final\wildfly-9.0.1.Final\standalone
53 | jboss.server.config.dir = C:\work\wildfly-9.0.1.Final\wildfly-9.0.1.Final\standalone\configuration
54 | jboss.server.data.dir = C:\work\wildfly-9.0.1.Final\wildfly-9.0.1.Final\standalone\data
55 | jboss.server.deploy.dir = C:\work\wildfly-9.0.1.Final\wildfly-9.0.1.Final\standalone\data\content
56 | jboss.server.log.dir = C:\work\wildfly-9.0.1.Final\wildfly-9.0.1.Final\standalone\log
57 | jboss.server.name = vaioz
58 | jboss.server.persist.config = true
59 | jboss.server.temp.dir = C:\work\wildfly-9.0.1.Final\wildfly-9.0.1.Final\standalone\tmp
60 | line.separator =
61 |
62 | logging.configuration = file:C:\work\wildfly-9.0.1.Final\wildfly-9.0.1.Final\standalone\configuration/logging.properties
63 | module.path = C:\work\wildfly-9.0.1.Final\wildfly-9.0.1.Final\modules
64 | org.jboss.boot.log.file = C:\work\wildfly-9.0.1.Final\wildfly-9.0.1.Final\standalone\log\server.log
65 | org.jboss.resolver.warning = true
66 | org.xml.sax.driver = __redirected.__XMLReaderFactory
67 | os.arch = amd64
68 | os.name = Windows 8.1
69 | os.version = 6.3
70 | path.separator = ;
71 | program.name = standalone.bat
72 | sun.arch.data.model = 64
73 | sun.boot.class.path = C:\work\Java\jdk1.8.0_51\jre\lib\resources.jar;C:\work\Java\jdk1.8.0_51\jre\lib\rt.jar;C:\work\Java\jdk1.8.0_51\jre\lib\sunrsasign.jar;C:\work\Java\jdk1.8.0_51\jre\lib\jsse.jar;C:\work\Java\jdk1.8.0_51\jre\lib\jce.jar;C:\work\Java\jdk1.8.0_51\jre\lib\charsets.jar;C:\work\Java\jdk1.8.0_51\jre\lib\jfr.jar;C:\work\Java\jdk1.8.0_51\jre\classes
74 | sun.boot.library.path = C:\work\Java\jdk1.8.0_51\jre\bin
75 | sun.cpu.endian = little
76 | sun.cpu.isalist = amd64
77 | sun.desktop = windows
78 | sun.io.unicode.encoding = UnicodeLittle
79 | sun.java.command = C:\work\wildfly-9.0.1.Final\wildfly-9.0.1.Final\jboss-modules.jar -mp C:\work\wildfly-9.0.1.Final\wildfly-9.0.1.Final\modules org.jboss.as.standalone -Djboss.home.dir=C:\work\wildfly-9.0.1.Final\wildfly-9.0.1.Final
80 | sun.java.launcher = SUN_STANDARD
81 | sun.jnu.encoding = MS932
82 | sun.management.compiler = HotSpot 64-Bit Tiered Compilers
83 | sun.os.patch.level =
84 | sun.stderr.encoding = ms932
85 | sun.stdout.encoding = ms932
86 | user.country = JP
87 | user.dir = C:\work\wildfly-9.0.1.Final\wildfly-9.0.1.Final\bin
88 | user.home = C:\Users\testuser
89 | user.language = ja
90 | user.name = testuser
91 | user.script =
92 | user.timezone = Asia/Tokyo
93 | user.variant =
94 | 2015-10-10 08:25:24,364 DEBUG [org.jboss.as.config] (MSC service thread 1-7) VM Arguments: -Dprogram.name=standalone.bat -Xms64M -Xmx512M -XX:MaxPermSize=256M -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Dorg.jboss.boot.log.file=C:\work\wildfly-9.0.1.Final\wildfly-9.0.1.Final\standalone\log\server.log -Dlogging.configuration=file:C:\work\wildfly-9.0.1.Final\wildfly-9.0.1.Final\standalone\configuration/logging.properties
95 | 2015-10-10 08:25:25,994 INFO [org.jboss.as.controller.management-deprecated] (ServerService Thread Pool -- 14) WFLYCTL0028: Attribute 'job-repository-type' in the resource at address '/subsystem=batch' is deprecated, and may be removed in future version. See the attribute description in the output of the read-resource-description operation to learn more about the deprecation.
96 | 2015-10-10 08:25:25,995 INFO [org.jboss.as.controller.management-deprecated] (ServerService Thread Pool -- 21) WFLYCTL0028: Attribute 'enabled' in the resource at address '/subsystem=datasources/data-source=ExampleDS' is deprecated, and may be removed in future version. See the attribute description in the output of the read-resource-description operation to learn more about the deprecation.
97 | 2015-10-10 08:25:26,063 INFO [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0039: Creating http management service using socket-binding (management-http)
98 | 2015-10-10 08:25:26,090 INFO [org.xnio] (MSC service thread 1-1) XNIO version 3.3.1.Final
99 | 2015-10-10 08:25:26,100 INFO [org.xnio.nio] (MSC service thread 1-1) XNIO NIO Implementation Version 3.3.1.Final
100 | 2015-10-10 08:25:26,167 INFO [org.wildfly.extension.io] (ServerService Thread Pool -- 37) WFLYIO001: Worker 'default' has auto-configured to 8 core threads with 64 task threads based on your 4 available processors
101 | 2015-10-10 08:25:26,206 INFO [org.jboss.as.connector] (MSC service thread 1-5) WFLYJCA0009: Starting JCA Subsystem (IronJacamar 1.2.4.Final)
102 | 2015-10-10 08:25:26,220 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 38) WFLYCLINF0001: Activating Infinispan subsystem.
103 | 2015-10-10 08:25:26,238 INFO [org.jboss.as.security] (ServerService Thread Pool -- 53) WFLYSEC0002: Activating Security Subsystem
104 | 2015-10-10 08:25:26,251 WARN [org.jboss.as.txn] (ServerService Thread Pool -- 54) WFLYTX0013: Node identifier property is set to the default value. Please make sure it is unique.
105 | 2015-10-10 08:25:26,254 INFO [org.jboss.as.webservices] (ServerService Thread Pool -- 56) WFLYWS0002: Activating WebServices Extension
106 | 2015-10-10 08:25:26,268 INFO [org.jboss.as.naming] (ServerService Thread Pool -- 46) WFLYNAM0001: Activating Naming Subsystem
107 | 2015-10-10 08:25:26,295 INFO [org.jboss.as.jsf] (ServerService Thread Pool -- 44) WFLYJSF0007: Activated the following JSF Implementations: [main]
108 | 2015-10-10 08:25:26,318 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 33) WFLYJCA0004: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
109 | 2015-10-10 08:25:26,365 INFO [org.jboss.as.security] (MSC service thread 1-8) WFLYSEC0001: Current PicketBox version=4.9.2.Final
110 | 2015-10-10 08:25:26,405 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 55) WFLYUT0003: Undertow 1.2.9.Final starting
111 | 2015-10-10 08:25:26,406 INFO [org.wildfly.extension.undertow] (MSC service thread 1-4) WFLYUT0003: Undertow 1.2.9.Final starting
112 | 2015-10-10 08:25:26,628 INFO [org.jboss.remoting] (MSC service thread 1-1) JBoss Remoting version 4.0.9.Final
113 | 2015-10-10 08:25:26,748 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-1) WFLYJCA0018: Started Driver service with driver-name = h2
114 | 2015-10-10 08:25:26,752 INFO [org.jboss.as.naming] (MSC service thread 1-2) WFLYNAM0003: Starting Naming Service
115 | 2015-10-10 08:25:26,756 INFO [org.jboss.as.mail.extension] (MSC service thread 1-7) WFLYMAIL0001: Bound mail session [java:jboss/mail/Default]
116 | 2015-10-10 08:25:26,858 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 55) WFLYUT0014: Creating file handler for path C:\work\wildfly-9.0.1.Final\wildfly-9.0.1.Final/welcome-content
117 | 2015-10-10 08:25:26,871 INFO [org.wildfly.extension.undertow] (MSC service thread 1-4) WFLYUT0012: Started server default-server.
118 | 2015-10-10 08:25:26,992 INFO [org.wildfly.extension.undertow] (MSC service thread 1-8) WFLYUT0018: Host default-host starting
119 | 2015-10-10 08:25:27,123 INFO [org.wildfly.extension.undertow] (MSC service thread 1-4) WFLYUT0006: Undertow HTTP listener default listening on /127.0.0.1:8080
120 | 2015-10-10 08:25:27,270 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-3) WFLYJCA0001: Bound data source [java:jboss/datasources/ExampleDS]
121 | 2015-10-10 08:25:27,283 INFO [org.jboss.as.server.deployment.scanner] (MSC service thread 1-8) WFLYDS0013: Started FileSystemDeploymentService for directory C:\work\wildfly-9.0.1.Final\wildfly-9.0.1.Final\standalone\deployments
122 | 2015-10-10 08:25:27,608 INFO [org.jboss.ws.common.management] (MSC service thread 1-5) JBWS022052: Starting JBoss Web Services - Stack CXF Server 5.0.0.Final
123 | 2015-10-10 08:25:27,807 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://127.0.0.1:9990/management
124 | 2015-10-10 08:25:27,810 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://127.0.0.1:9990
125 | 2015-10-10 08:25:27,811 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 9.0.1.Final (WildFly Core 1.0.1.Final) started in 4401ms - Started 203 of 379 services (210 services are lazy, passive or on-demand)
--------------------------------------------------------------------------------
/src/test/resources/gitbucket.html:
--------------------------------------------------------------------------------
1 | GitBucket

2 | GitBucket is the easily installable GitHub clone powered by Scala.
3 | Features
4 | The current version of GitBucket provides a basic features below:
5 |
6 | - Public / Private Git repository (http and ssh access)
7 | - Repository viewer and online file editing
8 | - Repository search (Code and Issues)
9 | - Wiki
10 | - Issues
11 | - Fork / Pull request
12 | - Email notification
13 | - Activity timeline
14 | - Simple user and group management with LDAP integration
15 | - Gravatar support
16 | - Plug-in system
17 |
18 | Following features are not implemented, but we will make them in the future release!
19 |
20 | - Network graph
21 | - Statistics
22 | - Watch / Star
23 |
24 | If you want to try the development version of GitBucket, see the documentation for developers at Wiki.
25 | Installation
26 |
27 | - Download latest gitbucket.war from the release page.
28 | - Deploy it to the Servlet 3.0 container such as Tomcat 7.x, Jetty 8.x, GlassFish 3.x or higher.
29 | - Access http://[hostname]:[port]/gitbucket/ using your web browser.
30 |
31 | If you are using Gitbucket behind a webserver please make sure you have increased the client_max_body_size (on nginx)
32 | The default administrator account is root and password is root.
33 | or you can start GitBucket by java -jar gitbucket.war without servlet container. In this case, GitBucket URL is http://[hostname]:8080/. You can specify following options.
34 |
35 | - --port=[NUMBER]
36 | - --prefix=[CONTEXTPATH]
37 | - --host=[HOSTNAME]
38 | - --gitbucket.home=[DATA_DIR]
39 |
40 | To upgrade GitBucket, only replace gitbucket.war. All GitBucket data is stored in HOME/.gitbucket. So if you want to back up GitBucket data, copy this directory to the other disk.
41 | For Installation on Windows Server with IIS see this wiki page
42 | Mac OS X
43 | Installing Via Homebrew
44 | $ brew install gitbucket
45 | ==> Downloading https://github.com/takezoe/gitbucket/releases/download/1.10/gitbucket.war
46 | ######################################################################## 100.0%
47 | ==> Caveats
48 | Note: When using launchctl the port will be 8080.
49 |
50 | To have launchd start gitbucket at login:
51 | ln -sfv /usr/local/opt/gitbucket/*.plist ~/Library/LaunchAgents
52 | Then to load gitbucket now:
53 | launchctl load ~/Library/LaunchAgents/homebrew.mxcl.gitbucket.plist
54 | Or, if you don't want/need launchctl, you can just run:
55 | java -jar /usr/local/opt/gitbucket/libexec/gitbucket.war
56 | ==> Summary
57 | /usr/local/Cellar/gitbucket/1.10: 3 files, 42M, built in 11 seconds
58 |
59 | Manual Installation
60 | On OS X, copy the gitbucket.plist file to ~/Library/LaunchAgents/
61 | Run the following commands in Terminal to
62 |
63 | - start gitbucket:
launchctl load ~/Library/LaunchAgents/gitbucket.plist
64 | - stop gitbucket:
launchctl unload ~/Library/LaunchAgents/gitbucket.plist
65 |
66 | Plug-ins
67 | GitBucket has the plug-in system to extend GitBucket from outside of GitBucket. Some plug-ins are available now:
68 |
74 | You can find community plugins other than them at gitbucket community plugins.
75 | Release Notes
76 | 3.6 - 30 Aug 2015
77 |
78 | - User interface Improvements: Especially, commit list, issues and pull request have been updated largely.
79 | - Installed plugins list has been available at the system administration console.
80 | - Pages and repository list in the sidebar have been limited and more pages and repositories link is available.
81 | - More reference link notation in Markdown has been supported.
82 |
83 | 3.5 - 1 Aug 2015
84 |
85 | - Octicons has been applied
86 | - Global header has been enhanced. Now it's further similar to GitHub.
87 | - Default compare / pull request target has been changed to the parent repository
88 | - A lot of updates for gitbucket-gist-plugin
89 |
90 | 3.4 - 27 Jun 2015
91 |
92 | - Declarative style plug-in definition
93 | - New extension point to add markup render
94 | - go-import support
95 |
96 | 3.3 - 31 May 2015
97 |
98 | - Rich graphical diff for images
99 | - File finder is available in the repository viewer
100 | - Blame is displayed at the source viewer
101 | - Remain user data and repositories even if user is disabled
102 | - Mobile view improvement
103 |
104 | 3.2 - 3 May 2015
105 |
106 | - Directory history button
107 | - Compare / pull request button
108 | - Limit of activity log
109 |
110 | 3.1.1 - 4 Apr 2015
111 |
112 | - Rolled back H2 version to avoid version compatibility issue
113 | - Plug-ins became possible to access ServletContext
114 |
115 | 3.1 - 28 Mar 2015
116 |
117 | - Web APIs for Jenkins github pull-request builder
118 | - Improved diff view
119 | - Bump Scalatra to 2.3.1, sbt to 0.13.8
120 |
121 | 3.0 - 3 Mar 2015
122 |
123 | - New plug-in system is available
124 | - Connection pooling by c3p0
125 | - New branch UI
126 | - Compare between specified commit ids
127 |
128 | 2.8 - 1 Feb 2015
129 |
130 | - New logo and icons
131 | - New system setting options to control visibility
132 | - Comment on side-by-side diff
133 | - Information message on sign-in page
134 | - Fork repository by group account
135 |
136 | 2.7 - 29 Dec 2014
137 |
138 | - Comment for commit and diff
139 | - Fix security issue in markdown rendering
140 | - Some bug fix and improvements
141 |
142 | 2.6 - 24 Nov 2014
143 |
144 | - Search box at issues and pull requests
145 | - Information from administrator
146 | - Pull request UI has been updated
147 | - Move to TravisCI from Buildhive
148 | - Some bug fix and improvements
149 |
150 | 2.5 - 4 Nov 2014
151 |
152 | - New Dashboard
153 | - Change datetime format
154 | - Create branch from Web UI
155 | - Task list in Markdown
156 | - Some bug fix and improvements
157 |
158 | 2.4.1 - 6 Oct 2014
159 |
162 | 2.4 - 6 Oct 2014
163 |
164 | - New UI is applied to Issues and Pull requests
165 | - Side-by-side diff is available
166 | - Fix relative path problem in Markdown links and images
167 | - Plugin System is disabled in default
168 | - Some bug fix and improvements
169 |
170 | 2.3 - 1 Sep 2014
171 |
172 | - Scala based plugin system
173 | - Embedded Jetty war extraction directory moved to
GITBUCKET_HOME/tmp
174 | - Some bug fix and improvements
175 |
176 | 2.2.1 - 5 Aug 2014
177 |
180 | 2.2 - 4 Aug 2014
181 |
182 | - Plug-in system is available
183 | - Move to Scala 2.11, Scalatra 2.3 and Slick 2.1
184 | - tar.gz export for repository contents
185 | - LDAP authentication improvement (mail address became optional)
186 | - Show news feed of a private repository to members
187 | - Some bug fix and improvements
188 |
189 | 2.1 - 6 Jul 2014
190 |
191 | - Upgrade to Slick 2.0 from 1.9
192 | - Base part of the plug-in system is merged
193 | - Many bug fix and improvements
194 |
195 | 2.0 - 31 May 2014
196 |
197 | - Modern Github UI
198 | - Preview in AceEditor
199 | - Select lines by clicking line number in blob view
200 |
201 | 1.13 - 29 Apr 2014
202 |
203 | - Direct file editing in the repository viewer using AceEditor
204 | - File attachment for issues
205 | - Atom feed of user activity
206 | - Fix some bugs
207 |
208 | 1.12 - 29 Mar 2014
209 |
210 | - SSH repository access is available
211 | - Allow users can create and management their groups
212 | - Git submodule support
213 | - Close issues via commit messages
214 | - Show repository description below the name on repository page
215 | - Fix presentation of the source viewer
216 | - Upgrade to sbt 0.13
217 | - Fix some bugs
218 |
219 | 1.11.1 - 06 Mar 2014
220 |
223 | 1.11 - 01 Mar 2014
224 |
225 | - Base URL for redirection, notification and repository URL box is configurable
226 | - Remove
--https option because it's possible to substitute in the base url
227 | - Headline anchor is available for Markdown contents such as Wiki page
228 | - Improve H2 connectivity
229 | - Label is available for pull requests not only issues
230 | - Delete branch button is added
231 | - Repository icons are updated
232 | - Select lines of source code by URL hash like
#L10 or #L10-L15 in repository viewer
233 | - Display reference to issue from others in comment list
234 | - Fix some bugs
235 |
236 | 1.10 - 01 Feb 2014
237 |
238 | - Rename repository
239 | - Transfer repository owner
240 | - Change default data directory to
HOME/.gitbucket from HOME/gitbucket to avoid problem like #243, but if data directory already exist at HOME/gitbucket, it continues being used.
241 | - Add LDAP display name attribute
242 | - Response performance improvement
243 | - Fix some bugs
244 |
245 | 1.9 - 28 Dec 2013
246 |
247 | - Display GITBUCKET_HOME on the system settings page
248 | - Fix some bugs
249 |
250 | 1.8 - 30 Nov 2013
251 |
252 | - Add user and group deletion
253 | - Improve pull request performance
254 | - Pull request synchronization (when source repository is updated after pull request, it's applied to the pull request)
255 | - LDAP StartTLS support
256 | - Enable hard wrapping in Markdown
257 | - Add new some options to specify the data directory. See details in Wiki.
258 | - Fix some bugs
259 |
260 | 1.7 - 26 Oct 2013
261 |
262 | - Support working on Java6 in embedded Jetty mode
263 | - Add
--host option to bind specified host name in embedded Jetty mode
264 | - Add
--https=true option to force https scheme when using embedded Jetty mode at the back of https proxy
265 | - Add full name as user property
266 | - Change link color for absent Wiki pages
267 | - Add ZIP download button to the repository viewer tab
268 | - Improve ZIP exporting performance
269 | - Expand issue and comment textarea for long text automatically
270 | - Add conflict detection in Wiki
271 | - Add reverting wiki page from history
272 | - Match committer to user name by email address
273 | - Mail notification sender is customizable
274 | - Add link to changeset in refs comment for issues
275 | - Fix some bugs
276 |
277 | 1.6 - 1 Oct 2013
278 |
279 | - Web hook
280 | - Performance improvement for pull request
281 | - Executable war file
282 | - Specify suitable Content-Type for downloaded files in the repository viewer
283 | - Fix some bugs
284 |
285 | 1.5 - 4 Sep 2013
286 |
287 | - Fork and pull request
288 | - LDAP authentication
289 | - Mail notification
290 | - Add an option to turn off the gravatar support
291 | - Add the branch tab in the repository viewer
292 | - Encoding auto detection for the file content in the repository viewer
293 | - Add favicon, header logo and icons for the timeline
294 | - Specify data directory via environment variable GITBUCKET_HOME
295 | - Fix some bugs
296 |
297 | 1.4 - 31 Jul 2013
298 |
299 | - Group management
300 | - Repository search for code and issues
301 | - Display user related issues on the dashboard
302 | - Display participants avatar of issues on the issue page
303 | - Performance improvement for repository viewer
304 | - Alert by milestone due date
305 | - H2 database administration console
306 | - Fix some bugs
307 |
308 | 1.3 - 18 Jul 2013
309 |
310 | - Batch updating for issues
311 | - Display assigned user on issue list
312 | - User icon and Gravatar support
313 | - Convert @xxxx to link to the account page
314 | - Add copy to clipboard button for git clone URL
315 | - Allow multi-byte characters as wiki page name
316 | - Allow to create the empty repository
317 | - Fix some bugs
318 |
319 | 1.2 - 09 Jul 2013
320 |
321 | - Add activity timeline
322 | - Bugfix for Git 1.8.1.5 or later
323 | - Allow multi-byte characters as label
324 | - Fix some bugs
325 |
326 | 1.1 - 05 Jul 2013
327 |
328 | - Fix some bugs
329 | - Upgrade to JGit 3.0
330 |
331 | 1.0 - 04 Jul 2013
332 |
333 | - This is a first public release
334 |
335 |
336 | 
--------------------------------------------------------------------------------
/src/main/java/io/github/gitbucket/markedj/Lexer.java:
--------------------------------------------------------------------------------
1 | package io.github.gitbucket.markedj;
2 |
3 | import io.github.gitbucket.markedj.rule.Rule;
4 | import io.github.gitbucket.markedj.token.*;
5 |
6 | import java.util.*;
7 |
8 | import static io.github.gitbucket.markedj.Utils.*;
9 | import io.github.gitbucket.markedj.extension.Extension;
10 |
11 | public class Lexer {
12 |
13 | protected Options options;
14 | protected Map rules = null;
15 |
16 | public Lexer(Options options){
17 | this.options = options;
18 | if(!options.isGfm()){
19 | this.rules = Grammer.BLOCK_RULES;
20 | } else if(options.isTables()){
21 | this.rules = Grammer.BLOCK_TABLE_RULES;
22 | } else {
23 | this.rules = Grammer.BLOCK_GFM_RULES;
24 | }
25 | }
26 |
27 | public LexerResult lex(String src){
28 | LexerContext context = new LexerContext();
29 |
30 | token(src
31 | .replace("\r\n", "\n")
32 | .replace("\r", "\n")
33 | .replace("\t", " ")
34 | .replace("\u00a0", " ")
35 | .replace("\u2424", "\n"),
36 | true, false, context);
37 |
38 | return new LexerResult(context.getTokens(), context.getLinks());
39 | }
40 |
41 | protected void token(String src, boolean top, boolean bq, LexerContext context){
42 | while(src.length() > 0){
43 | // newline
44 | {
45 | List cap = rules.get("newline").exec(src);
46 | if(!cap.isEmpty()){
47 | src = src.substring(cap.get(0).length());
48 | if(cap.get(0).length() > 1){
49 | context.pushToken(new SpaceToken());
50 | }
51 | }
52 | }
53 |
54 | // code
55 | {
56 | List cap = rules.get("code").exec(src);
57 | if(!cap.isEmpty()){
58 | src = src.substring(cap.get(0).length());
59 | String code = cap.get(0).replaceAll("(?m)^ {4}", "");
60 | context.pushToken(new CodeToken(code.replaceAll("\\n+$", ""), null, false));
61 | continue;
62 | }
63 | }
64 |
65 | // fences (gfm)
66 | {
67 | List cap = rules.get("fences").exec(src);
68 | if(!cap.isEmpty()){
69 | src = src.substring(cap.get(0).length());
70 | String lang = cap.get(2);
71 | if(lang != null){
72 | // Ignore extra information in Pandoc, R Markdown or PHP Markdown Extra.
73 | // https://github.com/gitbucket/markedj/issues/20
74 | lang = lang.replaceFirst("\\{.*}", "");
75 | }
76 | context.pushToken(new CodeToken(cap.get(3), trim(lang), false));
77 | continue;
78 | }
79 | }
80 |
81 | // heading
82 | {
83 | List cap = rules.get("heading").exec(src);
84 | if(!cap.isEmpty()){
85 | src = src.substring(cap.get(0).length());
86 | context.pushToken(new HeadingToken(cap.get(1).length(), cap.get(2)));
87 | continue;
88 | }
89 | }
90 |
91 | // table no leading pipe (gfm)
92 | if(top){
93 | List cap = rules.get("nptable").exec(src);
94 | if(!cap.isEmpty()){
95 | src = src.substring(cap.get(0).length());
96 |
97 | String[] headers = cap.get(1).replaceAll("^ *| *\\| *$", "").split(" *\\| *");
98 | String[] aligns = cap.get(2).replaceAll("^ *|\\| *$", "").split(" *\\| *");
99 | String[] rows = cap.get(3).replaceAll("\n$", "").split("\n");
100 |
101 | List headerList = array2list(headers);
102 |
103 | List alignList = new ArrayList<>();
104 | for (String s : aligns) {
105 | if(s.matches("^ *-+: *$")){
106 | alignList.add("right");
107 | } else if(s.matches("^ *:-+: *$")){
108 | alignList.add("center");
109 | } else if(s.matches("^ *:-+ *$")){
110 | alignList.add("left");
111 | } else {
112 | alignList.add(null);
113 | }
114 | }
115 |
116 | int maxColumns = Math.max(headers.length, aligns.length);
117 |
118 | List> rowList = new ArrayList<>();
119 | for (String row : rows) {
120 | String[] columns = row.split(" *\\| *");
121 | if(maxColumns < columns.length){
122 | maxColumns = columns.length;
123 | }
124 | rowList.add(array2list(columns));
125 | }
126 |
127 | fillList(headerList, maxColumns, "");
128 | fillList(alignList, maxColumns, null);
129 | for(List row: rowList){
130 | fillList(row, maxColumns, "");
131 | }
132 |
133 | context.pushToken(new TableToken(headerList, alignList, rowList));
134 | continue;
135 | }
136 | }
137 |
138 | // lheading
139 | {
140 | List cap = rules.get("lheading").exec(src);
141 | if(!cap.isEmpty()){
142 | src = src.substring(cap.get(0).length());
143 | if(cap.get(2).equals("=")){
144 | context.pushToken(new HeadingToken(1, cap.get(1)));
145 | } else {
146 | context.pushToken(new HeadingToken(2, cap.get(1)));
147 | }
148 | continue;
149 | }
150 | }
151 |
152 | // hr
153 | {
154 | List cap = rules.get("hr").exec(src);
155 | if(!cap.isEmpty()){
156 | src = src.substring(cap.get(0).length());
157 | context.pushToken(new HrToken());
158 | continue;
159 | }
160 | }
161 |
162 | {
163 | Extension.LexResult result = null;
164 | for (Extension extension : options.getExtensions()) {
165 | result = extension.lex(src, context, this::token);
166 | if (result.matches()) {
167 | src = result.getSource();
168 | break;
169 | }
170 | }
171 | if (result != null && result.matches()) {
172 | continue;
173 | }
174 | }
175 |
176 | // blockquote
177 | {
178 | List cap = rules.get("blockquote").exec(src);
179 | if(!cap.isEmpty()){
180 | src = src.substring(cap.get(0).length());
181 | context.pushToken(new BlockquoteStartToken());
182 | token(cap.get(0).replaceAll("(?m)^ *> ?", ""), top, true, context);
183 | context.pushToken(new BlockquoteEndToken());
184 | continue;
185 | }
186 | }
187 |
188 | // list
189 | {
190 | List cap = rules.get("list").exec(src);
191 | if(!cap.isEmpty()){
192 | src = src.substring(cap.get(0).length());
193 | String bull = cap.get(2);
194 |
195 | context.pushToken(new ListStartToken(bull.matches("^[0-9]+\\.$")));
196 | boolean next = false;
197 |
198 | // Get each top-level item.
199 | cap = rules.get("item").exec(cap.get(0));
200 | if(!cap.isEmpty()){
201 | for(int i = 0; i < cap.size(); i++){
202 | String item = cap.get(i);
203 |
204 | // Remove the list item's bullet
205 | // so it is seen as the nextToken token.
206 | int space = item.length();
207 | item = item.replaceAll("^ *([*+-]|\\d+\\.) +", "");
208 |
209 | // Outdent whatever the
210 | // list item contains. Hacky.
211 | if(item.indexOf("\n ") > 0){
212 | space = space - item.length();
213 | item = item.replaceAll("(?m)^ {1," + space + "}", "");
214 | }
215 |
216 | // // Determine whether the nextToken list item belongs here.
217 | // // Backpedal if it does not belong in this list.
218 | // if(options.isSmartLists() && i != cap.size() - 1){
219 | // Pattern p = Pattern.compile(Grammer.BULLET);
220 | // if(p.matcher(cap.get(i + 1)).find()){
221 | // src = String.join("\n", cap.subList(i + 1, cap.size())) + src;
222 | // i = i - 1;
223 | // }
224 | // }
225 |
226 | // Determine whether item is loose or not.
227 | // Use: /(^|\n)(?! )[^\n]+\n\n(?!\s*$)/
228 | // for discount behavior.
229 | boolean loose = next || item.matches("\\n\\n(?!\\s*$)");
230 | if(i != cap.size() - 1){
231 | next = !item.isEmpty() && item.charAt(item.length() - 1) == '\n';
232 | if(!loose) {
233 | loose = next;
234 | }
235 | }
236 |
237 | if(loose){
238 | context.pushToken(new LooseItemStartToken());
239 | } else {
240 | context.pushToken(new ListItemStartToken());
241 | }
242 |
243 | token(item, false, bq, context);
244 | context.pushToken(new ListItemEndToken());
245 | }
246 | }
247 | context.pushToken(new ListEndToken());
248 | continue;
249 | }
250 | }
251 |
252 | // html
253 | {
254 | List cap = rules.get("html").exec(src);
255 | if(!cap.isEmpty()){
256 | src = src.substring(cap.get(0).length());
257 | if(options.isSanitize()){
258 | context.pushToken(new ParagraphToken(cap.get(0)));
259 | } else {
260 | context.pushToken(new HtmlToken(cap.get(0)));
261 | }
262 | continue;
263 | }
264 | }
265 |
266 | // def
267 | if(!bq && top){
268 | List cap = rules.get("def").exec(src);
269 | if(!cap.isEmpty()){
270 | src = src.substring(cap.get(0).length());
271 | context.defineLink(cap.get(1).toLowerCase(), new Link(cap.get(2), cap.get(3)));
272 | continue;
273 | }
274 | }
275 |
276 | // table (gfm)
277 | if(top){
278 | List cap = rules.get("table").exec(src);
279 | if(!cap.isEmpty()){
280 | src = src.substring(cap.get(0).length());
281 |
282 | String[] headers = cap.get(1).replaceAll("^ *| *\\| *$", "").split(" *\\| *");
283 | String[] aligns = cap.get(2).replaceAll("^ *|\\| *$", "").split(" *\\| *");
284 | String[] rows = cap.get(3).replaceAll("(?: *\\| *)?\\n$", "").split("\\n");
285 |
286 | List headerList = array2list(headers);
287 |
288 | List alignList = new ArrayList<>();
289 | for (String s : aligns) {
290 | if(s.matches("^ *-+: *$")){
291 | alignList.add("right");
292 | } else if(s.matches("^ *:-+: *$")){
293 | alignList.add("center");
294 | } else if(s.matches("^ *:-+ *$")){
295 | alignList.add("left");
296 | } else {
297 | alignList.add(null);
298 | }
299 | }
300 |
301 | int maxColumns = Math.max(headers.length, aligns.length);
302 |
303 | List> rowList = new ArrayList<>();
304 | for (String row : rows) {
305 | String[] columns = row.replaceAll("^ *\\| *| *\\| *$", "").split(" *\\| *");
306 | if(maxColumns < columns.length){
307 | maxColumns = columns.length;
308 | }
309 | rowList.add(array2list(columns));
310 | }
311 |
312 | fillList(headerList, maxColumns, "");
313 | fillList(alignList, maxColumns, null);
314 | for(List row: rowList){
315 | fillList(row, maxColumns, "");
316 | }
317 |
318 | context.pushToken(new TableToken(headerList, alignList, rowList));
319 | continue;
320 | }
321 | }
322 |
323 | // top-level paragraph
324 | if(top){
325 | List cap = rules.get("paragraph").exec(src);
326 | if(!cap.isEmpty()){
327 | src = src.substring(cap.get(0).length());
328 | if(cap.get(1).charAt(cap.get(1).length() - 1) == '\n'){
329 | context.pushToken(new ParagraphToken(cap.get(1).substring(0, cap.get(1).length() - 1)));
330 | } else {
331 | context.pushToken(new ParagraphToken(cap.get(1)));
332 | }
333 | continue;
334 | }
335 | }
336 |
337 | // text
338 | {
339 | List cap = rules.get("text").exec(src);
340 | if(!cap.isEmpty()){
341 | src = src.substring(cap.get(0).length());
342 | context.pushToken(new TextToken((cap.get(0))));
343 | continue;
344 | }
345 | }
346 |
347 | // TODO Error
348 | //println("Infinite loop on byte: " + source.charAt(0).toByte)
349 | }
350 | }
351 |
352 | public static class LexerContext {
353 | private Stack tokens = new Stack<>();
354 | private Map links = new HashMap<>();
355 |
356 | public void pushToken(Token token){
357 | this.tokens.push(token);
358 | }
359 |
360 | public void defineLink(String key, Link link){
361 | this.links.put(key, link);
362 | }
363 |
364 | public Stack getTokens() {
365 | return tokens;
366 | }
367 |
368 | public Map getLinks() {
369 | return links;
370 | }
371 | }
372 |
373 | public static class LexerResult {
374 | private Stack tokens;
375 | private Map links = new HashMap<>();
376 |
377 | public LexerResult(Stack tokens, Map links){
378 | this.tokens = tokens;
379 | this.links = links;
380 | }
381 |
382 | public Stack getTokens() {
383 | return tokens;
384 | }
385 |
386 | public Map getLinks() {
387 | return links;
388 | }
389 | }
390 |
391 |
392 | public static class Link {
393 | private String href;
394 | private String title;
395 |
396 | public Link(String href, String title){
397 | this.href = href;
398 | this.title = title;
399 | }
400 |
401 | public String getHref() {
402 | return href;
403 | }
404 |
405 | public String getTitle() {
406 | return title;
407 | }
408 | }
409 |
410 | }
411 |
--------------------------------------------------------------------------------