renanbr / bibtex-parser

BibTex Parser provides an API to read .bib files programmatically.
MIT License
40 stars 17 forks source link

Add UrlFromDoiProcessor #71

Closed LeJeanbono closed 5 years ago

LeJeanbono commented 5 years ago

Fix #37

codecov[bot] commented 5 years ago

Codecov Report

Merging #71 into master will increase coverage by 0.25%. The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master      #71      +/-   ##
============================================
+ Coverage     90.38%   90.64%   +0.25%     
- Complexity      175      181       +6     
============================================
  Files             9       10       +1     
  Lines           468      481      +13     
============================================
+ Hits            423      436      +13     
  Misses           45       45
Impacted Files Coverage Δ Complexity Δ
src/Processor/UrlFromDoiProcessor.php 100% <100%> (ø) 6 <6> (?)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update b1922ca...2274c4f. Read the comment docs.

renanbr commented 5 years ago

What do you think it should be the behaviour for these scenarios?

['doi' => 'xyz', 'url' => 'http://example.org']; // prex-existing url
['doi' => ''];                                   // empty doi

a) exception b) url to null c) do nothing d) something else?

I tend to say c, WDYT?

LeJeanbono commented 5 years ago

What do you think it should be the behaviour for these scenarios?

['doi' => 'xyz', 'url' => 'http://example.org']; // prex-existing url
['doi' => ''];                                   // empty doi

a) exception b) url to null c) do nothing d) something else?

I tend to say c, WDYT?

I don't know bibtex but with some research, if url and doi are already present, they should be has : url = "https://doi.org/10.1038/421805a" and doi = "10.1038/421805a" So => c

LeJeanbono commented 5 years ago

Empty doi => Exception ?

renanbr commented 5 years ago

thank you @LeJeanbono ! merged as https://github.com/renanbr/bibtex-parser/commit/1704405568f353046c456de3ce11c360a1eb2723 and https://github.com/renanbr/bibtex-parser/commit/173bbf134ec639d7e5e762ed549c2e5482f138a4

LeJeanbono commented 5 years ago

You're welcome !