Skip to content

Commit

Permalink
Merge pull request #27 from denco/feature/0.1.9
Browse files Browse the repository at this point in the history
feature/0.1.9
  • Loading branch information
denco authored Mar 17, 2021
2 parents e4e6eaa + 0a3496e commit 892cffd
Show file tree
Hide file tree
Showing 34 changed files with 357 additions and 116 deletions.
4 changes: 2 additions & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
* text=auto
/src/test/testfiles/nix/**/*.confluence text eol=lf
/src/test/testfiles/win/**/*.confluence text eol=crlf
**/nix/**/*.confluence text eol=lf
**/win/**/*.confluence text eol=crlf
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Confluence Wiki Markup

## [0.1.9](https://github.com/denco/vscode-confluence-markup/releases/tag/0.1.9)

- fix [Can't use [ and ] in string](https://github.com/denco/vscode-confluence-markup/issues/24)
- add panel macro support [panel support](https://github.com/denco/vscode-confluence-markup/issues/22)
- add bages for [Open VSX Registry](https://open-vsx.org/)
- use bages from [shilds.io](https://shields.io/)
- 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)

## [0.1.8](https://github.com/denco/vscode-confluence-markup/releases/tag/0.1.8)

- fix [Multiply inline monospace macro](https://github.com/denco/vscode-confluence-markup/issues/17)
Expand Down
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
# Confluence® markup language support for Visual Studio Code

[![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)
[![Version](https://vsmarketplacebadge.apphb.com/version-short/denco.confluence-markup.svg?style=flat-square)](https://marketplace.visualstudio.com/items?itemName=denco.confluence-markup)
[![Installs](https://vsmarketplacebadge.apphb.com/installs-short/denco.confluence-markup.svg?style=flat-square)](https://marketplace.visualstudio.com/items?itemName=denco.confluence-markup)
[![Downloads](https://vsmarketplacebadge.apphb.com/downloads-short/denco.confluence-markup.svg?style=flat-square)](https://marketplace.visualstudio.com/items?itemName=denco.confluence-markup)
[![Rating](https://vsmarketplacebadge.apphb.com/rating-short/denco.confluence-markup.svg?style=flat-square)](https://marketplace.visualstudio.com/items?itemName=denco.confluence-markup)
[![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)

[![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)
[![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)
[![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)
[![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)

[![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)
[![Downloads](https://img.shields.io/open-vsx/dt/denco/confluence-markup?color=%23a60ee5&style=flat-square)](https://open-vsx.org/extension/denco/confluence-markup)
[![Rating](https://img.shields.io/open-vsx/rating/denco/confluence-markup?color=%23a60ee5&style=flat-square)](https://open-vsx.org/extension/denco/confluence-markup)


## Description

Expand Down
72 changes: 38 additions & 34 deletions media/css/confluence.css
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
body {
font-family: -apple-system,
BlinkMacSystemFont,
"Segoe UI",
Roboto,
Helvetica,
Arial,
sans-serif,
"Apple Color Emoji",
"Segoe UI Emoji",
"Segoe UI Symbol";
font-size: 14px;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
padding: 0 26px;
line-height: 1em;
word-wrap: break-word;
Expand All @@ -24,11 +14,7 @@ a {
color: #4080D0;
text-decoration: none;
}

a:focus,
input:focus,
select:focus,
textarea:focus {
a:focus, input:focus, select:focus, textarea:focus {
outline: 1px solid -webkit-focus-ring-color;
outline-offset: -1px;
}
Expand All @@ -46,9 +32,7 @@ h1 {
border-bottom-style: solid;
}

h1,
h2,
h3 {
h1, h2, h3 {
font-weight: normal;
}

Expand All @@ -58,29 +42,49 @@ blockquote {
border-left: 5px solid;
}

table,
th,
td {
table, th, td {
border: 1px solid;
border-collapse: collapse;
padding: 7px;
}

pre>code {
display: inline-block;
width: 90%;
color: white;
pre > code {
display: block;
background:rgba(0, 0, 0, 0.15);
word-wrap: break-word;
overflow-wrap: break-word;
word-break: break-all;
white-space: normal;
margin: 0px 5px;
font-size: 14px;
background-color: black;
cursor: pointer;
padding: 5px 1em;
box-shadow: 1px 1px 1px rgba(0, 0, 0, .25);
line-height: 1.5em;
}


.panel {
display: inline-block;
width: 90%;
color: black;
margin: 0px;
background-color: lightslategrey;
border-width: 1px;

}

.panel-title {
font-weight: bold;
padding: 5px 3px;
border-bottom: none;
}

.panel-body {
background-color: lightgrey;
padding: 3px;
}


pre > code > p {
margin: 0px
margin: 0px;
}

ul {
Expand All @@ -95,10 +99,10 @@ ol.initial {
list-style: decimal;
}

ol.initial>ol {
ol.initial > ol {
list-style-type: lower-alpha;
}

ol.initial>ol>ol {
ol.initial > ol > ol {
list-style-type: lower-roman;
}
}
16 changes: 11 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "confluence-markup",
"displayName": "Confluence markup",
"version": "0.1.8",
"version": "0.1.9",
"publisher": "denco",
"description": "Confluence markup language support for Visual Studio Code",
"keywords": [
Expand Down Expand Up @@ -124,19 +124,25 @@
"vscode:prepublish": "npm run compile",
"compile": "tsc -p ./",
"watch": "tsc -watch -p ./",
"postinstall": "node ./node_modules/vscode/bin/install",
"test": "npm run clean && npm run compile && node ./node_modules/vscode/bin/test",
"pretest": "npm run clean && npm run compile",
"test": "node ./out/test/runTest.js",
"prepackage": "npm run clean && npm run compile",
"package": "./node_modules/.bin/vsce package",
"clean": "rm -rf ./out",
"clean-all": "rm -f ./confluence-markup*.vsix; rm -rf ./.vscode-test; rm -rf ./out; rm -rf ./node_modules"
},
"devDependencies": {
"@types/glob": "^7.1.1",
"@types/mocha": "^5.2.7",
"@types/node": "^12.12.7",
"@types/node": "^12.12.8",
"@types/vscode": "^1.40.0",
"tslint": "^5.18.0",
"typescript": "^3.5.3",
"vsce": "^1.66.0",
"vscode": "^1.1.36",
"vscode-test": "^1.2.3",
"glob": "^7.1.4",
"mocha": "^6.1.4",
"source-map-support": "^0.5.12",
"html-formatter": "^0.1.9"
},
"__metadata": {
Expand Down
98 changes: 91 additions & 7 deletions src/markupParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export function parseMarkup(sourceUri: vscode.Uri, sourceText: string) {
let listTag = '';
let listStyle = '';
let codeTagFlag = false;
let panelTagFlag = false;
let tableFlag = false;
let listFlag = false;
let listArr: string[] = [];
Expand Down Expand Up @@ -94,16 +95,19 @@ export function parseMarkup(sourceUri: vscode.Uri, sourceText: string) {

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

let re = /\[([^|]*)?\|?([^|]*)\]/g
if (tag.match(re)) {
tag = tag.replace(re, function (m0, m1, m2) {
let re_href = /\[(\S[^|]*)?\|?([^|].*[^\\|\s+])\]/g
let esc_href = /\[\s*([^|]*)?\|?([^|].*)[\s+|\\]\]/g
if (tag.match(re_href)) {
tag = tag.replace(re_href, function (m0, m1, m2) {
if ((m1.length !== 0) && (m2.length !== 0)) {
return "<a href='" + m2 + "'>" + m1 + "</a>";
} else {
return "<a href='" + m1 + "'>" + m1 + "</a>";
}
});
html_tag = true;
} else if (tag.match(esc_href)){
tag = tag.replace('\\','').replace('|', '&vert;')
}
//img
let img = /!([^|]*)\|?.*!/;
Expand All @@ -113,9 +117,9 @@ export function parseMarkup(sourceUri: vscode.Uri, sourceText: string) {
}

//Table
let tab_th_re = /\s*\|{2}.*$/gi;
let tab_td_re = /\s*\|.*$/gi;
if (tag.match(tab_th_re) || tag.match(tab_td_re)) {
let tab_th_re = /\s*[^{]*\|{2}[^}]*$/gi;
let tab_td_re = /\s*[^{]*\|[^}]*$/gi;
if (!html_tag && (tag.match(tab_th_re) || tag.match(tab_td_re))) {
tag = tag.replace(/^\|{2,}/, '\|\|');
tag = tag.replace(/^\|{2}/, '<th>');
tag = tag.replace(/\|{2}$/, '</th>');
Expand Down Expand Up @@ -149,6 +153,87 @@ export function parseMarkup(sourceUri: vscode.Uri, sourceText: string) {
}
}

let panel_re = /\{panel(.*)}/;
if (tag.match(panel_re)) {
if (! panelTagFlag) {
let panelStyle = "";
let titleStyle = "";
tag = tag.replace(panel_re, function (m0, m1, m2) {
let res = '<div class="panel panel-body" $panelStyle>'
let splits=m1.split(/[\|:]/);
splits.forEach( (el:String) => {
let elems = el.split('=');
if (elems[0] === "title"){
res = `<div class="panel panel-title" $titleStyle>${elems[1]}</div>${res}`;
}
if (elems[0] === "titleBGColor"){
if (titleStyle.length === 0) {
titleStyle = `style='background-color: ${elems[1]};`;
} else {
titleStyle += ` background-color: ${elems[1]};`;
}
}
if (elems[0] === "bgColor"){
if (panelStyle.length === 0) {
panelStyle = `style='background-color: ${elems[1]};`;
} else {
panelStyle += ` background-color: ${elems[1]};`;
}
}
if (elems[0] === "borderStyle"){
if (panelStyle.length === 0) {
panelStyle = `style='border-style: ${elems[1]}; `;
} else {
panelStyle += ` border-style: ${elems[1]}; `;
}
if (titleStyle.length === 0) {
titleStyle = `style='border-style: ${elems[1]}; border-bottom:none; `;
} else {
titleStyle += ` border-style: ${elems[1]}; border-bottom:none; `;
}
}
if (elems[0] === "borderColor"){
if (panelStyle.length === 0) {
panelStyle = `style='border-color: ${elems[1]}; `;
} else {
panelStyle += ` border-color: ${elems[1]}; `;
}
if (titleStyle.length === 0) {
titleStyle = `style='border-color: ${elems[1]}; `;
} else {
titleStyle += ` border-color: ${elems[1]}; `;
}
}
if (elems[0] === "borderWidth"){
if (panelStyle.length === 0) {
panelStyle = `style='border-width: ${elems[1]}; `;
} else {
panelStyle += ` border-width: ${elems[1]}; `;
}
if (titleStyle.length === 0) {
titleStyle = `style='border-width: ${elems[1]}; `;
} else {
titleStyle += ` border-width: ${elems[1]}; `;
}
}
});
if (titleStyle.length > 0) {
titleStyle += `'`;
}
if (panelStyle.length > 0) {
panelStyle += `'`;
}
res = res.replace('$panelStyle', panelStyle);
res = res.replace('$titleStyle', titleStyle);
return res;
});
panelTagFlag = true;
} else {
tag = '</div>';
panelTagFlag = false;
}
}

if (! codeTagFlag) {
// lists
re = /^([-|\*|#]+)\s(.*)/;
Expand Down Expand Up @@ -212,7 +297,6 @@ export function parseMarkup(sourceUri: vscode.Uri, sourceText: string) {
tag = '</table>' + tag;
tableFlag = false;
}

result += "<p>" + tag + "</p>";
}

Expand Down
22 changes: 0 additions & 22 deletions src/test/index.ts

This file was deleted.

24 changes: 24 additions & 0 deletions src/test/runTest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

import * as path from 'path';

import { runTests } from 'vscode-test';

async function main() {
try {
// The folder containing the Extension Manifest package.json
// Passed to `--extensionDevelopmentPath`
const extensionDevelopmentPath = path.resolve(__dirname, '../../');

// The path to the extension test script
// Passed to --extensionTestsPath
const extensionTestsPath = path.resolve(__dirname, './suite/index');

// Download VS Code, unzip it and run the integration test
await runTests({ extensionDevelopmentPath, extensionTestsPath });
} catch (err) {
console.error('Failed to run tests');
process.exit(1);
}
}

main();
File renamed without changes.
Loading

0 comments on commit 892cffd

Please sign in to comment.