• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript strings.escape函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中vs/base/common/strings.escape函数的典型用法代码示例。如果您正苦于以下问题:TypeScript escape函数的具体用法?TypeScript escape怎么用?TypeScript escape使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了escape函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: render

	private render(): void {

		let htmlContent = '';
		let pos = 0;

		for (const highlight of this.highlights) {
			if (highlight.end === highlight.start) {
				continue;
			}
			if (pos < highlight.start) {
				htmlContent += '<span>';
				const substring = this.text.substring(pos, highlight.start);
				htmlContent += this.supportOcticons ? renderOcticons(substring) : escape(substring);
				htmlContent += '</span>';
				pos = highlight.end;
			}
			htmlContent += '<span class="highlight">';
			const substring = this.text.substring(highlight.start, highlight.end);
			htmlContent += this.supportOcticons ? renderOcticons(substring) : escape(substring);
			htmlContent += '</span>';
			pos = highlight.end;
		}

		if (pos < this.text.length) {
			htmlContent += '<span>';
			const substring = this.text.substring(pos);
			htmlContent += this.supportOcticons ? renderOcticons(substring) : escape(substring);
			htmlContent += '</span>';
		}

		this.domNode.innerHTML = htmlContent;
		this.domNode.title = this.title;
		this.didEverRender = true;
	}
开发者ID:PKRoma,项目名称:vscode,代码行数:34,代码来源:highlightedLabel.ts


示例2: render

	private render() {
		dom.clearNode(this.domNode);

		let htmlContent: string[] = [];
		let pos = 0;

		for (const highlight of this.highlights) {
			if (highlight.end === highlight.start) {
				continue;
			}
			if (pos < highlight.start) {
				htmlContent.push('<span>');
				const substring = this.text.substring(pos, highlight.start);
				htmlContent.push(this.supportOcticons ? renderOcticons(substring) : escape(substring));
				htmlContent.push('</span>');
				pos = highlight.end;
			}
			htmlContent.push('<span class="highlight">');
			const substring = this.text.substring(highlight.start, highlight.end);
			htmlContent.push(this.supportOcticons ? renderOcticons(substring) : escape(substring));
			htmlContent.push('</span>');
			pos = highlight.end;
		}

		if (pos < this.text.length) {
			htmlContent.push('<span>');
			const substring = this.text.substring(pos);
			htmlContent.push(this.supportOcticons ? renderOcticons(substring) : escape(substring));
			htmlContent.push('</span>');
		}

		this.domNode.innerHTML = htmlContent.join('');
		this.domNode.title = this.title;
		this.didEverRender = true;
	}
开发者ID:kumarharsh,项目名称:vscode,代码行数:35,代码来源:highlightedLabel.ts


示例3: render

	private render() {
		dom.clearNode(this.domNode);

		let htmlContent: string[] = [],
			highlight: IHighlight,
			pos = 0;

		for (let i = 0; i < this.highlights.length; i++) {
			highlight = this.highlights[i];
			if (highlight.end === highlight.start) {
				continue;
			}
			if (pos < highlight.start) {
				htmlContent.push('<span>')
				htmlContent.push(expandOcticons(escape(this.text.substring(pos, highlight.start))));
				htmlContent.push('</span>')
				pos = highlight.end;
			}
			htmlContent.push('<span class="highlight">')
			htmlContent.push(expandOcticons(escape(this.text.substring(highlight.start, highlight.end))));
			htmlContent.push('</span>')
			pos = highlight.end;
		}

		if (pos < this.text.length) {
			htmlContent.push('<span>')
			htmlContent.push(expandOcticons(escape(this.text.substring(pos))));
			htmlContent.push('</span>')
		}

		this.domNode.innerHTML = htmlContent.join('');
		this.didEverRender = true;
	}
开发者ID:sangohan,项目名称:KodeStudio,代码行数:33,代码来源:highlightedLabel.ts


示例4: _tokenizeToString

function _tokenizeToString(text: string, tokenizationSupport: ITokenizationSupport): string {
	let result = `<div class="monaco-tokenized-source">`;
	let lines = text.split(/\r\n|\r|\n/);
	let currentState = tokenizationSupport.getInitialState();
	for (let i = 0, len = lines.length; i < len; i++) {
		let line = lines[i];

		if (i > 0) {
			result += `<br/>`;
		}

		let tokenizationResult = tokenizationSupport.tokenize2(line, currentState, 0);
		let lineTokens = new LineTokens(null, tokenizationResult.tokens, line);
		let viewLineTokens = lineTokens.inflate();

		let startOffset = 0;
		let className = viewLineTokens[0].type;

		for (let j = 1, lenJ = viewLineTokens.length; j < lenJ; j++) {
			let viewLineToken = viewLineTokens[j];

			result += `<span class="${className}">${strings.escape(line.substring(startOffset, viewLineToken.startIndex))}</span>`;
			startOffset = viewLineToken.startIndex;
			className = viewLineToken.type;
		}
		result += `<span class="${className}">${strings.escape(line.substring(startOffset))}</span>`;

		currentState = tokenizationResult.endState;
	}

	result += `</div>`;
	return result;
}
开发者ID:fs814,项目名称:vscode,代码行数:33,代码来源:textToHtmlTokenizer.ts


示例5: _tokenizeToString

function _tokenizeToString(text: string, tokenizationSupport: ITokenizationSupport): string {
	let result = `<div class="monaco-tokenized-source">`;
	let lines = text.split(/\r\n|\r|\n/);
	let currentState = tokenizationSupport.getInitialState();
	for (let i = 0, len = lines.length; i < len; i++) {
		let line = lines[i];

		if (i > 0) {
			result += `<br/>`;
		}

		let tokenizationResult = tokenizationSupport.tokenize2(line, currentState, 0);
		LineTokens.convertToEndOffset(tokenizationResult.tokens, line.length);
		let lineTokens = new LineTokens(tokenizationResult.tokens, line);
		let viewLineTokens = lineTokens.inflate();

		let startOffset = 0;
		for (let j = 0, lenJ = viewLineTokens.getCount(); j < lenJ; j++) {
			const type = viewLineTokens.getClassName(j);
			const endIndex = viewLineTokens.getEndOffset(j);
			result += `<span class="${type}">${strings.escape(line.substring(startOffset, endIndex))}</span>`;
			startOffset = endIndex;
		}

		currentState = tokenizationResult.endState;
	}

	result += `</div>`;
	return result;
}
开发者ID:AllureFer,项目名称:vscode,代码行数:30,代码来源:textToHtmlTokenizer.ts


示例6:

		renderer.code = (code, lang) => {
			const value = options.codeBlockRenderer(lang, code);
			// when code-block rendering is async we return sync
			// but update the node with the real result later.
			const id = defaultGenerator.nextId();

			// {{SQL CARBON EDIT}} - Promise.all not returning the strValue properly in original code?
			const promise = value.then(strValue => {
				withInnerHTML.then(e => {
					const span = element.querySelector(`div[data-code="${id}"]`);
					if (span) {
						span.innerHTML = strValue;
					}
				}).catch(err => {
					// ignore
				});
			});

			// original VS Code source
			// const promise = Promise.all([value, withInnerHTML]).then(values => {
			// 	const strValue = values[0];
			// 	const span = element.querySelector(`div[data-code="${id}"]`);
			// 	if (span) {
			// 		span.innerHTML = strValue;
			// 	}
			// }).catch(err => {
			// 	// ignore
			// });

			if (options.codeBlockRenderCallback) {
				promise.then(options.codeBlockRenderCallback);
			}

			return `<div class="code" data-code="${id}">${escape(code)}</div>`;
		};
开发者ID:burhandodhy,项目名称:azuredatastudio,代码行数:35,代码来源:htmlContentRenderer.ts


示例7:

		renderer.code = (code, lang) => {
			const value = options.codeBlockRenderer!(lang, code);
			// when code-block rendering is async we return sync
			// but update the node with the real result later.
			const id = defaultGenerator.nextId();
			const promise = Promise.all([value, withInnerHTML]).then(values => {
				const strValue = values[0];
				const span = element.querySelector(`div[data-code="${id}"]`);
				if (span) {
					span.innerHTML = strValue;
				}
			}).catch(err => {
				// ignore
			});

			if (options.codeBlockRenderCallback) {
				promise.then(options.codeBlockRenderCallback);
			}

			return `<div class="code" data-code="${id}">${escape(code)}</div>`;
		};
开发者ID:DonJayamanne,项目名称:vscode,代码行数:21,代码来源:htmlContentRenderer.ts


示例8:

		renderer.code = (code, lang) => {
			const value = options.codeBlockRenderer(lang, code);
			if (typeof value === 'string') {
				return value;
			}

			if (TPromise.is(value)) {
				// when code-block rendering is async we return sync
				// but update the node with the real result later.
				const id = defaultGenerator.nextId();
				TPromise.join([value, withInnerHTML]).done(values => {
					const strValue = values[0] as string;
					const span = element.querySelector(`div[data-code="${id}"]`);
					if (span) {
						span.innerHTML = strValue;
					}
				}, err => {
					// ignore
				});
				return `<div class="code" data-code="${id}">${escape(code)}</div>`;
			}

			return code;
		};
开发者ID:gokulakrishna9,项目名称:vscode,代码行数:24,代码来源:htmlContentRenderer.ts


示例9:

	var emitToken = (className: string, tokenText: string) => {
		result += '<span class="' + className + extraTokenClass + '">' + strings.escape(tokenText) + '</span>';
	};
开发者ID:GYGit,项目名称:vscode,代码行数:3,代码来源:textToHtmlTokenizer.ts


示例10: default

export default () => `
<div class="welcomePageContainer">
	<div class="welcomePage">
		<div class="title">
			<h1>${escape(localize('welcomePage.vscode', "Visual Studio Code"))}</h1>
			<p class="subtitle">${escape(localize('welcomePage.editingEvolved', "Editing evolved"))}</p>
		</div>
		<div class="row">
			<div class="splash">
				<div class="section start">
					<h2>${escape(localize('welcomePage.start', "Start"))}</h2>
					<ul>
						<li><a href="command:workbench.action.files.newUntitledFile">${escape(localize('welcomePage.newFile', "New file"))}</a></li>
						<li class="mac-only"><a href="command:workbench.action.files.openFileFolder">${escape(localize('welcomePage.openFolder', "Open folder..."))}</a></li>
						<li class="windows-only linux-only"><a href="command:workbench.action.files.openFolder">${escape(localize('welcomePage.openFolder', "Open folder..."))}</a></li>
						<li><a href="command:git.clone">${escape(localize('welcomePage.cloneGitRepository', "Clone Git repository..."))}</a></li>
					</ul>
				</div>
				<div class="section recent">
					<h2>${escape(localize('welcomePage.recent', "Recent"))}</h2>
					<ul class="list">
						<!-- Filled programmatically -->
						<li class="moreRecent"><a href="command:workbench.action.openRecent">${escape(localize('welcomePage.moreRecent', "More..."))}</a><span class="path if_shortcut" data-command="workbench.action.openRecent">(<span class="shortcut" data-command="workbench.action.openRecent"></span>)</span></li>
					</ul>
					<p class="none">${escape(localize('welcomePage.noRecentFolders', "No recent folders"))}</p>
				</div>
				<div class="section help">
					<h2>${escape(localize('welcomePage.help', "Help"))}</h2>
					<ul>
						<li class="keybindingsReferenceLink"><a href="command:workbench.action.keybindingsReference">${escape(localize('welcomePage.keybindingsCheatsheet', "Printable keyboard cheatsheet"))}</a></li>
						<li><a href="command:workbench.action.openIntroductoryVideosUrl">${escape(localize('welcomePage.introductoryVideos', "Introductory videos"))}</a></li>
						<li><a href="command:workbench.action.openDocumentationUrl">${escape(localize('welcomePage.productDocumentation', "Product documentation"))}</a></li>
						<li><a href="https://github.com/Microsoft/vscode">${escape(localize('welcomePage.gitHubRepository', "GitHub repository"))}</a></li>
						<li><a href="http://stackoverflow.com/questions/tagged/vscode?sort=votes&pageSize=50">${escape(localize('welcomePage.stackOverflow', "Stack Overflow"))}</a></li>
					</ul>
				</div>
				<p class="showOnStartup"><input type="checkbox" id="showOnStartup"> <label for="showOnStartup">${escape(localize('welcomePage.showOnStartup', "Show welcome page on startup"))}</label></p>
			</div>
			<div class="commands">
				<div class="section customize">
					<h2>${escape(localize('welcomePage.customize', "Customize"))}</h2>
					<ul>
						<li class="showExtensionPacks"><button data-href="command:workbench.extensions.action.showExtensionPacks"><h3>${escape(localize('welcomePage.installExtensionPacks', "Tools and languages"))}</h3> <span>${escape(localize('welcomePage.installExtensionPacksDescription', "Install support for {0} and {1}"))
		.replace('{0}', `<span class="extensionPackList"></span>`)
		.replace('{1}', `<a href="command:workbench.extensions.action.showExtensionPacks">${escape(localize('welcomePage.moreExtensions', "more"))}</a>`)}
						</span></button></li>
						<li class="showRecommendedKeymapExtensions"><button data-href="command:workbench.extensions.action.showRecommendedKeymapExtensions"><h3>${escape(localize('welcomePage.installKeymapDescription', "Install keyboard shortcuts"))}</h3> <span>${escape(localize('welcomePage.installKeymapExtension', "Install the keyboard shortcuts of {0} and {1}"))
		.replace('{0}', `<span class="keymapList"></span>`)
		.replace('{1}', `<a href="command:workbench.extensions.action.showRecommendedKeymapExtensions">${escape(localize('welcomePage.others', "others"))}</a>`)}
						</span></button></li>
						<li class="selectTheme"><button data-href="command:workbench.action.selectTheme"><h3>${escape(localize('welcomePage.colorTheme', "Color theme"))}</h3> <span>${escape(localize('welcomePage.colorThemeDescription', "Make the editor and your code look the way you love"))}</span></button></li>
					</ul>
				</div>
				<div class="section learn">
					<h2>${escape(localize('welcomePage.learn', "Learn"))}</h2>
					<ul>
						<li class="showCommands"><button data-href="command:workbench.action.showCommands"><h3>${escape(localize('welcomePage.showCommands', "Find and run all commands"))}</h3> <span>${escape(localize('welcomePage.showCommandsDescription', "Rapidly access and search commands from the control panel ({0})")).replace('{0}', '<span class="shortcut" data-command="workbench.action.showCommands"></span>')}</span></button></li>
						<li class="showInterfaceOverview"><button data-href="command:workbench.action.showInterfaceOverview"><h3>${escape(localize('welcomePage.interfaceOverview', "Interface overview"))}</h3> <span>${escape(localize('welcomePage.interfaceOverviewDescription', "Get a visual overlay highlighting the major components of the UI"))}</span></button></li>
						<li class="showInteractivePlayground"><button data-href="command:workbench.action.showInteractivePlayground"><h3>${escape(localize('welcomePage.interactivePlayground', "Interactive playground"))}</h3> <span>${escape(localize('welcomePage.interactivePlaygroundDescription', "Try essential editor features out in a short walkthrough"))}</span></button></li>
					</ul>
				</div>
				<div class="section quickLinks">
					<h2>${escape(localize('welcomePage.quickLinks', "Quick links"))}</h2>
					<ul>
						<li class="keybindingsReference"><button data-href="command:workbench.action.keybindingsReference"><h3>${escape(localize('welcomePage.keybindingsReference', "Keyboard shortcuts reference"))}</h3> <span>${escape(localize('welcomePage.keybindingsReferenceDescription', "A printable PDF with the most common keyboard shortcuts"))}</span></button></li>
						<li class="openGlobalSettings"><button data-href="command:workbench.action.openGlobalSettings"><h3>${escape(localize('welcomePage.configureSettings', "Configure settings"))}</h3> <span>${escape(localize('welcomePage.configureSettingsDescription', "Unlock the full power of VS Code by tweaking the settings"))}</span></button></li>
					</ul>
				</div>
			</div>
		</div>
	</div>
</div>
`;
开发者ID:jhasse,项目名称:vscode,代码行数:73,代码来源:vs_code_welcome_page.ts



注:本文中的vs/base/common/strings.escape函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript strings.escapeRegExpCharacters函数代码示例发布时间:2022-05-25
下一篇:
TypeScript strings.equalsIgnoreCase函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap