Science Score: 18.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
○codemeta.json file
-
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (3.4%) to scientific vocabulary
Repository
Automatic Citation generator
Basic Info
- Host: GitHub
- Owner: dhruvildave
- License: bsd-3-clause
- Language: Python
- Default Branch: master
- Size: 512 KB
Statistics
- Stars: 0
- Watchers: 0
- Forks: 1
- Open Issues: 0
- Releases: 0
Metadata Files
README.md
citation-engine
Automatic Citation generator
```text usage: main.py [-h] [-i INPUT] [-o OUTPUT] [-f FORMAT]
optional arguments: -h, --help show this help message and exit -i INPUT, --input INPUT Name of json file to input bibliography -o OUTPUT, --output OUTPUT Name of output html file -f FORMAT, --format FORMAT Citation format (apa, mla, ieee, chicago) ```
bash
python3 main.py -i in.json -o out.html -f mla
Input:

Output:

Now just copy the rendered HTML from browser and start using :)
Owner
- Name: Dhruvil Dave
- Login: dhruvildave
- Kind: user
- Location: Dallas, Texas, USA
- Website: https://dhruvildave.com
- Repositories: 8
- Profile: https://github.com/dhruvildave
Playing with music, natural languages, and programming languages :) भारतवर्ष
Citation (citation.py)
#!/usr/bin/env python3
'''Citation Engine'''
# Wed 20 Nov 2019 12:45:19 PM IST
from typing import List
__all__ = ['Citation']
def bold(val: str) -> str:
'''Returns bold text'''
return '<strong>' + val + '</strong>'
def italics(val: str) -> str:
'''Returns italic text'''
return '<em>' + val + '</em>'
keys: List[str] = ['author', 'source_title', 'containers']
container_keys: List[str] = [
'container_title', 'other_contributors', 'version', 'number', 'publisher',
'publication_date', 'location'
]
class Citation:
'''Citation formats'''
@staticmethod
def mla(refs: dict) -> List[str]:
'''MLA Format'''
cits: List[str] = []
for ref in refs:
res = '<p>'
for key in keys:
try:
rec = refs[ref][key]
if key == 'author':
x = rec.split()
res += x[-1] + ', ' + ' '.join(x[:-1]) + '. '
if key == 'source_title':
res += italics(rec) + '. '
if key == 'containers':
for cont in rec:
for i in cont:
if i == 'container_title':
res += italics(cont[i]) + ', '
continue
if i == 'location':
res += cont[i] + '. '
continue
res += cont[i] + ', '
except KeyError:
continue
res = res.rstrip()
res += '</p>'
cits.append(res)
return cits
@staticmethod
def apa(refs: dict) -> List[str]:
'''APA format'''
raise NotImplementedError('Undefined format')
@staticmethod
def ieee(refs: dict) -> List[str]:
'''IEEE format'''
raise NotImplementedError('Undefined format')
@staticmethod
def chicago(refs: dict) -> List[str]:
'''Chicago format'''
raise NotImplementedError('Undefined format')