Skip to content

Commit

Permalink
Merge pull request #11 from denco/0.1.4
Browse files Browse the repository at this point in the history
0.1.4; fix #6; restructure
  • Loading branch information
denco authored Oct 1, 2018
2 parents add7c63 + 9533c4e commit c70d292
Show file tree
Hide file tree
Showing 38 changed files with 543 additions and 134 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* text=auto
/src/test/testfiles/nix/**/*.confluence text eol=lf
/src/test/testfiles/win/**/*.confluence text eol=crlf
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"files.exclude": {
"out": true,
"node_modules": true,
".vscode*": true
"**/.vscode": true,
"**/.vscode-*": true
},
"files.trimTrailingWhitespace": true,

Expand Down
10 changes: 6 additions & 4 deletions .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
**/tsconfig.json
**/*.map
**/*.bak
**/*.log
*.vsix
.gitignore
.vscode/**
.vscode-test/**
node_modules/**
typings/**
**/test/**
.gitignore
.gitattributes
tsconfig.json
package-lock.json
test/**
node_modules/**
typings/**
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Confluence Wiki Markup

## 0.1.4
* fix [List indenting @win](https://github.com/denco/vscode-confluence-markup/issues/6)
* restructure
* win/nix test files

## 0.1.3

* fix [nested lists](https://github.com/denco/vscode-confluence-markup/issues/7)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# 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/denco.confluence-markup.svg?style=flat-square)](https://marketplace.visualstudio.com/items?itemName=denco.confluence-markup)
[![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)
[![Ratings](https://vsmarketplacebadge.apphb.com/rating/denco.confluence-markdown.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)

Adds syntax highlighting, snippets and preview for Confluence® Wiki files in Visual Studio Code.

Expand Down
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
22 changes: 11 additions & 11 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.3",
"version": "0.1.4",
"publisher": "denco",
"description": "Confluence markup language support for Visual Studio Code",
"keywords": [
Expand All @@ -11,12 +11,12 @@
"wiki",
"markup"
],
"icon": "resources/logo/confluence-markup.png",
"icon": "media/logo/confluence-markup.png",
"author": {
"name": "denco"
},
"categories": [
"Languages",
"Programming Languages",
"Snippets"
],
"preview": true,
Expand All @@ -37,7 +37,7 @@
"onCommand:confluence.showPreviewToSide",
"onLanguage:confluence"
],
"main": "./out/src/extension",
"main": "./out/extension",
"contributes": {
"languages": [
{
Expand Down Expand Up @@ -116,13 +116,13 @@
"test": "npm run compile && node ./node_modules/vscode/bin/test"
},
"devDependencies": {
"@types/mocha": "^2.2.42",
"@types/node": "^7.0.59",
"eslint": "^4.15.0",
"tslint": "^5.9.1",
"typescript": "^2.6.1",
"vsce": "^1.40.0",
"vscode": "^1.1.6"
"@types/mocha": "^5.2.5",
"@types/node": "^10.10.1",
"eslint": "^5.6.0",
"tslint": "^5.11.0",
"typescript": "^3.0.3",
"vsce": "^1.51.0",
"vscode": "^1.1.21"
},
"__metadata": {
"publisherDisplayName": "denco"
Expand Down
7 changes: 5 additions & 2 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,11 @@ export function activate(context: vscode.ExtensionContext) {
});

vscode.workspace.onDidChangeTextDocument(e => {
if (e.document === vscode.window.activeTextEditor.document) {
contentProvider.update(packConfluenceUri(e.document.uri));
let editor = vscode.window.activeTextEditor;
if (editor) {
if (e.document === editor.document) {
contentProvider.update(packConfluenceUri(e.document.uri));
}
}
});

Expand Down
34 changes: 15 additions & 19 deletions src/markupParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import * as vscode from 'vscode';
import * as path from 'path';

const EXTENTION_ID = 'denco.confluence-markup';
const EMOTICON_PATH = '/resources/emoticons/';
const CSS_PATH = '/resources/css/';
const EMOTICON_PATH = '/media/emoticons/';
const CSS_PATH = '/media/css/';

function imageUri(searchUri: vscode.Uri, imageLink: string) {
let imageUri
Expand All @@ -19,16 +19,21 @@ function imageUri(searchUri: vscode.Uri, imageLink: string) {
return imageUri;
}

function getUri(filepath: string, filename: string){
let extension = vscode.extensions.getExtension(EXTENTION_ID);
if (extension) {
let extPath = extension.extensionPath;
let uri = vscode.Uri.file(path.join(extPath, filepath, filename));
return uri;
}
}

function emoticonUri(emoticonFile: string) {
let extPath = vscode.extensions.getExtension(EXTENTION_ID).extensionPath;
let emoticonUri = vscode.Uri.file(path.join(extPath, EMOTICON_PATH, emoticonFile));
return emoticonUri;
return getUri(EMOTICON_PATH, emoticonFile);
}

export function cssUri(cssFile: string) {
let extPath = vscode.extensions.getExtension(EXTENTION_ID).extensionPath;
let cssUri = vscode.Uri.file(path.join(extPath, CSS_PATH, cssFile));
return cssUri;
return getUri(CSS_PATH, cssFile);
}

export async function parseMarkup(sourceUri: vscode.Uri, sourceText: string) {
Expand All @@ -40,9 +45,9 @@ export async function parseMarkup(sourceUri: vscode.Uri, sourceText: string) {
let codeTagFlag = 0;
let tableFlag = false;
let listFlag = false;
let listArr = [];
let listArr: string[] = [];

for (let entry of sourceText.split(/\n/gi)) {
for (let entry of sourceText.split(/\r?\n/gi)) {
let tag = entry;
let html_tag = false;

Expand Down Expand Up @@ -157,9 +162,6 @@ export async function parseMarkup(sourceUri: vscode.Uri, sourceText: string) {
listArr.push(listTag);
}
if (match[1].length < listArr.length) {
// while (listArr.length > match[1].length) {
// tag += '</' + listArr.pop() + '>'
// }
tag = '</' + listArr.slice(match[1].length, listArr.length).reverse().join('></') +'>';
listArr = listArr.slice(0, match[1].length);
}
Expand All @@ -168,11 +170,7 @@ export async function parseMarkup(sourceUri: vscode.Uri, sourceText: string) {


if ((tag.length === 0) && (listArr.length > 0)) {
// if ((!listFlag) && (listArr.length > 0)) {
tag = '';
// do {
// tag += '</' + listArr.pop() + '>'
// } while (listArr.length > 0);
tag = '</' + listArr.reverse().join('></') + '>'
listArr = [];
listFlag = false;
Expand Down Expand Up @@ -206,8 +204,6 @@ export async function parseMarkup(sourceUri: vscode.Uri, sourceText: string) {
}

result += tag;

// console.log("PARSED:" + tag);
}

return result;
Expand Down
4 changes: 4 additions & 0 deletions src/test/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"telemetry.enableCrashReporter": false,
"telemetry.enableTelemetry": false
}
17 changes: 9 additions & 8 deletions test/extension.test.ts → src/test/extension.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,21 @@
// Note: This example test is leveraging the Mocha test framework.
// Please refer to their documentation on https://mochajs.org/ for help.
//

// The module 'assert' provides assertion methods from node
import * as assert from 'assert';

// You can import and use all API from the 'vscode' module
// as well as import your extension to test it
import * as vscode from 'vscode';
import * as myExtension from '../src/extension';
// import * as vscode from 'vscode';
// import * as myExtension from '../extension';

// Defines a Mocha test suite to group tests of similar kind together
suite("Extension Tests", () => {
suite("Extension Tests", function () {

// Defines a Mocha unit test
test("Something 1", () => {
assert.equal(-1, [1, 2, 3].indexOf(5));
assert.equal(-1, [1, 2, 3].indexOf(0));
});
// Defines a Mocha unit test
test("Something 1", function() {
assert.equal(-1, [1, 2, 3].indexOf(5));
assert.equal(-1, [1, 2, 3].indexOf(0));
});
});
7 changes: 4 additions & 3 deletions test/test.ts → src/test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@
// host can call to run the tests. The test runner is expected to use console.log
// to report the results back to the caller. When the tests are finished, return
// a possible error to the callback or null if none.
var testRunner = require('vscode/lib/testrunner');

import * as testRunner from 'vscode/lib/testrunner';

// You can directly control Mocha options by uncommenting the following lines
// See https://github.com/mochajs/mocha/wiki/Using-mocha-programmatically#set-options for more info
testRunner.configure({
ui: 'tdd', // the TDD UI is being used in extension.test.ts (suite, test, etc.)
useColors: true // colored output from test results
ui: 'tdd', // the TDD UI is being used in extension.test.ts (suite, test, etc.)
useColors: true // colored output from test results
});

module.exports = testRunner;
20 changes: 20 additions & 0 deletions src/test/testfiles/nix/issue_6.confluence
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
h1. TITLE

h2. Section One

Section one.

h2. Section Two

Section two.

# Numbered List 1
# Numbered List 2

h2. Section Three

Section three.

h2. Section Four

Section four.
53 changes: 53 additions & 0 deletions src/test/testfiles/nix/issues.confluence
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
h1. *Issues*

[#3|https://github.com/denco/vscode-confluence-markup/issues/3]: Noformat macro

{noformat}
$ date -R -v+1d
Sat, 10 Feb 2018 10:37:39 +0100
{noformat}

[#5|https://github.com/denco/vscode-confluence-markup/issues/5]: Table without heading

h4. Table without heading

|test|test|
|simple table|two|

[#6|https://github.com/denco/vscode-confluence-markup/issues/6]: Intenting

h4. Header Four
- list one
- list two
- list three

h4. next header (should not be indented)
* list
* list two

h3. third header
- one
- two

[#7|https://github.com/denco/vscode-confluence-markup/issues/7]: Nested lists

* el. 1
** el. 1.2.
** el. 1.3.
*** el. 1.3.1
* el. 2

- el. 1
-- el. 1.2.
-- el. 1.3.
--- el. 1.3.1
- el. 2

# el. 1
## el. 1.2.
## el. 1.3.
### el. 1.3.1
# el. 2

[#8|https://github.com/denco/vscode-confluence-markup/issues/8]:
Dublicate of [#5|https://github.com/denco/vscode-confluence-markup/issues/5]
11 changes: 11 additions & 0 deletions src/test/testfiles/nix/scoped/headings.confluence
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
h1. Heading 1

h2. Heading 2

h3. Heading 3

h4. Heading 4

h5. Heading 5

h6. Heading 6
Loading

0 comments on commit c70d292

Please sign in to comment.