# ==========================================================================
#                ____  _ _   _____   __  ______
#                | __ )(_) |_|_   _|__\ \/ / ___|___  _ ____   __
#                |  _ \| | '_ \| |/ _ \  / |   / _ \| '_ \ \ / /
#                | |_) | | |_) | |  __//  \ |__| (_) | | | \ V /
#                |____/|_|_.__/|_|\___/_/\_\____\___/|_| |_|\_/
#
#                          ---  BibTeX Converter  ---
#                   https://www.nntb.no/~dreibh/bibtexconv/
# ==========================================================================
#
# BibTeXConv Markdown Export Example
# Copyright (C) 2010-2026 by Thomas Dreibholz
#
# 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 3 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, see <http://www.gnu.org/licenses/>.
#
# Contact: thomas.dreibholz@gmail.com

# Example for export to YAML, suitable for Debian metadata:
# https://wiki.debian.org/UpstreamMetadata

# Select entries:
citeAll

sort year/A month/D day/D title/A

# ###########################################################################
# #### Export to YAML                                                    ####
# ###########################################################################

# ----- Encode strings in XML style, e.g. <, >, &, etc.----------------------
xmlStyle
# ----- Non-breakable space character and line-break ------------------------
nbsp  
linebreak 

echo # Publications\n\n

# ====== This is the printing template ======================================
templatenew

# ***** Begin of Subsection: YEAR *******************************************
template+ [%{begin-subdivision-year}## %{year}\n\n]

# ****** Begin of Entry *****************************************************
template+ [* ]

# ***** Authors *************************************************************
# Begin of author loop:
template+ %{begin-author-loop}
# Separator, for first/last/middle author:
template+ [%{is-first-author?}|%{is-last-author?} and |; ]
# Add the current author form the loop:
template+ [
# First, try create link to author (via mapping "author-url") :
template+ \[%{author-family-name}[, %{author-give-name}\]
template+ \((%{author-family-name}[, %{author-give-name}]%{map:author-url})\)
template+ ]
# If there is no mapping, use plain text instead:
template+ |
template+ %{author-family-name}[, %{author-give-name}]
template+ ]
# End of author loop:
template+ %{end-author-loop}
template+ :

# ***** Title ***************************************************************
# If there is a URL, make a hyperlink, else only print the title:
template+  [«\[%{title}\]\(%{url}\)»|«%{title}»]

# ****** Document details ***************************************************
# The document details appear in braces ( ... ), if they are available.
# Add opening parenthesis "(", if "url" or "language" are set:
template+ [%{url}%{is-not?}%{url-type}%{is-not?HTML} \(|%{language}%{is-not?} \(]

# ------ Download -----------------------------------------------------------
template+ [
# Only show file type and length for non-HTML types:
template+ [%{url-type}%{is-not?HTML}
template+ [\[%{url-type}\]\(%{url}\)]
template+ [, %{url-size-kib}~KiB]
template+ ]
# Use plural or singular for number of pages: "n pages", or just "1 page":
template+ [(%{numpages}%{is-not?1}), %{numpages}~pages|, %{numpages}~page]
template+ ]
# ------ Language -----------------------------------------------------------
template+ [%{url}%{is-not?}[%{language}%{is-not?}, ]]
template+ [
template+ [%{content-language}|%{language}]%{is?german}🇩🇪|
template+ [%{content-language}|%{language}]%{is?ngerman}🇩🇪|
template+ [%{content-language}|%{language}]%{is?norsk}🇳🇴|
template+ [%{content-language}|%{language}]%{is?chinese}🇨🇳|
template+ [%{content-language}|%{language}]%{is?french}🇫🇷|
template+ [%{content-language}|%{language}]%{is?english}🇬🇧|
template+ in %{content-language}|
template+ in %{language}
template+ ]

# Add closing parenthesis ")", if "url" or "language" are set:
template+ [%{url}%{is-not?}%{url-type}%{is-not?HTML}\)|%{language}%{is-not?}\)]

# ***** Bibliographic data of publication ***********************************
template+ [, %{how-published}]
template+ [, in *%{journal}*]
template+ [, in *%{booktitle}*]
template+ [
template+ , %{type}[~%{number}][, %{series}][, vol.~%{volume}][, pp.~%{pages}]|
template+ [, %{series}][, vol.~%{volume}][, no.~%{number}][, pp.~%{pages}]
template+ ]
template+ [, %{publisher}]
template+ [, %{school}]
template+ [, %{institution}]
template+ [, URN~\[%{urn}\]\(https://nbn-resolving.org/%{urn}\)]
template+ [, DOI~\[%{doi}\]\(https://dx.doi.org/%{doi}\)]
template+ [, %{isbn}]
template+ [, %{issn}]
template+ [, %{address}]
template+ [, %{note}]
template+ [, [%{month-name}~%{day}, |%{month-name}~]%{year}]
template+ .

# ****** End of Entry *******************************************************
template+ \n

# ***** End of Subsection: YEAR *********************************************
template+ [%{end-subdivision-year}\n]

# ====== Finally, print all selected publications ===========================
export
