Skip to content

Commit 01ede05

Browse files
Fix: correctly resolve all documentation title sequence warnings using leveloffset and fragments with level 0 headers
1 parent b6f961d commit 01ede05

File tree

11 files changed

+57
-57
lines changed

11 files changed

+57
-57
lines changed

grails-data-hibernate5/docs/src/docs/asciidoc/advancedGORMFeatures/eventsAutoTimestamping.adoc

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ specific language governing permissions and limitations
1717
under the License.
1818
////
1919

20+
= Events and Auto Timestamping
21+
2022
GORM supports the registration of events as methods that get fired when certain events occurs such as deletes, inserts and updates. The following is a list of supported events:
2123

2224
* `beforeInsert` - Executed before an object is initially persisted to the database. If you return false, the insert will be cancelled.
@@ -33,7 +35,7 @@ To add an event simply register the relevant method with your domain class.
3335
WARNING: Do not attempt to flush the session within an event (such as with obj.save(flush:true)). Since events are fired during flushing this will cause a StackOverflowError.
3436

3537

36-
==== The beforeInsert event
38+
== The beforeInsert event
3739

3840

3941
Fired before an object is saved to the database
@@ -56,7 +58,7 @@ class Person {
5658
----
5759

5860

59-
==== The beforeUpdate event
61+
== The beforeUpdate event
6062

6163

6264
Fired before an existing object is updated
@@ -88,7 +90,7 @@ class Person {
8890
Notice the usage of `autowire true` above. This is required for the bean `securityService` to be injected.
8991

9092

91-
==== The beforeDelete event
93+
== The beforeDelete event
9294

9395

9496
Fired before an object is deleted.
@@ -111,7 +113,7 @@ Notice the usage of `withNewSession` method above. Since events are triggered wh
111113
Fortunately the `withNewSession` method lets you share the same transactional JDBC connection even though you're using a different underlying `Session`.
112114

113115

114-
==== The beforeValidate event
116+
== The beforeValidate event
115117

116118

117119
Fired before an object is validated.
@@ -171,7 +173,7 @@ no-arg version if no arguments are passed to `validate` but will fall back on th
171173
`List` version if the no-arg version does not exist. In that case, `null` is passed to `beforeValidate`.
172174

173175

174-
==== The onLoad/beforeLoad event
176+
== The onLoad/beforeLoad event
175177

176178

177179
Fired immediately before an object is loaded from the database:
@@ -192,7 +194,7 @@ class Person {
192194
`beforeLoad()` is effectively a synonym for `onLoad()`, so only declare one or the other.
193195

194196

195-
==== The afterLoad event
197+
== The afterLoad event
196198

197199

198200
Fired immediately after an object is loaded from the database:
@@ -211,7 +213,7 @@ class Person {
211213
----
212214

213215

214-
==== Custom Event Listeners
216+
== Custom Event Listeners
215217

216218
To register a custom event listener you need to subclass `AbstractPersistenceEventListener` (in package _org.grails.datastore.mapping.engine.event_) and implement the methods `onPersistenceEvent` and `supportsEventType`. You also must provide a reference to the datastore to the listener. The simplest possible implementation can be seen below:
217219

@@ -277,7 +279,7 @@ datastore.getApplicationEventPublisher()
277279
----
278280

279281

280-
==== Hibernate Events
282+
== Hibernate Events
281283

282284

283285
It is generally encouraged to use the non-Hibernate specific API described above, but if you need access to more detailed Hibernate events then you can define custom Hibernate-specific event listeners.
@@ -359,7 +361,7 @@ def doWithSpring = {
359361
----
360362

361363

362-
==== Automatic timestamping
364+
== Automatic timestamping
363365

364366

365367
If you define a `dateCreated` property it will be set to the current date for you when you create new instances. Likewise, if you define a `lastUpdated` property it will be automatically be updated for you when you change persistent instances.

grails-data-hibernate5/docs/src/docs/asciidoc/index.adoc

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,7 @@ include::querying/hql.adoc[]
190190
include::advancedGORMFeatures.adoc[]
191191

192192
[[eventsAutoTimestamping]]
193-
=== Events and Auto Timestamping
194-
195-
include::advancedGORMFeatures/eventsAutoTimestamping.adoc[]
193+
include::advancedGORMFeatures/eventsAutoTimestamping.adoc[leveloffset=+2]
196194

197195
[[ormdsl]]
198196
=== Custom ORM Mapping
@@ -265,9 +263,7 @@ include::advancedGORMFeatures/ormdsl/customNamingStrategy.adoc[]
265263
include::advancedGORMFeatures/defaultSortOrder.adoc[]
266264

267265
[[programmaticTransactions]]
268-
== Programmatic Transactions
269-
270-
include::programmaticTransactions.adoc[]
266+
include::programmaticTransactions.adoc[leveloffset=+1]
271267

272268
[[dataServices]]
273269
== GORM Data Services

grails-data-hibernate5/docs/src/docs/asciidoc/programmaticTransactions.adoc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@ specific language governing permissions and limitations
1717
under the License.
1818
////
1919

20+
= Programmatic Transactions
21+
2022
GORM's transaction management is built on Spring and uses Spring's Transaction abstraction for dealing with programmatic transactions.
2123

2224
However, GORM classes have been enhanced to make this simpler with the link:../api/org/grails/datastore/gorm/GormEntity.html#withTransaction(groovy.lang.Closure)[withTransaction(Closure)] method. This method has a single parameter, a Closure, which has a single parameter which is a Spring https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/transaction/TransactionStatus.html[TransactionStatus] instance.
2325

24-
==== Using the withTransaction Method
26+
== Using the withTransaction Method
2527

2628
Here's an example of using `withTransaction` in a controller methods:
2729

@@ -56,7 +58,7 @@ You can also use "save points" to rollback a transaction to a particular point i
5658

5759
The `withTransaction` method deals with the begin/commit/rollback logic for you within the scope of the block.
5860

59-
==== Using TransactionService
61+
== Using TransactionService
6062

6163
Since GORM 6.1, if you need more flexibility then instead you can instead take advantage of the link:../api/grails/gorm/transactions/TransactionService.html[TransactionService], which can be obtained by looking it up from from the `HibernateDatastore`:
6264

grails-doc/src/en/guide/index.adoc

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,44 +1075,30 @@ include::plugins.adoc[]
10751075
include::plugins/creatingAndInstallingPlugins.adoc[leveloffset=+2]
10761076

10771077
[[repositories]]
1078-
=== Plugin Repositories
1079-
1080-
include::plugins/repositories.adoc[]
1078+
include::plugins/repositories.adoc[leveloffset=+2]
10811079

10821080
[[providingBasicArtefacts]]
1083-
=== Providing Basic Artefacts
1084-
1085-
include::plugins/providingBasicArtefacts.adoc[]
1081+
include::plugins/providingBasicArtefacts.adoc[leveloffset=+2]
10861082

10871083
[[evaluatingConventions]]
10881084
=== Evaluating Conventions
10891085

10901086
include::plugins/evaluatingConventions.adoc[]
10911087

10921088
[[hookingIntoRuntimeConfiguration]]
1093-
=== Hooking into Runtime Configuration
1094-
1095-
include::plugins/hookingIntoRuntimeConfiguration.adoc[]
1089+
include::plugins/hookingIntoRuntimeConfiguration.adoc[leveloffset=+2]
10961090

10971091
[[addingMethodsAtCompileTime]]
1098-
=== Adding Methods at Compile Time
1099-
1100-
include::plugins/addingMethodsAtCompileTime.adoc[]
1092+
include::plugins/addingMethodsAtCompileTime.adoc[leveloffset=+2]
11011093

11021094
[[addingDynamicMethodsAtRuntime]]
1103-
=== Adding Dynamic Methods at Runtime
1104-
1105-
include::plugins/addingDynamicMethodsAtRuntime.adoc[]
1095+
include::plugins/addingDynamicMethodsAtRuntime.adoc[leveloffset=+2]
11061096

11071097
[[participatingInAutoReloadEvents]]
1108-
=== Participating in Auto Reload Events
1109-
1110-
include::plugins/participatingInAutoReloadEvents.adoc[]
1098+
include::plugins/participatingInAutoReloadEvents.adoc[leveloffset=+2]
11111099

11121100
[[understandingPluginLoadOrder]]
1113-
=== Understanding Plugin Load Order
1114-
1115-
include::plugins/understandingPluginLoadOrder.adoc[]
1101+
include::plugins/understandingPluginLoadOrder.adoc[leveloffset=+2]
11161102

11171103
[[artefactApi]]
11181104
=== The Artefact API

grails-doc/src/en/guide/plugins/addingDynamicMethodsAtRuntime.adoc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@ specific language governing permissions and limitations
1717
under the License.
1818
////
1919

20+
= Adding Dynamic Methods at Runtime
2021

21-
==== The Basics
22+
23+
== The Basics
2224

2325

2426
Grails plugins let you register dynamic methods with any Grails-managed or other class at runtime. This work is done in a `doWithDynamicMethods` method.
@@ -62,7 +64,7 @@ class ExamplePlugin extends Plugin {
6264
----
6365

6466

65-
==== Interacting with the ApplicationContext
67+
== Interacting with the ApplicationContext
6668

6769

6870
The `doWithDynamicMethods` closure gets passed the Spring `ApplicationContext` instance. This is useful as it lets you interact with objects within it. For example if you were implementing a method to interact with Hibernate you could use the `SessionFactory` instance in combination with a `HibernateTemplate`:

grails-doc/src/en/guide/plugins/addingMethodsAtCompileTime.adoc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ specific language governing permissions and limitations
1717
under the License.
1818
////
1919

20+
= Adding Methods at Compile Time
21+
2022
Grails makes it easy to add new traits to existing artefact types from a plugin. For example say you wanted to add methods for manipulating dates to controllers. This can be done by defining a trait in `src/main/groovy`:
2123

2224
[source,groovy]
@@ -56,7 +58,7 @@ class ControllerTraitInjector implements TraitInjector {
5658

5759
The above `TraitInjector` will add the `SomeTrait` to all controllers. The `getArtefactTypes` method defines the types of artefacts that the trait should be applied to.
5860

59-
==== Applying traits conditionally
61+
== Applying traits conditionally
6062
A `TraitInjector` implementation can also implement the link:{api}grails/compiler/ast/SupportsClassNode.html[SupportsClassNode] interface to apply traits to only those artefacts which satisfy a custom requirement.
6163
For example, if a trait should only be applied if the target artefact class has a specific annotation, it can be done as below
6264

grails-doc/src/en/guide/plugins/hookingIntoRuntimeConfiguration.adoc

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@ specific language governing permissions and limitations
1717
under the License.
1818
////
1919

20+
= Hooking into Runtime Configuration
21+
2022
Grails provides a number of hooks to leverage the different parts of the system and perform runtime configuration by convention.
2123

2224

23-
==== Hooking into the Grails Spring configuration
25+
== Hooking into the Grails Spring configuration
2426

2527

2628
First, you can hook in Grails runtime configuration overriding the `doWithSpring` method from the link:{api}grails/plugins/Plugin.html[Plugin] class and returning a closure that defines additional beans. For example the following snippet is from one of the core Grails plugins that provides link:i18n.html[i18n] support:
@@ -51,15 +53,15 @@ class I18nGrailsPlugin extends Plugin {
5153
This plugin configures the Grails `messageSource` bean and a couple of other beans to manage Locale resolution and switching. It using the link:spring.html#theBeanBuilderDSLExplained[Spring Bean Builder] syntax to do so.
5254

5355

54-
==== Customizing the Servlet Environment
56+
== Customizing the Servlet Environment
5557

5658

5759
In previous versions of Grails it was possible to dynamically modify the generated `web.xml`. From Grails 3.x+ there is no `web.xml` file and it is not possible to programmatically modify the `web.xml` file anymore.
5860

5961
However, it is possible to perform the most commons tasks of modifying the Servlet environment in Grails 3.x and above.
6062

6163

62-
==== Adding New Servlets
64+
== Adding New Servlets
6365

6466

6567
If you want to add a new Servlet instance the simplest way is simply to define a new Spring bean in the `doWithSpring` method:
@@ -83,7 +85,7 @@ Closure doWithSpring() {{->
8385
----
8486

8587

86-
==== Adding New Servlet Filters
88+
== Adding New Servlet Filters
8789

8890

8991
Just like Servlets, the simplest way to configure a new filter is to simply define a Spring bean:
@@ -109,7 +111,7 @@ myFilter(FilterRegistrationBean) {
109111
NOTE: Grails' internal registered filters (`GrailsWebRequestFilter`, `HiddenHttpMethodFilter` etc.) are defined by incrementing `HIGHEST_PRECEDENCE` by 10 thus allowing several filters to be inserted before or between Grails' filters.
110112

111113

112-
==== Doing Post Initialisation Configuration
114+
== Doing Post Initialisation Configuration
113115

114116

115117
Sometimes it is useful to be able do some runtime configuration after the Spring {springapi}org/springframework/context/ApplicationContext.html[ApplicationContext] has been built. In this case you can define a `doWithApplicationContext` closure property.

grails-doc/src/en/guide/plugins/participatingInAutoReloadEvents.adoc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@ specific language governing permissions and limitations
1717
under the License.
1818
////
1919

20+
= Participating in Auto Reload Events
2021

21-
==== Monitoring Resources for Changes
22+
23+
== Monitoring Resources for Changes
2224

2325

2426
Often it is valuable to monitor resources for changes and perform some action when they occur. This is how Grails implements advanced reloading of application state at runtime. For example, consider this simplified snippet from the Grails `ServicesPlugin`:
@@ -57,7 +59,7 @@ The `event` object defines a number of useful properties:
5759
These objects are available to help you apply the appropriate changes based on what changed. In the "Services" example above, a new service bean is re-registered with the `ApplicationContext` when one of the service classes changes.
5860

5961

60-
==== Influencing Other Plugins
62+
== Influencing Other Plugins
6163

6264

6365
In addition to reacting to changes, sometimes a plugin needs to "influence" another.
@@ -72,7 +74,7 @@ def influences = ['controllers']
7274
----
7375

7476

75-
==== Observing other plugins
77+
== Observing other plugins
7678

7779

7880
If there is a particular plugin that you would like to observe for changes but not necessary watch the resources that it monitors you can use the "observe" property:

grails-doc/src/en/guide/plugins/providingBasicArtefacts.adoc

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@ specific language governing permissions and limitations
1717
under the License.
1818
////
1919

20+
= Providing Basic Artefacts
2021

21-
==== Add Command Line Commands
22+
23+
== Add Command Line Commands
2224

2325

2426
A plugin can add new commands to the Grails interactive shell in one of two ways. First, using the link:{commandLineRef}create-script.html[create-script] you can create a code generation script which will become available to the application. The `create-script` command will create the script in the `src/main/scripts` directory:
@@ -93,7 +95,7 @@ The main difference between code generation scripts and `ApplicationCommand` ins
9395
In Grails 2.x Gant scripts could be used to perform both these tasks, from Grails 3.x+ code generation and interacting with runtime application state has been cleanly separated.
9496

9597

96-
==== Adding a new grails-app artifact (Controller, Tag Library, Service, etc.)
98+
== Adding a new grails-app artifact (Controller, Tag Library, Service, etc.)
9799

98100

99101
A plugin can add new artifacts by creating the relevant file within the `grails-app` tree.
@@ -107,7 +109,7 @@ A plugin can add new artifacts by creating the relevant file within the `grails-
107109
----
108110

109111

110-
==== Providing Views, Templates and View resolution
112+
== Providing Views, Templates and View resolution
111113

112114

113115
When a plugin provides a controller it may also provide default views to be rendered. This is an excellent way to modularize your application through plugins. Grails' view resolution mechanism will first look for the view in the application it is installed into and if that fails will attempt to look for the view within the plugin. This means that you can override views provided by a plugin by creating corresponding GSPs in the application's `grails-app/views` directory.
@@ -124,7 +126,7 @@ However if the view uses templates that are also provided by the plugin then the
124126
Note the usage of the `plugin` attribute, which contains the name of the plugin where the template resides. If this is not specified then Grails will look for the template relative to the application.
125127

126128

127-
==== Excluded Artefacts
129+
== Excluded Artefacts
128130

129131
By default Grails excludes the following files during the packaging process:
130132

grails-doc/src/en/guide/plugins/repositories.adoc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@ specific language governing permissions and limitations
1717
under the License.
1818
////
1919

20+
= Plugin Repositories
2021

21-
==== Distributing Plugins in the Grails Central Plugin Repository
22+
23+
== Distributing Plugins in the Grails Central Plugin Repository
2224

2325

2426
The preferred way to distribute plugin is to publish to the official Grails Central Plugin Repository. This will make your plugin visible to the link:{commandLineRef}list-plugins.html[list-plugins] command:

0 commit comments

Comments
 (0)