Skip to content

Commit ddc566a

Browse files
committed
docs: support for Bibtex citations (#500)
1 parent b15299a commit ddc566a

File tree

4 files changed

+28
-7
lines changed

4 files changed

+28
-7
lines changed

.pre-commit-config.yaml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ repos:
9898

9999
# C++ formatting & linting
100100
- repo: https://github.com/pre-commit/mirrors-clang-format
101-
rev: v22.1.0
101+
rev: v22.1.1
102102
hooks:
103103
- id: clang-format
104104
exclude_types: [json]
@@ -138,7 +138,7 @@ repos:
138138
- id: pyupgrade
139139

140140
- repo: https://github.com/psf/black-pre-commit-mirror
141-
rev: 26.3.0
141+
rev: 26.3.1
142142
hooks:
143143
- id: black
144144

@@ -167,6 +167,13 @@ repos:
167167
files: .github/workflows/
168168
types: [yaml]
169169

170+
# format .bib file
171+
- repo: https://github.com/FlamingTempura/bibtex-tidy
172+
rev: v1.14.0
173+
hooks:
174+
- id: bibtex-tidy
175+
args: [--modify, --curly, --numeric, --months, --space=2, --blank-lines, --duplicates, --merge=combine, --strip-enclosing-braces, --drop-all-caps, --sort-fields, --no-strip-comments, --no-trailing-commas, --remove-empty-fields, --wrap=80]
176+
170177
# general
171178
- repo: https://github.com/pre-commit/pre-commit-hooks
172179
rev: v6.0.0

docs/CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,21 @@ endif ()
2121
include ("${CMAKE_CURRENT_LIST_DIR}/DoxygenSettings.cmake")
2222

2323
# inputs & filepaths
24-
set (DOXYGEN_OUTPUT_DIRECTORY "${BenBot_BINARY_DIR}/generated-docs")
2524
set (DOXYGEN_USE_MDFILE_AS_MAINPAGE "${BenBot_SOURCE_DIR}/README.md")
2625
set (DOXYGEN_LAYOUT_FILE "${CMAKE_CURRENT_LIST_DIR}/DoxygenLayout.xml")
26+
set (DOXYGEN_CITE_BIB_FILES "${CMAKE_CURRENT_SOURCE_DIR}/references.bib")
27+
2728
set (DOXYGEN_FILE_PATTERNS *.hpp)
2829
set (DOXYGEN_INCLUDE_FILE_PATTERNS *.hpp)
30+
2931
set (DOXYGEN_STRIP_FROM_PATH "${BenBot_SOURCE_DIR}")
3032
set (DOXYGEN_STRIP_FROM_INC_PATH
3133
"${BenBot_SOURCE_DIR}/libchess/include" "${BenBot_SOURCE_DIR}/libbenbot/include"
3234
"${BenBot_SOURCE_DIR}/ben-bot/include" "${BenBot_SOURCE_DIR}/ben-bot/resources/include"
3335
)
3436

37+
set (DOXYGEN_OUTPUT_DIRECTORY "${BenBot_BINARY_DIR}/generated-docs")
38+
3539
#
3640

3741
get_target_property (libutil_headers ben_bot::libutil HEADER_SET)
@@ -42,6 +46,7 @@ get_target_property (resource_headers ben_bot::resources HEADER_SET)
4246
doxygen_add_docs (
4347
ben_bot_docs
4448
"${DOXYGEN_LAYOUT_FILE}"
49+
"${DOXYGEN_CITE_BIB_FILES}"
4550
"${DOXYGEN_USE_MDFILE_AS_MAINPAGE}"
4651
"${CMAKE_CURRENT_LIST_DIR}/uci-spec.md"
4752
"${CMAKE_CURRENT_LIST_DIR}/top-level-groups.txt"

docs/references.bib

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
@misc{Edwards_1994,
2+
author = {Edwards, Steven J.},
3+
year = 1994,
4+
month = dec,
5+
journal = {Standard: Portable Game Notation Specification and Implementation Guide},
6+
url = {
7+
https://ia902908.us.archive.org/26/items/pgn-standard-1994-03-12/PGN_standard_1994-03-12.txt
8+
},
9+
}

libchess/include/libchess/notation/PGN.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*/
1414

1515
/** @file
16-
This file provides functions for parsing and writing PGN files.
16+
This file provides functions for parsing and writing PGN @cite Edwards_1994 files.
1717
@ingroup notation
1818
*/
1919

@@ -35,7 +35,7 @@ namespace chess::notation {
3535
using game::Position;
3636
using std::string;
3737

38-
/** PGN NAG glyphs are represented by their numeric codes.
38+
/** PGN @cite Edwards_1994 NAG glyphs are represented by their numeric codes.
3939
This enumeration lists many of the standard NAGs (but not all of them).
4040
4141
@ingroup notation
@@ -127,7 +127,7 @@ struct [[nodiscard]] GameRecord final {
127127
[[nodiscard]] auto get_final_position() const -> Position;
128128
};
129129

130-
/** Parses the text of a PGN file into a GameRecord object.
130+
/** Parses the text of a PGN @cite Edwards_1994 file into a GameRecord object.
131131
132132
If the input string cannot be parsed correctly, returns an explanatory error string.
133133
@@ -151,7 +151,7 @@ struct [[nodiscard]] GameRecord final {
151151
[[nodiscard]] auto parse_all_pgns(std::string_view fileContent)
152152
-> std::vector<GameRecord>;
153153

154-
/** Creates a PGN string from the given game record.
154+
/** Creates a PGN @cite Edwards_1994 string from the given game record.
155155
156156
@param game The game record to serialize.
157157

0 commit comments

Comments
 (0)