Fix comments: comments must start with #\s not just #
This commit is contained in:
parent
16ccafe8a3
commit
c025db7bdd
5 changed files with 9 additions and 2 deletions
|
@ -35,7 +35,7 @@ type Include struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
var keywordRegexp = regexp.MustCompile(`^(\s*)#\+([^:]+):(\s+(.*)|$)`)
|
var keywordRegexp = regexp.MustCompile(`^(\s*)#\+([^:]+):(\s+(.*)|$)`)
|
||||||
var commentRegexp = regexp.MustCompile(`^(\s*)#(.*)`)
|
var commentRegexp = regexp.MustCompile(`^(\s*)#\s(.*)`)
|
||||||
|
|
||||||
var includeFileRegexp = regexp.MustCompile(`(?i)^"([^"]+)" (src|example|export) (\w+)$`)
|
var includeFileRegexp = regexp.MustCompile(`(?i)^"([^"]+)" (src|example|export) (\w+)$`)
|
||||||
var attributeRegexp = regexp.MustCompile(`(?:^|\s+)(:[-\w]+)\s+(.*)$`)
|
var attributeRegexp = regexp.MustCompile(`(?:^|\s+)(:[-\w]+)\s+(.*)$`)
|
||||||
|
|
|
@ -207,7 +207,7 @@ func (w *OrgWriter) WriteNodeWithName(n NodeWithName) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *OrgWriter) WriteComment(c Comment) {
|
func (w *OrgWriter) WriteComment(c Comment) {
|
||||||
w.WriteString(w.indent + "#" + c.Content + "\n")
|
w.WriteString(w.indent + "# " + c.Content + "\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *OrgWriter) WriteList(l List) { WriteNodes(w, l.Items...) }
|
func (w *OrgWriter) WriteList(l List) { WriteNodes(w, l.Items...) }
|
||||||
|
|
1
org/testdata/keywords.html
vendored
1
org/testdata/keywords.html
vendored
|
@ -25,3 +25,4 @@ named block
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<p>#not a comment because there's no space after the hashtag</p>
|
||||||
|
|
3
org/testdata/keywords.org
vendored
3
org/testdata/keywords.org
vendored
|
@ -20,3 +20,6 @@ named paragraph
|
||||||
#+begin_src
|
#+begin_src
|
||||||
named block
|
named block
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
# comments must have whitespace after the hashtag
|
||||||
|
#not a comment because there's no space after the hashtag
|
||||||
|
|
3
org/testdata/keywords.pretty_org
vendored
3
org/testdata/keywords.pretty_org
vendored
|
@ -20,3 +20,6 @@ named paragraph
|
||||||
#+BEGIN_SRC
|
#+BEGIN_SRC
|
||||||
named block
|
named block
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
|
# comments must have whitespace after the hashtag
|
||||||
|
#not a comment because there's no space after the hashtag
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue