问题标签 [brail]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
3163 浏览

asp.net-mvc - How to use multiple view engines in ASP.NET MVC application

I'd like to use two view engines in my asp.net mvc web application. The first one is the Brail view engine from MVCContrib project, and another one is my custom view engine for generating javascript code. However, I can't configure the application to use both engines. I'd like to use view file extension to discern which engine should handle the request - .brail for Brail engine - .json - for my custom engine

When I add two engines to the ViewEngines collection in global.asax.cs, the system is always looking for *.brail views and throws exception if it doesn't find one. It never looks for my *.json views... Is it a problem with the ASP.Net mvc framework, with Brail view engine or with my code? How should it be handled?

0 投票
1 回答
1779 浏览

code-generation - 如何将 Brail 用作独立的通用模板引擎(如 NVelocity)?

我一直在我的文本文件生成器中使用 NVelocity 作为独立的模板引擎。NVelocity 的问题在于宏非常不稳定。我得到的几乎所有错误都来自错误的宏实现。

如果我可以使用其他一些模板引擎,例如 Brail,那就太酷了。这样我只需要编写输出字符串的函数。

嵌入 Brail 引擎的最佳方法是什么?我想只传递一个包含模板的字符串(不是从磁盘读取),并且我想最小化外部依赖项的数量。

编辑:我自己找到了答案。看看这个来自 Castle 的源文件

0 投票
5 回答
1203 浏览

.net - .NET Hashtable - “相同”键,不同的哈希

两个 .net 字符串是否有可能具有不同的哈希值?我有一个哈希表,其中包括关键的“路径”。当我循环遍历表中的元素以打印它时,我可以看到密钥存在。

然而,当试图查找它时,没有匹配的元素。调试表明我正在寻找的字符串与我作为键提供的字符串具有不同的哈希值。

此代码位于 Castle Monorail 项目中,使用 brail 作为视图引擎。我正在寻找的钥匙是由这样的盲文线插入的:

然后,在此方法中(在自定义 IRoutingRule 中):

密钥被打印到日志中,但函数返回 null。我不知道这甚至可能是 .net 字符串的问题,但我想这是某种编码问题?

哦,这是运行单声道。

根据要求,这是日志中的相关行:

另外,在这里我在日志打印调用上方添加了一行代码:

查看日志,您会注意到有两个“路径”键。调试器在表的不同位置显示这两个键。

0 投票
1 回答
78 浏览

castle-monorail - 如何将焦点设置到刚刚将其插入我的页面的文本框?

我有一个动态网页,单击链接后,我使用 brailjs 操作将部分视图插入到我的页面中。我的 brailjs 视图看起来像这样

插入 html 后,我希望能够将焦点设置到刚刚插入的文本框之一。我怎样才能做到这一点?