Skip to content

Commit

Permalink
Support -archive
Browse files Browse the repository at this point in the history
  • Loading branch information
merks committed Mar 7, 2024
1 parent 1680a12 commit 1b8c9c8
Show file tree
Hide file tree
Showing 5 changed files with 386 additions and 327 deletions.
Expand Up @@ -639,6 +639,20 @@ else if (buildTimestamp.endsWith("Z"))
}
}

Map<String, String> archives = new LinkedHashMap<>();
for (String archive = getArgument("-archive", args, null); archive != null; archive = getArgument("-archive", args, null))
{
int index = archive.lastIndexOf(' ');
if (index == -1)
{
archives.put(archive, "");
}
else
{
archives.put(archive.substring(0, index), archive.substring(index + 1));
}
}

Set<String> excludes = new LinkedHashSet<>();
for (String exclude = getArgument("--exclude", args, null); exclude != null; exclude = getArgument("--exclude", args, null))
{
Expand Down Expand Up @@ -863,6 +877,7 @@ else if (!host.contains("@") || !tentativeHostPath.startsWith("/"))
excludedCategoriesPattern == null ? null : Pattern.compile(excludedCategoriesPattern),
commit,
breadcrumbs,
archives,
favicon,
titleImage,
bodyImage,
Expand Down
Expand Up @@ -152,6 +152,12 @@ public class UpdateSiteGenerator
*/
private final Map<String, String> breadcrumbs;

/**
* A cache of the information used to populated archive navigation links.
* It's a map from label to URL.
*/
private final Map<String, String> archives;

/**
* The URL of the site's favicon.
*/
Expand Down Expand Up @@ -277,6 +283,7 @@ public class UpdateSiteGenerator
* @param excludedCategoriesPattern a pattern used to match category IUs that should be excluded.
* @param commit the commit ID.
* @param breadcrumbs a map from label to URL for populating the site's bread crumbs.
* @param archives a map from label to URL for populating the site's archive navigation.
* @param favicon the URL of the site's favicon.
* @param titleImage the URL of the site's title image.
* @param bodyImage the URL if the image used in the body.
Expand Down Expand Up @@ -306,6 +313,7 @@ public UpdateSiteGenerator(
Pattern excludedCategoriesPattern,
String commit,
Map<String, String> breadcrumbs,
Map<String, String> archives,
String favicon,
String titleImage,
String bodyImage,
Expand All @@ -330,6 +338,7 @@ public UpdateSiteGenerator(
this.excludedCategoriesPattern = excludedCategoriesPattern;
this.commit = commit;
this.breadcrumbs = breadcrumbs;
this.archives = archives;
this.favicon = favicon;
this.titleImage = titleImage;
this.bodyImage = bodyImage;
Expand Down Expand Up @@ -425,6 +434,15 @@ public Map<String, String> getBreadcrumbs()
return breadcrumbs;
}

/**
* A map from label to URL used for populating the site's archive navigation.
* @return a map from label to URL used for populating the site's archive navigation.
*/
public Map<String, String> getArchives()
{
return archives;
}

/**
* The root location of the site's project.
* @return the root location of the site's project.
Expand Down

0 comments on commit 1b8c9c8

Please sign in to comment.