citation-bibliography-generator by dkyazzentwatwa/chatgpt-skills
npx skills add https://github.com/dkyazzentwatwa/chatgpt-skills --skill citation-bibliography-generator生成多种学术和专业格式的正确引文与参考文献。支持手动输入、结构化数据导入以及通过 DOI/ISBN 自动查找元数据。
from scripts.citation_generator import CitationGenerator
# 使用所需格式创建生成器
gen = CitationGenerator(style='apa')
# 引用一本书
citation = gen.cite_book(
authors=["Smith, John", "Doe, Jane"],
title="Research Methods in Social Science",
year=2020,
publisher="Academic Press",
city="New York"
)
print(citation)
# 输出: Smith, J., & Doe, J. (2020). Research methods in social science. Academic Press.
# 构建参考文献列表
gen.add_to_bibliography(citation)
bibliography = gen.generate_bibliography()
print(bibliography)
按来源类型格式化引文:
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
生成括号式或叙述式文内引用:
(Smith, 2020, p. 45)Smith (2020) argues that...从包含结构化数据的 CSV 文件导入引文,并生成完整的参考文献列表。
初始化 :
gen = CitationGenerator(style='apa')
参数 :
style (str): 引文格式 - 'apa', 'mla', 'chicago', 'ieee', 或 'harvard'citation = gen.cite_book(
authors=["Last, First", "Last, First"],
title="Book Title",
year=2020,
publisher="Publisher Name",
city="City", # 可选
edition="3rd ed.", # 可选
isbn="978-0-123456-78-9" # 可选
)
返回 : 格式化后的引文字符串
citation = gen.cite_article(
authors=["Last, First"],
title="Article Title",
journal="Journal Name",
year=2020,
volume=10, # 可选
issue=2, # 可选
pages="45-67", # 可选
doi="10.1234/example" # 可选
)
返回 : 格式化后的引文字符串
citation = gen.cite_website(
authors=["Last, First"], # 可以为空列表
title="Page Title",
url="https://example.com",
access_date="2024-01-15",
publish_date="2023-12-01" # 可选
)
返回 : 格式化后的引文字符串
citation = gen.cite_from_doi(doi="10.1234/example")
从 CrossRef API 查找文章元数据并生成格式化引文。
返回 : 格式化后的引文字符串
gen.add_to_bibliography(citation)
将引文添加到参考文献列表。
bibliography = gen.generate_bibliography(
sort_by='author', # 'author', 'year', 或 'title'
deduplicate=True # 移除重复条目
)
返回 : 带有悬挂缩进的格式化参考文献字符串
gen.export_bibtex(output_path='references.bib')
以 BibTeX 格式导出参考文献,供 LaTeX 文档使用。
citation = gen.in_text_citation(
authors=["Smith, J."],
year=2020,
page="45", # 可选
narrative=False # True 表示叙述式风格
)
返回 :
(Smith, 2020, p. 45)Smith (2020)citations = gen.import_from_csv(csv_path='citations.csv')
从 CSV 文件导入多个引文。
CSV 格式 :
type,authors,title,year,journal,publisher,doi,isbn,url,access_date
article,"Smith, J.|Doe, A.",Research Methods,2020,Journal of Science,,10.1234/example,,,
book,"Johnson, M.",Data Analysis,2019,,Academic Press,,978-0-123456-78-9,,
website,,"Web Page Title",2024,,,,,https://example.com,2024-01-15
注意 : 使用 | 管道字符分隔多位作者
返回 : 格式化引文字符串列表
书籍 :
python scripts/citation_generator.py book \
--authors "Smith, J." "Doe, A." \
--title "Research Methods" \
--year 2020 \
--publisher "Academic Press" \
--city "New York" \
--style apa
文章 :
python scripts/citation_generator.py article \
--authors "Smith, J." \
--title "Study Title" \
--journal "Journal Name" \
--year 2020 \
--volume 10 \
--issue 2 \
--pages "45-67" \
--doi "10.1234/example" \
--style mla
网站 :
python scripts/citation_generator.py website \
--title "Page Title" \
--url "https://example.com" \
--access-date "2024-01-15" \
--style chicago
python scripts/citation_generator.py doi \
--doi "10.1234/example" \
--style apa
python scripts/citation_generator.py batch \
--input citations.csv \
--style harvard \
--output bibliography.txt \
--sort author
python scripts/citation_generator.py batch \
--input citations.csv \
--format bibtex \
--output references.bib
| 参数 | 描述 | 默认值 |
|---|---|---|
--style, -s | 引文格式 (apa/mla/chicago/ieee/harvard) | apa |
--authors, -a | 作者姓名 (允许多个) | - |
--title, -t | 作品标题 | - |
--year, -y | 出版年份 | - |
--input, -i | 输入 CSV 文件 (批量模式) | - |
--output, -o | 输出文件路径 | stdout |
--format, -f | 输出格式 (text/bibtex) | text |
--sort | 参考文献排序方式 (author/year/title) | author |
gen = CitationGenerator(style='apa')
citation = gen.cite_book(
authors=["Doe, Jane", "Smith, John"],
title="The Art of Research",
year=2021,
publisher="University Press",
edition="2nd ed."
)
print(citation)
# Doe, J., & Smith, J. (2021). The art of research (2nd ed.). University Press.
gen = CitationGenerator(style='mla')
citation = gen.cite_article(
authors=["Johnson, Mary"],
title="Digital Humanities in the 21st Century",
journal="Modern Research Quarterly",
year=2022,
volume=15,
issue=3,
pages="112-145",
doi="10.5678/mrq.2022.15.3"
)
print(citation)
# Johnson, Mary. "Digital Humanities in the 21st Century." Modern Research Quarterly, vol. 15, no. 3, 2022, pp. 112-145. DOI: 10.5678/mrq.2022.15.3.
gen = CitationGenerator(style='chicago')
citation = gen.cite_website(
authors=["Brown, Robert"],
title="Understanding Machine Learning",
url="https://ml-guide.example.com",
access_date="2024-01-20",
publish_date="2023-11-15"
)
print(citation)
# Brown, Robert. "Understanding Machine Learning." Last modified November 15, 2023. Accessed January 20, 2024. https://ml-guide.example.com.
gen = CitationGenerator(style='apa')
# 添加多个引文
gen.add_to_bibliography(gen.cite_book(
authors=["Smith, A."],
title="First Book",
year=2020,
publisher="Press A"
))
gen.add_to_bibliography(gen.cite_article(
authors=["Jones, B."],
title="Research Article",
journal="Journal X",
year=2021
))
# 生成格式化参考文献列表
bibliography = gen.generate_bibliography(sort_by='author')
print(bibliography)
gen = CitationGenerator(style='ieee')
citation = gen.cite_from_doi(doi="10.1109/ACCESS.2019.2947014")
print(citation)
# 自动获取元数据并以 IEEE 格式格式化
gen = CitationGenerator(style='harvard')
citations = gen.import_from_csv('my_references.csv')
# 全部添加到参考文献列表
for citation in citations:
gen.add_to_bibliography(citation)
# 生成并导出
gen.export_bibtex('references.bib')
pandas>=2.0.0
requests>=2.31.0
安装依赖项:
pip install -r scripts/requirements.txt
每周安装次数
66
代码仓库
GitHub Stars
23
首次出现
Jan 24, 2026
安全审计
安装于
opencode55
codex53
gemini-cli53
cursor52
github-copilot48
claude-code46
Generate properly formatted citations and bibliographies in multiple academic and professional styles. Supports manual entry, structured data import, and automatic metadata lookup via DOI/ISBN.
from scripts.citation_generator import CitationGenerator
# Create generator with desired style
gen = CitationGenerator(style='apa')
# Cite a book
citation = gen.cite_book(
authors=["Smith, John", "Doe, Jane"],
title="Research Methods in Social Science",
year=2020,
publisher="Academic Press",
city="New York"
)
print(citation)
# Output: Smith, J., & Doe, J. (2020). Research methods in social science. Academic Press.
# Build bibliography
gen.add_to_bibliography(citation)
bibliography = gen.generate_bibliography()
print(bibliography)
Format citations by source type:
Generate parenthetical or narrative in-text citations:
(Smith, 2020, p. 45)Smith (2020) argues that...Import citations from CSV files with structured data and generate complete bibliographies.
Initialization :
gen = CitationGenerator(style='apa')
Parameters :
style (str): Citation style - 'apa', 'mla', 'chicago', 'ieee', or 'harvard'citation = gen.cite_book(
authors=["Last, First", "Last, First"],
title="Book Title",
year=2020,
publisher="Publisher Name",
city="City", # Optional
edition="3rd ed.", # Optional
isbn="978-0-123456-78-9" # Optional
)
Returns : Formatted citation string
citation = gen.cite_article(
authors=["Last, First"],
title="Article Title",
journal="Journal Name",
year=2020,
volume=10, # Optional
issue=2, # Optional
pages="45-67", # Optional
doi="10.1234/example" # Optional
)
Returns : Formatted citation string
citation = gen.cite_website(
authors=["Last, First"], # Can be empty list
title="Page Title",
url="https://example.com",
access_date="2024-01-15",
publish_date="2023-12-01" # Optional
)
Returns : Formatted citation string
citation = gen.cite_from_doi(doi="10.1234/example")
Looks up article metadata from CrossRef API and generates formatted citation.
Returns : Formatted citation string
gen.add_to_bibliography(citation)
Add a citation to the bibliography list.
bibliography = gen.generate_bibliography(
sort_by='author', # 'author', 'year', or 'title'
deduplicate=True # Remove duplicate entries
)
Returns : Formatted bibliography string with hanging indent
gen.export_bibtex(output_path='references.bib')
Export bibliography as BibTeX format for LaTeX documents.
citation = gen.in_text_citation(
authors=["Smith, J."],
year=2020,
page="45", # Optional
narrative=False # True for narrative style
)
Returns :
(Smith, 2020, p. 45)Smith (2020)citations = gen.import_from_csv(csv_path='citations.csv')
Import multiple citations from CSV file.
CSV Format :
type,authors,title,year,journal,publisher,doi,isbn,url,access_date
article,"Smith, J.|Doe, A.",Research Methods,2020,Journal of Science,,10.1234/example,,,
book,"Johnson, M.",Data Analysis,2019,,Academic Press,,978-0-123456-78-9,,
website,,"Web Page Title",2024,,,,,https://example.com,2024-01-15
Note : Separate multiple authors with | pipe character
Returns : List of formatted citation strings
Book :
python scripts/citation_generator.py book \
--authors "Smith, J." "Doe, A." \
--title "Research Methods" \
--year 2020 \
--publisher "Academic Press" \
--city "New York" \
--style apa
Article :
python scripts/citation_generator.py article \
--authors "Smith, J." \
--title "Study Title" \
--journal "Journal Name" \
--year 2020 \
--volume 10 \
--issue 2 \
--pages "45-67" \
--doi "10.1234/example" \
--style mla
Website :
python scripts/citation_generator.py website \
--title "Page Title" \
--url "https://example.com" \
--access-date "2024-01-15" \
--style chicago
python scripts/citation_generator.py doi \
--doi "10.1234/example" \
--style apa
python scripts/citation_generator.py batch \
--input citations.csv \
--style harvard \
--output bibliography.txt \
--sort author
python scripts/citation_generator.py batch \
--input citations.csv \
--format bibtex \
--output references.bib
| Argument | Description | Default |
|---|---|---|
--style, -s | Citation style (apa/mla/chicago/ieee/harvard) | apa |
--authors, -a | Author names (multiple allowed) | - |
--title, -t | Title of work | - |
--year, |
gen = CitationGenerator(style='apa')
citation = gen.cite_book(
authors=["Doe, Jane", "Smith, John"],
title="The Art of Research",
year=2021,
publisher="University Press",
edition="2nd ed."
)
print(citation)
# Doe, J., & Smith, J. (2021). The art of research (2nd ed.). University Press.
gen = CitationGenerator(style='mla')
citation = gen.cite_article(
authors=["Johnson, Mary"],
title="Digital Humanities in the 21st Century",
journal="Modern Research Quarterly",
year=2022,
volume=15,
issue=3,
pages="112-145",
doi="10.5678/mrq.2022.15.3"
)
print(citation)
# Johnson, Mary. "Digital Humanities in the 21st Century." Modern Research Quarterly, vol. 15, no. 3, 2022, pp. 112-145. DOI: 10.5678/mrq.2022.15.3.
gen = CitationGenerator(style='chicago')
citation = gen.cite_website(
authors=["Brown, Robert"],
title="Understanding Machine Learning",
url="https://ml-guide.example.com",
access_date="2024-01-20",
publish_date="2023-11-15"
)
print(citation)
# Brown, Robert. "Understanding Machine Learning." Last modified November 15, 2023. Accessed January 20, 2024. https://ml-guide.example.com.
gen = CitationGenerator(style='apa')
# Add multiple citations
gen.add_to_bibliography(gen.cite_book(
authors=["Smith, A."],
title="First Book",
year=2020,
publisher="Press A"
))
gen.add_to_bibliography(gen.cite_article(
authors=["Jones, B."],
title="Research Article",
journal="Journal X",
year=2021
))
# Generate formatted bibliography
bibliography = gen.generate_bibliography(sort_by='author')
print(bibliography)
gen = CitationGenerator(style='ieee')
citation = gen.cite_from_doi(doi="10.1109/ACCESS.2019.2947014")
print(citation)
# Auto-fetches metadata and formats in IEEE style
gen = CitationGenerator(style='harvard')
citations = gen.import_from_csv('my_references.csv')
# Add all to bibliography
for citation in citations:
gen.add_to_bibliography(citation)
# Generate and export
gen.export_bibtex('references.bib')
pandas>=2.0.0
requests>=2.31.0
Install dependencies:
pip install -r scripts/requirements.txt
Weekly Installs
66
Repository
GitHub Stars
23
First Seen
Jan 24, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode55
codex53
gemini-cli53
cursor52
github-copilot48
claude-code46
MCP图像生成技能:使用Gemini AI为营销、UI设计、演示文稿创建高质量图像
7,600 周安装
-y| Publication year |
| - |
--input, -i | Input CSV file (batch mode) | - |
--output, -o | Output file path | stdout |
--format, -f | Output format (text/bibtex) | text |
--sort | Sort bibliography by (author/year/title) | author |