citationapp

A Flask app for generating academic citations in different styles.

https://github.com/gabrielbaute/citationapp

Science Score: 31.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
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (4.5%) to scientific vocabulary

Keywords

bulma-css citation-styles flask
Last synced: 6 months ago · JSON representation ·

Repository

A Flask app for generating academic citations in different styles.

Basic Info
  • Host: GitHub
  • Owner: gabrielbaute
  • License: mit
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 9.77 KB
Statistics
  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Topics
bulma-css citation-styles flask
Created about 1 year ago · Last pushed about 1 year ago
Metadata Files
Readme License Citation

README.md

📚 CitationApp

License

CitationApp es una herramienta versátil que genera referencias bibliográficas en múltiples estilos (APA, MLA, Chicago, Vancouver, Harvard, IEEE, y UNE-ISO 690:2024) a partir de DOI, ISBN y URLs de páginas web.

🚀 Características

  • Generación por DOI: Obtiene datos bibliográficos a partir de un DOI.
  • Generación por ISBN: Obtiene datos bibliográficos de libros a partir de un ISBN.
  • Generación por URL: Extrae metadatos de páginas web para generar referencias.
  • Todos los formatos: Muestra las referencias en todos los formatos soportados.

📑 Instalación

  1. Clona el repositorio: sh git clone https://github.com/gabrielbaute/CitationApp cd CitationApp

  2. Crea un entorno virtual e instala las dependencias: sh python -m venv venv source venv/bin/activate # En Windows usa: venv\Scripts\activate pip install -r requirements.txt

📝 Uso

  1. Ejecuta la aplicación Flask: sh flask run

  2. Abre tu navegador y ve a http://localhost:5000 para acceder a la aplicación.

📂 Estructura del Proyecto

CitationApp/ │ ├── app.py ├── routes.py ├── citation_api.py ├── formatters.py ├── forms.py │ ├── templates/ │ ├── base.html │ ├── index.html │ ├── generate_reference.html │ ├── reference.html │ └── all_reference.html │ └── static/ └── css/ └── custom.css

🤝 Contribuir

¡Las contribuciones son bienvenidas! Por favor, abre un issue o envía un pull request.

📄 Licencia

Este proyecto está bajo la licencia MIT. Consulta el archivo LICENSE para más detalles.


Desarrollado con ❤️ en Python por Gabriel Fernando

Owner

  • Login: gabrielbaute
  • Kind: user

Citation (citation_api.py)

import requests
from bs4 import BeautifulSoup
from crossref.restful import Works, Etiquette

etiquette = Etiquette(
    application_name = 'CittationApp',
    application_version = '0.1.0',
    application_url = 'None',
    contact_email = 'yourmail@mail.com'
)

works = Works(etiquette=etiquette)

# From DOI
def crossref_doi(doi):
    try:
        data = works.doi(doi)
        return data
    except Exception as e:
        return {"error": str(e)}

def crossref_agency(doi):
    try:
        data = works.agency(doi)
        return data
    except Exception as e:
        return {"error": str(e)}

def crossref_query(bibliographic=None, author=None, publisher_name=None):
    try:
        query = works.query()
        if bibliographic:
            query = query.filter(bibliographic=bibliographic)
        if author:
            query = query.filter(author=author)
        if publisher_name:
            query = query.filter(publisher_name=publisher_name)
        
        data = [item['title'][0] for item in query]
        return data
    except Exception as e:
        return {"error": str(e)}

# From ISBN
def get_book_by_isbn(isbn):
    try:
        url = f"https://openlibrary.org/api/books?bibkeys=ISBN:{isbn}&jscmd=data&format=json"
        response = requests.get(url)
        response.raise_for_status()
        data = response.json()
        book_data = data.get(f"ISBN:{isbn}", {})
        return book_data
    except Exception as e:
        return {"error": str(e)}

# From webpages
def get_webpage_metadata(url):
    try:
        response = requests.get(url)
        response.raise_for_status()
        soup = BeautifulSoup(response.content, "html.parser")

        # Extraer el título
        title = soup.find("title").get_text() if soup.find("title") else "Sin título"

        # Intentar extraer el autor desde diferentes metadatos y estructuras HTML
        author = "Desconocido"
        author_meta = soup.find("meta", attrs={"name": "author"})
        if author_meta:
            author = author_meta["content"]
        else:
            author_meta = soup.find("meta", property="article:author")
            if author_meta:
                author = author_meta["content"]
            else:
                # Verificar si el div con clase "meta" existe antes de buscar el span
                meta_div = soup.find("div", class_="meta")
                if meta_div:
                    author_span = meta_div.find("span", class_="author")
                    if author_span:
                        author = author_span.get_text()

        # Intentar extraer la fecha de publicación desde diferentes metadatos y estructuras HTML
        publication_date = "Fecha desconocida"
        pubdate_meta = soup.find("meta", attrs={"name": "pubdate"})
        if pubdate_meta:
            publication_date = pubdate_meta["content"]
        else:
            pubdate_meta = soup.find("meta", property="article:published_time")
            if pubdate_meta:
                publication_date = pubdate_meta["content"]
            else:
                # Verificar si el div con clase "meta" existe antes de buscar el span
                meta_div = soup.find("div", class_="meta")
                if meta_div:
                    date_span = meta_div.find("span", class_="date")
                    if date_span:
                        publication_date = date_span.get_text()

        return {"title": title, "author": author, "publication_date": publication_date, "url": url}
    except Exception as e:
        return {"error": str(e)}

GitHub Events

Total
  • Watch event: 1
  • Push event: 3
  • Create event: 2
Last Year
  • Watch event: 1
  • Push event: 3
  • Create event: 2

Committers

Last synced: 7 months ago

All Time
  • Total Commits: 5
  • Total Committers: 1
  • Avg Commits per committer: 5.0
  • Development Distribution Score (DDS): 0.0
Past Year
  • Commits: 5
  • Committers: 1
  • Avg Commits per committer: 5.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
gabrielbaute g****e@g****m 5

Issues and Pull Requests

Last synced: 7 months ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels