des-gramps-addons
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
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (0.9%) to scientific vocabulary
Last synced: 10 months ago
·
JSON representation
·
Repository
Basic Info
- Host: GitHub
- Owner: DaveSch-gramps
- Language: Python
- Default Branch: main
- Size: 246 KB
Statistics
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 0
Created over 4 years ago
· Last pushed about 1 year ago
Metadata Files
Readme
Citation
README.md
DES-gramps-addons
Some addons that may not be ready for prime time!
Addons reworked to use the major_version setting for target setting.
Citations were introduced in Gramps 5.2
Owner
- Login: DaveSch-gramps
- Kind: user
- Repositories: 2
- Profile: https://github.com/DaveSch-gramps
Citation (Citations/Citation-AATP-PDC.py)
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2022 Nick Hall
# Copyright (C) 2025 Dave Scheipers
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
"""
A ciation formatter that implements the current functionality.
"""
# -------------------------------------------------------------------------
#
# Standard python modules
#
# -------------------------------------------------------------------------
import logging
# -------------------------------------------------------------------------
#
# GTK/Gnome modules
#
# -------------------------------------------------------------------------
# -------------------------------------------------------------------------
#
# Gramps modules
#
# -------------------------------------------------------------------------
from gramps.gen.lib import Citation
from gramps.gen.utils.string import conf_strings
# -------------------------------------------------------------------------
#
# Constants
#
# -------------------------------------------------------------------------
LOG = logging.getLogger(".cite")
class Formatter:
def __init__(self):
pass
def format(self, bibliography, db, elocale):
result = []
for citation in bibliography.get_citation_list():
source = db.get_source_from_handle(citation.get_source_handle())
src = _format_source_text(source, elocale)
refs = []
for key, ref in citation.get_ref_list():
text = _format_ref_text(ref, key, elocale)
refs.append([ref, key, text])
result.append([[source, src], refs])
return result
def _format_source_text(source, elocale):
if not source:
return ""
trans_text = elocale.translation.gettext
# trans_text is a defined keyword (see po/update_po.py, po/genpot.sh)
src_txt = ""
if source.get_abbreviation():
src_txt += "%s : " % source.get_abbreviation()
if source.get_author():
src_txt += source.get_author()
if source.get_title():
if source.get_author():
# Translators: needed for Arabic, ignore otherwise
src_txt += trans_text(", ")
# Translators: used in French+Russian, ignore otherwise
src_txt += trans_text('"%s"') % source.get_title()
if source.get_publication_info():
if src_txt:
# Translators: needed for Arabic, ignore otherwise
src_txt += trans_text(", ")
src_txt += source.get_publication_info()
return src_txt
def _format_ref_text(ref, key, elocale):
if not ref:
return ""
ref_txt = ""
datepresent = False
date = ref.get_date_object()
if date is not None and not date.is_empty():
datepresent = True
if datepresent:
if ref.get_page():
ref_txt = "%s : %s" % (ref.get_page(), elocale.get_date(date))
else:
ref_txt = elocale.get_date(date)
else:
ref_txt = ref.get_page()
# Print only confidence level if it is not Normal
if ref.get_confidence_level() != Citation.CONF_NORMAL:
ref_txt += (
" ["
+ elocale.translation.gettext(conf_strings[ref.get_confidence_level()])
+ " Confidence]"
)
if ref.get_media_list():
ref_txt += "\n [Citation has media record]"
return ref_txt
GitHub Events
Total
- Delete event: 2
- Push event: 8
- Pull request event: 8
- Create event: 4
Last Year
- Delete event: 2
- Push event: 8
- Pull request event: 8
- Create event: 4