Skip to content

Commit

Permalink
Fix general image regex for demo projects
Browse files Browse the repository at this point in the history
  • Loading branch information
nntthuy-axonivy committed Dec 16, 2024
1 parent 37c538f commit 8c0d85d
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class ProductContentUtils {
public static final String DESCRIPTION = "description";
public static final String DEMO = "demo";
public static final String SETUP = "setup";
public static final String README_IMAGE_FORMAT = "\\(([^)]*?/)?%s\\)";
public static final String README_IMAGE_FORMAT = "\\(([^)]*?/)?%s(\\s+\"[^\"]+\")?\\)";
public static final String IMAGE_DOWNLOAD_URL_FORMAT = "(%s)";

private ProductContentUtils() {
Expand Down Expand Up @@ -141,6 +141,11 @@ public static void updateProductModuleTabContents(ProductModuleContent productMo
productModuleContent.setSetup(replaceEmptyContentsWithEnContent(moduleContents.get(SETUP)));
}

/**
* Cover some inconsistent cases:
* Products contain image names in round brackets (employee-onboarding, demo-projects, etc.)
* Image with name contains in other images' (mattermost)
*/
public static String replaceImageDirWithImageCustomId(Map<String, String> imageUrls, String readmeContents) {
for (Map.Entry<String, String> entry : imageUrls.entrySet()) {
String imagePattern = String.format(README_IMAGE_FORMAT, Pattern.quote(entry.getKey()));
Expand Down

0 comments on commit 8c0d85d

Please sign in to comment.