From 48d691460a209cd4cd5a278c46a344303a139346 Mon Sep 17 00:00:00 2001 From: Sebastian Engelhardt Date: Thu, 5 Jun 2025 18:04:31 +0200 Subject: [PATCH] Makeshift solution for too long URLs not being cut off in the PDF. Addresses gap-packages/AutoDoc#284 --- gap/AutoDocMainFunction.gi | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/gap/AutoDocMainFunction.gi b/gap/AutoDocMainFunction.gi index 5ab828e5..77d92650 100644 --- a/gap/AutoDocMainFunction.gi +++ b/gap/AutoDocMainFunction.gi @@ -168,7 +168,7 @@ end ); ## InstallGlobalFunction( ExtractTitleInfoFromPackageInfo, function( pkginfo ) - local title_rec, i, tmp_list, j, author_rec, author_string; + local title_rec, i, tmp_list, j, author_rec, author_string, max_url_len, no_of_lines, k; if IsBound( pkginfo.AutoDoc ) and IsBound( pkginfo.AutoDoc.TitlePage ) then title_rec := ShallowCopy( pkginfo.AutoDoc.TitlePage ); @@ -204,7 +204,15 @@ InstallGlobalFunction( ExtractTitleInfoFromPackageInfo, AUTODOC_APPEND_STRING_ITERATIVE( author_string, "", author_rec.Email, "" ); fi; if IsBound( author_rec.WWWHome ) then - AUTODOC_APPEND_STRING_ITERATIVE( author_string, "", author_rec.WWWHome, "" ); + # maximum URL length that still fits on one line in the PDF appears to be 72 + max_url_len := 72; + AUTODOC_APPEND_STRING_ITERATIVE( author_string, "", author_rec.WWWHome, "" ); + no_of_lines := QuoInt( Length( author_rec.WWWHome ), max_url_len ) + 1; + for k in [1.. no_of_lines - 1] do + AUTODOC_APPEND_STRING_ITERATIVE( author_string, author_rec.WWWHome{ [(k-1) * max_url_len + 1 .. k * max_url_len] }, "
" ); + od; + AUTODOC_APPEND_STRING_ITERATIVE( author_string, + author_rec.WWWHome{ [(no_of_lines - 1) * max_url_len + 1 .. Length( author_rec.WWWHome )] }, "
" ); fi; title_rec.Author[ i ] := author_string; i := i + 1;