Skip to content

Commit 892cffd

Browse files
authored
Merge pull request #27 from denco/feature/0.1.9
feature/0.1.9
2 parents e4e6eaa + 0a3496e commit 892cffd

34 files changed

+357
-116
lines changed

.gitattributes

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
* text=auto
2-
/src/test/testfiles/nix/**/*.confluence text eol=lf
3-
/src/test/testfiles/win/**/*.confluence text eol=crlf
2+
**/nix/**/*.confluence text eol=lf
3+
**/win/**/*.confluence text eol=crlf

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Confluence Wiki Markup
22

3+
## [0.1.9](https://github.com/denco/vscode-confluence-markup/releases/tag/0.1.9)
4+
5+
- fix [Can't use [ and ] in string](https://github.com/denco/vscode-confluence-markup/issues/24)
6+
- add panel macro support [panel support](https://github.com/denco/vscode-confluence-markup/issues/22)
7+
- add bages for [Open VSX Registry](https://open-vsx.org/)
8+
- use bages from [shilds.io](https://shields.io/)
9+
- migrate from `vscode` dependency to `@types/vscode` and `vscode-test`, s. [Migrating from `vscode`](https://code.visualstudio.com/api/working-with-extensions/testing-extension#migrating-from-vscode)
10+
311
## [0.1.8](https://github.com/denco/vscode-confluence-markup/releases/tag/0.1.8)
412

513
- fix [Multiply inline monospace macro](https://github.com/denco/vscode-confluence-markup/issues/17)

README.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
# Confluence® markup language support for Visual Studio Code
22

3-
[![The MIT License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](https://github.com/denco/vscode-confluence-markup/blob/master/LICENSE)
4-
[![Version](https://vsmarketplacebadge.apphb.com/version-short/denco.confluence-markup.svg?style=flat-square)](https://marketplace.visualstudio.com/items?itemName=denco.confluence-markup)
5-
[![Installs](https://vsmarketplacebadge.apphb.com/installs-short/denco.confluence-markup.svg?style=flat-square)](https://marketplace.visualstudio.com/items?itemName=denco.confluence-markup)
6-
[![Downloads](https://vsmarketplacebadge.apphb.com/downloads-short/denco.confluence-markup.svg?style=flat-square)](https://marketplace.visualstudio.com/items?itemName=denco.confluence-markup)
7-
[![Rating](https://vsmarketplacebadge.apphb.com/rating-short/denco.confluence-markup.svg?style=flat-square)](https://marketplace.visualstudio.com/items?itemName=denco.confluence-markup)
3+
[![The MIT License](https://img.shields.io/badge/license-MIT-brightgreen.svg?label=License&style=flat-square)](https://github.com/denco/vscode-confluence-markup/blob/master/LICENSE)
4+
5+
[![Version](https://img.shields.io/visual-studio-marketplace/v/denco.confluence-markup?color=%230066B8&label=VS%20Marketplace&style=flat-square)](https://marketplace.visualstudio.com/items?itemName=denco.confluence-markup)
6+
[![Installs](https://img.shields.io/visual-studio-marketplace/i/denco.confluence-markup?color=%230066B8&style=flat-square)](https://marketplace.visualstudio.com/items?itemName=denco.confluence-markup)
7+
[![Downloads](https://img.shields.io/visual-studio-marketplace/d/denco.confluence-markup?color=%230066B8&style=flat-square)](https://marketplace.visualstudio.com/items?itemName=denco.confluence-markup)
8+
[![Rating](https://img.shields.io/visual-studio-marketplace/r/denco.confluence-markup?color=0066B8&style=flat-square)](https://marketplace.visualstudio.com/items?itemName=denco.confluence-markup)
9+
10+
[![Version](https://img.shields.io/open-vsx/v/denco/confluence-markup?color=%23a60ee5&label=Open%20VSX&style=flat-square)](https://open-vsx.org/extension/denco/confluence-markup)
11+
[![Downloads](https://img.shields.io/open-vsx/dt/denco/confluence-markup?color=%23a60ee5&style=flat-square)](https://open-vsx.org/extension/denco/confluence-markup)
12+
[![Rating](https://img.shields.io/open-vsx/rating/denco/confluence-markup?color=%23a60ee5&style=flat-square)](https://open-vsx.org/extension/denco/confluence-markup)
13+
814

915
## Description
1016

media/css/confluence.css

Lines changed: 38 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
11
body {
2-
font-family: -apple-system,
3-
BlinkMacSystemFont,
4-
"Segoe UI",
5-
Roboto,
6-
Helvetica,
7-
Arial,
8-
sans-serif,
9-
"Apple Color Emoji",
10-
"Segoe UI Emoji",
11-
"Segoe UI Symbol";
12-
font-size: 14px;
2+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
133
padding: 0 26px;
144
line-height: 1em;
155
word-wrap: break-word;
@@ -24,11 +14,7 @@ a {
2414
color: #4080D0;
2515
text-decoration: none;
2616
}
27-
28-
a:focus,
29-
input:focus,
30-
select:focus,
31-
textarea:focus {
17+
a:focus, input:focus, select:focus, textarea:focus {
3218
outline: 1px solid -webkit-focus-ring-color;
3319
outline-offset: -1px;
3420
}
@@ -46,9 +32,7 @@ h1 {
4632
border-bottom-style: solid;
4733
}
4834

49-
h1,
50-
h2,
51-
h3 {
35+
h1, h2, h3 {
5236
font-weight: normal;
5337
}
5438

@@ -58,29 +42,49 @@ blockquote {
5842
border-left: 5px solid;
5943
}
6044

61-
table,
62-
th,
63-
td {
45+
table, th, td {
6446
border: 1px solid;
6547
border-collapse: collapse;
6648
padding: 7px;
6749
}
6850

69-
pre>code {
70-
display: inline-block;
71-
width: 90%;
72-
color: white;
51+
pre > code {
52+
display: block;
53+
background:rgba(0, 0, 0, 0.15);
54+
word-wrap: break-word;
55+
overflow-wrap: break-word;
56+
word-break: break-all;
57+
white-space: normal;
7358
margin: 0px 5px;
74-
font-size: 14px;
75-
background-color: black;
76-
cursor: pointer;
7759
padding: 5px 1em;
78-
box-shadow: 1px 1px 1px rgba(0, 0, 0, .25);
7960
line-height: 1.5em;
8061
}
8162

63+
64+
.panel {
65+
display: inline-block;
66+
width: 90%;
67+
color: black;
68+
margin: 0px;
69+
background-color: lightslategrey;
70+
border-width: 1px;
71+
72+
}
73+
74+
.panel-title {
75+
font-weight: bold;
76+
padding: 5px 3px;
77+
border-bottom: none;
78+
}
79+
80+
.panel-body {
81+
background-color: lightgrey;
82+
padding: 3px;
83+
}
84+
85+
8286
pre > code > p {
83-
margin: 0px
87+
margin: 0px;
8488
}
8589

8690
ul {
@@ -95,10 +99,10 @@ ol.initial {
9599
list-style: decimal;
96100
}
97101

98-
ol.initial>ol {
102+
ol.initial > ol {
99103
list-style-type: lower-alpha;
100104
}
101105

102-
ol.initial>ol>ol {
106+
ol.initial > ol > ol {
103107
list-style-type: lower-roman;
104-
}
108+
}

package.json

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "confluence-markup",
33
"displayName": "Confluence markup",
4-
"version": "0.1.8",
4+
"version": "0.1.9",
55
"publisher": "denco",
66
"description": "Confluence markup language support for Visual Studio Code",
77
"keywords": [
@@ -124,19 +124,25 @@
124124
"vscode:prepublish": "npm run compile",
125125
"compile": "tsc -p ./",
126126
"watch": "tsc -watch -p ./",
127-
"postinstall": "node ./node_modules/vscode/bin/install",
128-
"test": "npm run clean && npm run compile && node ./node_modules/vscode/bin/test",
127+
"pretest": "npm run clean && npm run compile",
128+
"test": "node ./out/test/runTest.js",
129+
"prepackage": "npm run clean && npm run compile",
129130
"package": "./node_modules/.bin/vsce package",
130131
"clean": "rm -rf ./out",
131132
"clean-all": "rm -f ./confluence-markup*.vsix; rm -rf ./.vscode-test; rm -rf ./out; rm -rf ./node_modules"
132133
},
133134
"devDependencies": {
135+
"@types/glob": "^7.1.1",
134136
"@types/mocha": "^5.2.7",
135-
"@types/node": "^12.12.7",
137+
"@types/node": "^12.12.8",
138+
"@types/vscode": "^1.40.0",
136139
"tslint": "^5.18.0",
137140
"typescript": "^3.5.3",
138141
"vsce": "^1.66.0",
139-
"vscode": "^1.1.36",
142+
"vscode-test": "^1.2.3",
143+
"glob": "^7.1.4",
144+
"mocha": "^6.1.4",
145+
"source-map-support": "^0.5.12",
140146
"html-formatter": "^0.1.9"
141147
},
142148
"__metadata": {

src/markupParser.ts

Lines changed: 91 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ export function parseMarkup(sourceUri: vscode.Uri, sourceText: string) {
4949
let listTag = '';
5050
let listStyle = '';
5151
let codeTagFlag = false;
52+
let panelTagFlag = false;
5253
let tableFlag = false;
5354
let listFlag = false;
5455
let listArr: string[] = [];
@@ -94,16 +95,19 @@ export function parseMarkup(sourceUri: vscode.Uri, sourceText: string) {
9495

9596
tag = tag.replace(/\\\\/gi, '<br/>');
9697

97-
let re = /\[([^|]*)?\|?([^|]*)\]/g
98-
if (tag.match(re)) {
99-
tag = tag.replace(re, function (m0, m1, m2) {
98+
let re_href = /\[(\S[^|]*)?\|?([^|].*[^\\|\s+])\]/g
99+
let esc_href = /\[\s*([^|]*)?\|?([^|].*)[\s+|\\]\]/g
100+
if (tag.match(re_href)) {
101+
tag = tag.replace(re_href, function (m0, m1, m2) {
100102
if ((m1.length !== 0) && (m2.length !== 0)) {
101103
return "<a href='" + m2 + "'>" + m1 + "</a>";
102104
} else {
103105
return "<a href='" + m1 + "'>" + m1 + "</a>";
104106
}
105107
});
106108
html_tag = true;
109+
} else if (tag.match(esc_href)){
110+
tag = tag.replace('\\','').replace('|', '&vert;')
107111
}
108112
//img
109113
let img = /!([^|]*)\|?.*!/;
@@ -113,9 +117,9 @@ export function parseMarkup(sourceUri: vscode.Uri, sourceText: string) {
113117
}
114118

115119
//Table
116-
let tab_th_re = /\s*\|{2}.*$/gi;
117-
let tab_td_re = /\s*\|.*$/gi;
118-
if (tag.match(tab_th_re) || tag.match(tab_td_re)) {
120+
let tab_th_re = /\s*[^{]*\|{2}[^}]*$/gi;
121+
let tab_td_re = /\s*[^{]*\|[^}]*$/gi;
122+
if (!html_tag && (tag.match(tab_th_re) || tag.match(tab_td_re))) {
119123
tag = tag.replace(/^\|{2,}/, '\|\|');
120124
tag = tag.replace(/^\|{2}/, '<th>');
121125
tag = tag.replace(/\|{2}$/, '</th>');
@@ -149,6 +153,87 @@ export function parseMarkup(sourceUri: vscode.Uri, sourceText: string) {
149153
}
150154
}
151155

156+
let panel_re = /\{panel(.*)}/;
157+
if (tag.match(panel_re)) {
158+
if (! panelTagFlag) {
159+
let panelStyle = "";
160+
let titleStyle = "";
161+
tag = tag.replace(panel_re, function (m0, m1, m2) {
162+
let res = '<div class="panel panel-body" $panelStyle>'
163+
let splits=m1.split(/[\|:]/);
164+
splits.forEach( (el:String) => {
165+
let elems = el.split('=');
166+
if (elems[0] === "title"){
167+
res = `<div class="panel panel-title" $titleStyle>${elems[1]}</div>${res}`;
168+
}
169+
if (elems[0] === "titleBGColor"){
170+
if (titleStyle.length === 0) {
171+
titleStyle = `style='background-color: ${elems[1]};`;
172+
} else {
173+
titleStyle += ` background-color: ${elems[1]};`;
174+
}
175+
}
176+
if (elems[0] === "bgColor"){
177+
if (panelStyle.length === 0) {
178+
panelStyle = `style='background-color: ${elems[1]};`;
179+
} else {
180+
panelStyle += ` background-color: ${elems[1]};`;
181+
}
182+
}
183+
if (elems[0] === "borderStyle"){
184+
if (panelStyle.length === 0) {
185+
panelStyle = `style='border-style: ${elems[1]}; `;
186+
} else {
187+
panelStyle += ` border-style: ${elems[1]}; `;
188+
}
189+
if (titleStyle.length === 0) {
190+
titleStyle = `style='border-style: ${elems[1]}; border-bottom:none; `;
191+
} else {
192+
titleStyle += ` border-style: ${elems[1]}; border-bottom:none; `;
193+
}
194+
}
195+
if (elems[0] === "borderColor"){
196+
if (panelStyle.length === 0) {
197+
panelStyle = `style='border-color: ${elems[1]}; `;
198+
} else {
199+
panelStyle += ` border-color: ${elems[1]}; `;
200+
}
201+
if (titleStyle.length === 0) {
202+
titleStyle = `style='border-color: ${elems[1]}; `;
203+
} else {
204+
titleStyle += ` border-color: ${elems[1]}; `;
205+
}
206+
}
207+
if (elems[0] === "borderWidth"){
208+
if (panelStyle.length === 0) {
209+
panelStyle = `style='border-width: ${elems[1]}; `;
210+
} else {
211+
panelStyle += ` border-width: ${elems[1]}; `;
212+
}
213+
if (titleStyle.length === 0) {
214+
titleStyle = `style='border-width: ${elems[1]}; `;
215+
} else {
216+
titleStyle += ` border-width: ${elems[1]}; `;
217+
}
218+
}
219+
});
220+
if (titleStyle.length > 0) {
221+
titleStyle += `'`;
222+
}
223+
if (panelStyle.length > 0) {
224+
panelStyle += `'`;
225+
}
226+
res = res.replace('$panelStyle', panelStyle);
227+
res = res.replace('$titleStyle', titleStyle);
228+
return res;
229+
});
230+
panelTagFlag = true;
231+
} else {
232+
tag = '</div>';
233+
panelTagFlag = false;
234+
}
235+
}
236+
152237
if (! codeTagFlag) {
153238
// lists
154239
re = /^([-|\*|#]+)\s(.*)/;
@@ -212,7 +297,6 @@ export function parseMarkup(sourceUri: vscode.Uri, sourceText: string) {
212297
tag = '</table>' + tag;
213298
tableFlag = false;
214299
}
215-
216300
result += "<p>" + tag + "</p>";
217301
}
218302

src/test/index.ts

Lines changed: 0 additions & 22 deletions
This file was deleted.

src/test/runTest.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
2+
import * as path from 'path';
3+
4+
import { runTests } from 'vscode-test';
5+
6+
async function main() {
7+
try {
8+
// The folder containing the Extension Manifest package.json
9+
// Passed to `--extensionDevelopmentPath`
10+
const extensionDevelopmentPath = path.resolve(__dirname, '../../');
11+
12+
// The path to the extension test script
13+
// Passed to --extensionTestsPath
14+
const extensionTestsPath = path.resolve(__dirname, './suite/index');
15+
16+
// Download VS Code, unzip it and run the integration test
17+
await runTests({ extensionDevelopmentPath, extensionTestsPath });
18+
} catch (err) {
19+
console.error('Failed to run tests');
20+
process.exit(1);
21+
}
22+
}
23+
24+
main();

0 commit comments

Comments
 (0)