emacs-china / EGO

EGO is a static site generator that depends on Emacs, Git and Org-mode.
94 stars 11 forks source link

在标题含有“?”时无法正常生成网页 #83

Closed Liu233w closed 8 years ago

Liu233w commented 8 years ago

例: #+TITLE: HDU-2054 A == B ?

In buffer messages:

(:title HDU-2054 A == B ? :date 2016-07-08 :mod-date 2016-07-19 :description No Description :thumb nil :tags (acm 套路题) :year 2016 :authors (Liu233w) :category acm :uri /acm/2016/07/08/hdu-2054-a-==-b-?/ :pub-dir ~/.ego-tmp/acm/2016/07/08/hdu-2054-a-==-b-?/)
org-babel-exp process c++ at line 52...
mkdir: Creating directory: invalid argument, c:/TOTALCMD/tools/emacs/config/.ego-tmp/acm/2016/07/08/hdu-2054-a-==-b-?
kuangdash commented 8 years ago

URI 里面的问号是有特殊意义的,这点可见 https://en.wikipedia.org/wiki/Uniform_Resource_Identifier

这时需要在 org 文件里用 #+URI 重新设定路径格式

不过 :title 里面的内容不是 string 类型?我这边测试得到的都是 string 类型,这里好像没有问题。

lujun9972 commented 8 years ago

那么为什么不转义一下呢?

Liu233w commented 8 years ago

其实我的意思是希望ego能自动检测标题里的问号并处理的。。。

Liu233w commented 8 years ago

我把这个问题修复了,自动在生成URL的时候把?#替换成-,PR在#84 @kuangdash @lujun9972

lujun9972 commented 8 years ago

(url-encode-url URL)

Return a properly URI-encoded version of URL. This function also performs URI normalization, e.g. converting the scheme to lowercase if it is uppercase. Apart from normalization, if URL is already URI-encoded, this function should return it unchanged.

能不能用它转义?

Liu233w commented 8 years ago

ego--encode-string-to-url里面的文档有这一段

"Encode STRING to legal URL. Why we do not use url-encode-url' to encode the string, is thaturl-encode-url' will convert all not allowed characters into encoded ones, like %3E, but we do NOT want this kind of url."

我没看前面的代码,也不知道为什么“do NOT want this kind of url”