cjlee112/spnet — pull request #99 by ketch (2013-10-15 17:29:05+00:00)
Title: New hashtag parsing, for posts with multiple references

This PR implements new routines for parsing hashtags in posts, with the following features:

- Resolves #80 by correctly identifying the first paper referenced after the #spnetwork tag (the current code does not)
- Resolves issue #98 by patching the DOI regex
- Parses multiple references and assigns an adjacent tag to each

Implicit in the PR is a language for referencing papers in SPnet posts. This language follows my understanding of what has been decided by the developers so far. Specifically:

- Each post must contain the #spnetwork hashtag. The first paper referenced after the post is considered the primary reference.
- Each paper reference may also be immediately preceded by one of the following "semantic" hashtags: #recommend, #mustread, #discuss, or #announce. In this case, that tag is attached to that particular reference.
- If no semantic hashtag is provided for a given reference, the default #discuss is assigned.

As an example, the new code correctly parses this (from [my post here](https://plus.google.com/116021515467243730737/posts/Jc2YVNBc5R4):

```
#spnetwork #recommend doi:10.1007/BF01389633

#discuss doi:10.1147/rd.112.0215
#discuss doi:10.1007/BF01932030
#numericalAnalysis
```

Note that G+ renders this as HTML, so HTML tags appear in the raw string that must be processed. Also note that this post was not processed correctly by the current code; see https://selectedpapers.net/posts/z12xvr0qokfvwtbvd22sjl5ogtjyjz2c4 where the comment is assigned to the wrong paper (it is not assigned to the first reference following #spnetwork).

I think there should be a discussion of the syntax for tagging, so this PR should be viewed as a starting point for conversation. Also, I touched a significant amount of code and this is my first major contribution, so I'd appreciate it being closely reviewed by the experts. I did add some tests, including things that fail under the old code.