Wiederverwendbare Attribute
Diese Seite erklärt, wie man wiederverwendbare Metadaten oder Attribute in mehreren AsciiDoc-Dokumenten in der Fedora-Dokumentation nutzt.
Warum Attribute wiederverwenden?
Manchmal möchten Sie dieselben Daten in mehreren AsciiDoc-Dokumenten verwenden. Einige Beispiele finden Sie nachfolgend:
-
Versionsveröffentlichungen (z.B. Fedora
N) -
URL-Präfixe oder -Suffixe (z.B.
https://pagure.io/fesco/issues/) -
Datum und Zeit (z.B. das aktuelle Jahr, wie
2020)
Für diese und weitere Anwendungsfälle ermöglichen Attribute die zentrale Definition von Metadaten und deren Wiederverwendung an mehreren Stellen.
Übersicht
Für die Verwendung von Attributen in Ihrem Fedora-Dokumentationsprojekt müssen zwei Voraussetzungen erfüllt sein.
-
Erstellen einer Attribut-Datei
-
Import der Attribute in Ihre AsciiDoc-Datei
Attribut-Datei erstellen
Zuerst muss für jedes Modul eine attributes.adoc-Datei initialisiert werden. Das folgende Beispiel zeigt eine global wiederverwendbare Attributdatei im ROOT-Modul:
.
└── ROOT
├── nav.adoc
├── pages
│ └── index.adoc
└── partials
└── attributes.adoc
Dies ist ein Beispiel für eine attributes.adoc-Datei aus dem Fedora-DEI-Team:
// This is a data store of information about the Fedora DEI team.
// Team name:
:team_name: Fedora Diversity, Equity, & Inclusion (DEI) Team
// Team summary:
:team_summary: The {team_name} encourages, supports, and enables DEI in the Fedora community. We work with the community to create an environment where everyone feels empowered to be a part of and contribute to the Fedora Project.
// Team page URL:
:team_url: https://docs.fedoraproject.org/en-US/dei/
// Team activity status.
// Choose from: Active, Inactive
:team_status: Active
// Preferred asynchronous communication channel
:team_asynch_communication: https://discussion.fedoraproject.org/tag/dei-team
// Preferred synchronous communication channel
:team_synch_communication: https://matrix.to/#/#dei:fedoraproject.org
// Issue tracker
:team_issue_tracker: https://gitlab.com/fedora/dei/home/
// Meetings
:team_meetings: https://apps.fedoraproject.org/calendar/diversity-team/
// Imported from our old attributes file.
:COMMBLOG: https://communityblog.fedoraproject.org
:FISCALYEAR: FY23
:FWIKI: https://fedoraproject.org/wiki
:YEAR: 2023
:MAJOROSVER: 39
Attribute importieren
Importieren Sie anschließend die Attributdatei in Ihr AsciiDoc-Dokument. Das Einfügen dieses Makros in die erste Zeile erledigt den Rest:
include::ROOT:partial$attributes.adoc[]
Attribute in der Dokumentation verwenden
Nachdem Sie eine Attributdatei erstellt UND Attribute importiert haben, können Sie in AsciiDoc-Dokumenten mit folgender Syntax die Attribute referenzieren:
{ATTRIBUT}
Hier ein Beispiel des Fedora-DEI-Teams:
*Full consensus* is required to approve new processes, make changes to
existing team policies, and tickets requiring
https://budget.fedoraproject.org/budget/{FISCALYEAR}/d-i.html[D&I budget].
Want to help? Learn how to contribute to Fedora Docs ›