Skip to content

Commit efe96a1

Browse files
committed
refactor: remove unused code blocks
1 parent c8d0b06 commit efe96a1

File tree

1 file changed

+0
-49
lines changed

1 file changed

+0
-49
lines changed

src/lib/helper.ts

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import * as fs from 'fs';
21
import * as vscode from 'vscode';
32

43
export const FORTRAN_KEYWORDS = [
@@ -15,45 +14,6 @@ export const FORTRAN_KEYWORDS = [
1514
'IMPLICIT',
1615
];
1716

18-
export const _loadDocString = (keyword: string) => {
19-
keyword = keyword.toUpperCase();
20-
21-
const docStringBuffer = fs.readFileSync(__dirname + '/../../../src/docs/' + keyword + '.html');
22-
let docText = docStringBuffer.toString();
23-
const codeRegex = /<code>(.+?)<\/code>\n?/g;
24-
const varRegex = /<var>(.+?)<\/var>/g;
25-
const spanRegex = /<samp><span class="command">(\w+)<\/span><\/samp>/g;
26-
const tableRegex = /<table\s*.*>([\s\w<>/\W]+?)<\/table>/g;
27-
const codeExampleRegex = /<code class="smallexample"[\s\W\w]*?>([\s\W\w<>]*?)<\/code>/g;
28-
const headerRegex = /^ *<h(\d)>(.+?)<\/h\1>\n?/gm;
29-
const defListRegex = /<dt>([\w\W]+?)<\/dt><dd>([\w\W]+?)(<br>)?<\/dd>/g;
30-
31-
docText = docText
32-
.replace(varRegex, (match, code: string) => {
33-
return '`' + code + '`';
34-
})
35-
.replace(spanRegex, (match, code) => `*${code}*`)
36-
.replace(defListRegex, (match, entry, def) => `**${entry}** ${def}\n`)
37-
.replace(codeExampleRegex, (match, code) => '```\n' + code + '\n\n```\n')
38-
.replace(/<td\s*.*?>([\s\w<>/\W]+?)<\/td>/g, (match, code) => ' | ' + code)
39-
.replace(/<tr\s*.*?>([\s\w<>/\W]+?)<\/tr>/g, (match, code) => code + '\n')
40-
.replace(/<tbody\s*.*?>([\s\w<>/\W]+?)<\/tbody>/g, (match, code) => code)
41-
.replace(tableRegex, (match, code) => code)
42-
.replace(codeRegex, (match, code: string) => {
43-
return '`' + code + '`';
44-
})
45-
.replace(/<p>\s*?/g, '\n')
46-
.replace(/<\/p>\s*?/g, '\n')
47-
.replace(headerRegex, (match, h: string, code: string) => {
48-
const headerLevel: number = parseInt(h);
49-
const header = '#'.repeat(headerLevel);
50-
return `${header} ${code}\n`;
51-
});
52-
docText = docText.replace(/^ *<br>\n?/gm, '\n').replace(/<\?dl>/g, '');
53-
console.log(docText);
54-
return docText;
55-
};
56-
5717
export function isPositionInString(
5818
document: vscode.TextDocument,
5919
position: vscode.Position
@@ -69,15 +29,6 @@ export function isPositionInString(
6929
return doubleQuotesCnt % 2 === 1;
7030
}
7131

72-
const saveKeywordToJson = keyword => {
73-
const doc = _loadDocString(keyword);
74-
const docObject = JSON.stringify({ keyword: keyword, docstr: doc });
75-
fs.appendFile('src/docs/' + keyword + '.json', docObject, function (err) {
76-
if (err) throw err;
77-
console.log('Saved!');
78-
});
79-
};
80-
8132
export const delay = (ms: number) => new Promise(res => setTimeout(res, ms));
8233

8334
export function isUri(input: any): input is vscode.Uri {

0 commit comments

Comments
 (0)