Skip to content

Commit 204d162

Browse files
committed
Output selected text in SpeechMarkdown output channel
1 parent 8b9437b commit 204d162

File tree

3 files changed

+73
-53
lines changed

3 files changed

+73
-53
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

88
## [Unreleased]
9-
9+
- Output selected text in SpeechMarkdown output channel
1010
- Known issue with phonemes in ipa tags that include quotes
1111

1212
## [0.0.8] - 2020-07-14

src/extension.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,14 @@ let jsCentralProvider = new JSHoverProvider();
1313

1414
export function activate(context: vscode.ExtensionContext) {
1515

16-
16+
try
17+
{
1718
var outProv = new smdOutputProvider();
1819

1920
context.subscriptions.push(
2021
vscode.commands.registerCommand('extension.speechmarkdownpreview', () => {
2122
const editor = vscode.window.activeTextEditor;
23+
2224
if (editor !== undefined) {
2325

2426
let selection : string = editor.document.getText(editor.selection);
@@ -77,7 +79,11 @@ export function activate(context: vscode.ExtensionContext) {
7779
)
7880
);
7981

82+
} catch(ex)
83+
{
84+
console.error(ex);
8085

86+
}
8187

8288
/*
8389
context.subscriptions.push(

src/smdOutputProvider.ts

+65-51
Original file line numberDiff line numberDiff line change
@@ -16,64 +16,78 @@ export default class {
1616
let speechOpts : SpeechOptions = { platform: "amazon-alexa" };
1717
speechOpts.includeSpeakTag = false;
1818

19-
20-
var output : string = 'Alexa: \n';
21-
22-
var speechOut : string = '';
19+
var output : string = 'Speech Mardown text: \n';
2320

24-
try
21+
if(smdText.length == 0)
2522
{
26-
speechOut = speech.toSSML(smdText, speechOpts);
23+
output = 'No text selected';
2724
}
28-
catch(ex)
25+
else
2926
{
30-
speechOut = ex;
31-
}
3227

33-
output +=speechOut;
28+
output += smdText;
29+
output += '\n------------------------\n';
30+
31+
var speechOut : string = '';
32+
33+
try
34+
{
35+
speechOut = speech.toSSML(smdText, speechOpts);
36+
}
37+
catch(ex)
38+
{
39+
speechOut = ex;
40+
}
41+
42+
output +='\n\nAlexa: \n';
43+
output +=speechOut;
44+
output +='\n';
45+
46+
47+
speechOpts.platform = "google-assistant";
48+
try
49+
{
50+
speechOut = speech.toSSML(smdText, speechOpts);
51+
}
52+
catch(ex)
53+
{
54+
speechOut = ex;
55+
}
56+
57+
output +='\n\nGoogle Assistant: \n';
58+
output +=speechOut;
59+
output +='\n';
60+
61+
62+
speechOpts.platform = "samsung-bixby";
63+
try
64+
{
65+
speechOut = speech.toSSML(smdText, speechOpts);
66+
}
67+
catch(ex)
68+
{
69+
speechOut = ex;
70+
}
71+
72+
output +='\nSamsung Bixby: \n';
73+
output +=speechOut;
74+
output +='\n';
75+
76+
77+
try
78+
{
79+
speechOut = speech.toSSML(smdText);
80+
}
81+
catch(ex)
82+
{
83+
speechOut = ex;
84+
}
85+
86+
output +='\nPlain Text: \n';
87+
output +=speechOut;
88+
output +='\n';
3489

35-
speechOpts.platform = "google-assistant";
36-
try
37-
{
38-
speechOut = speech.toSSML(smdText, speechOpts);
39-
}
40-
catch(ex)
41-
{
42-
speechOut = ex;
43-
}
44-
45-
output +='\n\nGoogle Assistant: \n';
46-
output +=speechOut;
47-
output +='\n';
48-
49-
50-
speechOpts.platform = "samsung-bixby";
51-
try
52-
{
53-
speechOut = speech.toSSML(smdText, speechOpts);
5490
}
55-
catch(ex)
56-
{
57-
speechOut = ex;
58-
}
59-
60-
output +='\nSamsung Bixby: \n';
61-
output +=speechOut;
62-
output +='\n';
63-
64-
65-
try
66-
{
67-
speechOut = speech.toSSML(smdText);
68-
}
69-
catch(ex)
70-
{
71-
speechOut = ex;
72-
}
73-
74-
output +='\nPlain Text: \n';
75-
output +=speechOut;
76-
output +='\n';
7791
outChannel.clear();
7892
outChannel.append(output);
7993
outChannel.show(true);

0 commit comments

Comments
 (0)