Merge pull request #275 from pubs/tagcomma

Tagcomma
main
Fabien C. Y. Benureau 3 years ago committed by GitHub
commit 59be47ca91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -8,6 +8,7 @@
### Implemented enhancements ### Implemented enhancements
- Possibily to exclude bibtext field when adding references ([#273](https://github.com/pubs/pubs/pull/273) by [Mitsuhiro Nakamura](https://github.com/m15a)) - Possibily to exclude bibtext field when adding references ([#273](https://github.com/pubs/pubs/pull/273) by [Mitsuhiro Nakamura](https://github.com/m15a))
- Less ambiguous tag display for tags with space ([#265](https://github.com/pubs/pubs/pull/265) by [Florian Richoux](https://github.com/richoux))
- Migration from Travis CI to Github actions ([#260](https://github.com/pubs/pubs/pull/260)) - Migration from Travis CI to Github actions ([#260](https://github.com/pubs/pubs/pull/260))
- Allow passing named arguments to custom commands ([#241](https://github.com/pubs/pubs/pull/241) by [jkulhanek](https://github.com/jkulhanek)) - Allow passing named arguments to custom commands ([#241](https://github.com/pubs/pubs/pull/241) by [jkulhanek](https://github.com/jkulhanek))
- Added support for non-standard bibtex types, e.g. @collection, @software, etc. ([#226](https://github.com/pubs/pubs/pull/226)) - Added support for non-standard bibtex types, e.g. @collection, @software, etc. ([#226](https://github.com/pubs/pubs/pull/226))

@ -22,7 +22,7 @@ _IGNORING_MSG = " Ignoring it."
def parser(subparsers, conf): def parser(subparsers, conf):
parser = subparsers.add_parser( parser = subparsers.add_parser(
'import', 'import',
help='import paper(s) to the repository.') help='import paper(s) to the repository')
parser.add_argument( parser.add_argument(
'bibpath', 'bibpath',
help=("path to bibtex, bibtexml or bibyaml file, or a directory " help=("path to bibtex, bibtexml or bibyaml file, or a directory "

@ -6,7 +6,7 @@ from .. import color
def parser(subparsers, conf): def parser(subparsers, conf):
parser = subparsers.add_parser( parser = subparsers.add_parser(
'statistics', 'statistics',
help="show statistics on the repository.") help="show statistics on the repository")
return parser return parser

@ -87,7 +87,7 @@ def command(conf, args):
rp = Repository(conf) rp = Repository(conf)
if citekeyOrTag is None: if citekeyOrTag is None:
ui.message(color.dye_out(' '.join(sorted(rp.get_tags())), 'tag')) ui.message(color.dye_out(', '.join(sorted(rp.get_tags())), 'tag'))
else: else:
not_citekey = False not_citekey = False
try: try:
@ -97,7 +97,7 @@ def command(conf, args):
if not not_citekey: if not not_citekey:
p = rp.pull_paper(citekeyOrTag) p = rp.pull_paper(citekeyOrTag)
if tags is None: if tags is None:
ui.message(color.dye_out(' '.join(sorted(p.tags)), 'tag')) ui.message(color.dye_out(', '.join(sorted(p.tags)), 'tag'))
else: else:
add_tags, remove_tags = _tag_groups(_parse_tag_seq(tags)) add_tags, remove_tags = _tag_groups(_parse_tag_seq(tags))
for tag in add_tags: for tag in add_tags:

@ -78,7 +78,7 @@ def paper_oneliner(p, citekey_only=False, max_authors=3):
else 'NOEXT'), else 'NOEXT'),
'tag') 'tag')
tags = '' if len(p.tags) == 0 else '| {}'.format( tags = '' if len(p.tags) == 0 else '| {}'.format(
','.join(color.dye_out(t, 'tag') for t in sorted(p.tags))) ', '.join(color.dye_out(t, 'tag') for t in sorted(p.tags)))
return '[{citekey}] {descr}{doc} {tags}'.format( return '[{citekey}] {descr}{doc} {tags}'.format(
citekey=color.dye_out(p.citekey, 'citekey'), citekey=color.dye_out(p.citekey, 'citekey'),
descr=bibdesc, tags=tags, doc=doc_str) descr=bibdesc, tags=tags, doc=doc_str)

@ -187,4 +187,5 @@ You can access the self-documented configuration by using `pubs conf`, and all t
- [Jonáš Kulhánek](https://github.com/jkulhanek) - [Jonáš Kulhánek](https://github.com/jkulhanek)
- [Dominik Stańczak](https://github.com/StanczakDominik) - [Dominik Stańczak](https://github.com/StanczakDominik)
- [Gustavo José de Sousa](https://github.com/guludo) - [Gustavo José de Sousa](https://github.com/guludo)
- [Florian Richoux](https://github.com/richoux)
- [Mitsuhiro Nakamura](https://github.com/m15a) - [Mitsuhiro Nakamura](https://github.com/m15a)

@ -602,7 +602,7 @@ class TestTag(DataCommandTestCase):
'pubs list', 'pubs list',
] ]
correct = ['', correct = ['',
'[Page99] Page, Lawrence et al. "The PageRank Citation Ranking: Bringing Order to the Web." (1999) | network,search\n' + '[Page99] Page, Lawrence et al. "The PageRank Citation Ranking: Bringing Order to the Web." (1999) | network, search\n' +
'[Turing1950] Turing, Alan M "Computing machinery and intelligence" Mind (1950) \n', '[Turing1950] Turing, Alan M "Computing machinery and intelligence" Mind (1950) \n',
] ]
out = self.execute_cmds(cmds) out = self.execute_cmds(cmds)
@ -750,9 +750,9 @@ class TestUsecase(DataCommandTestCase):
'[Page99] Page, Lawrence et al. "The PageRank Citation Ranking: Bringing Order to the Web." (1999) [pdf] \n', '[Page99] Page, Lawrence et al. "The PageRank Citation Ranking: Bringing Order to the Web." (1999) [pdf] \n',
'\n', '\n',
'', '',
'network search\n', 'network, search\n',
'info: Assuming search to be a tag.\n' 'info: Assuming search to be a tag.\n'
'[Page99] Page, Lawrence et al. "The PageRank Citation Ranking: Bringing Order to the Web." (1999) [pdf] | network,search\n', '[Page99] Page, Lawrence et al. "The PageRank Citation Ranking: Bringing Order to the Web." (1999) [pdf] | network, search\n',
] ]
cmds = ['pubs init -p /paper_first', cmds = ['pubs init -p /paper_first',
@ -797,7 +797,7 @@ class TestUsecase(DataCommandTestCase):
'', '',
'', '',
'', '',
'search network\n', 'search, network\n',
] ]
cmds = ['pubs init -p paper_first/', cmds = ['pubs init -p paper_first/',
@ -810,7 +810,7 @@ class TestUsecase(DataCommandTestCase):
out = self.execute_cmds(cmds) out = self.execute_cmds(cmds)
def clean(s): def clean(s):
return set(s.strip().split(' ')) return set(s.strip().split(', '))
self.assertEqual(clean(correct[2]), clean(out[2])) self.assertEqual(clean(correct[2]), clean(out[2]))
self.assertEqual(clean(correct[4]), clean(out[4])) self.assertEqual(clean(correct[4]), clean(out[4]))
@ -907,7 +907,7 @@ class TestUsecase(DataCommandTestCase):
meta = str_fixtures.turing_meta meta = str_fixtures.turing_meta
line = '[Page99] Page, Lawrence et al. "The PageRank Citation Ranking: Bringing Order to the Web." (1999) \n' line = '[Page99] Page, Lawrence et al. "The PageRank Citation Ranking: Bringing Order to the Web." (1999) \n'
line1 = re.sub('\n', '| AI,computer\n', line) line1 = re.sub('\n', '| AI, computer\n', line)
cmds = ['pubs init', cmds = ['pubs init',
'pubs add data/pagerank.bib', 'pubs add data/pagerank.bib',

Loading…
Cancel
Save