以foo /bar/ baz为例,当导出为HTML,就成了foo <i>bar</i> baz,现在我想将它与原来的风格导出foo /bar/ baz,如何实现这一目标?我试过了foo \/bar\/ baz,但输出变了foo \/bar\/ baz.
我知道这是一个简单的问题,我已经google了很多,但只找到这个:在org-mode中逃避管道字符,答案说斜线逃逸工作正常,但对我来说,似乎不太好.
编辑:
搜索组织模式邮件列表后,我在这里找到了一个讨论和解决方案:http://thread.gmane.org/gmane.emacs.orgmode/50743
有两种方法可以做到这一点:
#+OPTIONS: *:nil以关闭所有强调符号org-emphasis-alist,删除相关内容对我来说,第一种解决方案是可以接受的,也很简单.
假设在库中定义了一个样本函数(这个问题的前提条件是该库中的所有定义都不能被修改,类似于"只读"):
(defun sample ()
(foo)
(bar)
(baz))
Run Code Online (Sandbox Code Playgroud)
我想使用这个库,但功能sample无法满足我的要求,我想要的是:
(defun sample ()
(foo)
(when condition
(bar))
(baz))
Run Code Online (Sandbox Code Playgroud)
有人告诉我使用defadvice,但我注意到defadvice只能在调用之前或之后插入代码sample,例如:
(before-advice ...)
(sample)
(after-advice ...)
Run Code Online (Sandbox Code Playgroud)
它不能修改sample自己的定义.那么,我怎样才能慷慨地实现这一目标呢?我是否应该重写sample自己,称为my-sample或sample2?
我正在实现一个 Rust 库,它需要一个异步 mpsc 通道,但是,我不想依赖于任何特定的async运行时(例如tokio,smol),我想让库的用户选择使用哪个,所以我定义特征:
struct Job { ... }
trait Sender {
fn send(&mut self, job: Job);
}
trait Receiver {
fn recv(&mut self) -> Future<Output = Option<Job>>;
}
fn foo(tx: impl Sender, rx: impl Receiver) {
// ...
}
Run Code Online (Sandbox Code Playgroud)
然而,库用户必须在实际使用的运行时创建大量包装器,例如 tokio:
// We have to create wrappers here, as both `mylib::Sender`
// and `tokio::Sender` are from third party libraries, we
// cannot implement `mylib::Sender` for `tokio::Sender` directly.
struct TokioSender(tokio::Sender);
struct TokioReceiver(tokio::Receiver);
impl …Run Code Online (Sandbox Code Playgroud)