From 45fc3fa255129ed791cbdeb3bf2ee6c26e694a14 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Tue, 24 Sep 2024 22:13:43 +0200 Subject: [PATCH] Fix section author markup Apply the correct template for section authors. Add an extra fix in the migration from old doc styles to correct the display of author names. --- lib/Docs/RST/RSTCopier.php | 8 ++++++++ templates/guides/body/author.html.twig | 3 +++ 2 files changed, 11 insertions(+) create mode 100644 templates/guides/body/author.html.twig diff --git a/lib/Docs/RST/RSTCopier.php b/lib/Docs/RST/RSTCopier.php index 58337b4e..d506f85c 100644 --- a/lib/Docs/RST/RSTCopier.php +++ b/lib/Docs/RST/RSTCopier.php @@ -112,6 +112,14 @@ private function fixRSTSyntax(Project $project, string $content): string // get rid of .. include:: toc.rst $content = str_replace('.. include:: toc.rst', '', $content); + $content = preg_replace( + '/.. sectionauthor:: ([^\(]+) \(([^\)]+)\)/', + '.. sectionauthor:: $1 <$2>', + $content, + ); + + assert(is_string($content)); + // replace \n::\n with \n.. code-block::\n // this corrects code blocks that don't render properly. // we should update the docs code but this makes old docs code render properly. diff --git a/templates/guides/body/author.html.twig b/templates/guides/body/author.html.twig new file mode 100644 index 00000000..835f97fc --- /dev/null +++ b/templates/guides/body/author.html.twig @@ -0,0 +1,3 @@ +

+ Written by {{ node.value }}

+