You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@grails.apache.org by "jamesfredley (via GitHub)" <gi...@apache.org> on 2026/05/02 13:37:40 UTC

[PR] Fix unresolved snippet includes leaking [role=include] into rendered guides [grails-static-website]

jamesfredley opened a new pull request, #476:
URL: https://github.com/apache/grails-static-website/pull/476

   ## Summary
   
   Three related bugs caused dozens of guide chapter pages to ship visible literal `link:.../snippets/<file>[role=include]` placeholders instead of the inlined snippet content. Reported by an end user against [grails-configuration-properties-micronaut/6](https://grails.apache.org/guides/grails-configuration-properties-micronaut/6/guide/index.html).
   
   ## Bugs fixed
   
   ### Bug A: inlineSnippetIncludes regex only matched single-level `../snippets/`
   
   Chapters in subdirectories of `guide/` (e.g. `guide/writingTheApp/configurationProperties.adoc`) need `../../snippets/...` or `../../../snippets/...`, which the regex did not match. The unprocessed `include::` directive fell through to AsciidoctorJ - running with no `baseDir` in `SafeMode.SECURE` - which emitted `link:[role=include]` placeholder text.
   
   **Affected**: 47 .adoc files across 6 guides (`discriminator-per-tenant`, `grails-basicauth`, `grails-configuration-properties`, `grails-configuration-properties-micronaut`, `grails-email`, `grails-file-download-excel`); 4 files use 3 levels.
   
   **Fix**: regex relaxed to accept any positive number of leading `../` segments via `(?:\.\./)+`.
   
   ### Bug B: Legacy `{sourcedir}/../` form unhandled
   
   The android guide uses the upstream-grails-doc form `include::{sourcedir}/../<path>[<attrs>]` (21 occurrences in `building-an-android-client-powered-by-a-grails-backend/v4`). Our renderer's wrapper does not define `{sourcedir}`, so these fell through identically.
   
   **Fix**: added a sibling regex pattern handled by the same loop body. Path is treated as snippets-relative because Phase 9 vendoring stripped `complete/` / `initial/` prefixes when copying upstream files.
   
   ### Bug C: `commmon-` typo (three m's)
   
   Vendored common include filename was `commmon-addingAGradlePlugin.adoc`. The file resolved fine via the typo'd path but `inlineCommonIncludes` regex requires the `common-` prefix and missed it.
   
   **Fix**: renamed the file in `guides/common/` and updated the 2 `.adoc` files (`adding-commit-info/v3` + `v4`) that referenced the typo'd name.
   
   ## Local verification
   
   `./gradlew renderGuide_grails_configuration_properties_micronaut_6` produces `build/dist/.../guide/index.html` whose `listingblock` contents now show actual snippet bodies (`compileOnly("io.micronaut:micronaut-inject-groovy")`, `@ConfigurationProperties("address")`, etc.) instead of the `[role=include]` placeholders.
   
   (refs apache/grails-static-website#354)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@grails.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix unresolved snippet includes leaking [role=include] into rendered guides [grails-static-website]

Posted by "jamesfredley (via GitHub)" <gi...@apache.org>.
jamesfredley merged PR #476:
URL: https://github.com/apache/grails-static-website/pull/476


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@grails.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org