Skip to content

Commit 621159a

Browse files
committed
fix code-block syntax
1 parent 8cf69bb commit 621159a

File tree

1 file changed

+12
-24
lines changed

1 file changed

+12
-24
lines changed

docs/backend/widgets.md

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,7 @@ Before that, the `groups` attribute is just a list of group factories.
211211
During the update method though, the groups have been initialized and have their own widget list each.
212212
To access widgets in a group, you have to access the group in the update method:
213213

214-
``` {code-block} python
215-
:linenos:
214+
```python
216215

217216
from z3c.form import form
218217

@@ -231,8 +230,7 @@ class MyForm(form.Form):
231230
You can customize widget options in the `updateWidgets()` method.
232231
Note that `fieldset` (which is a group) is a `subform`, and this method only affects the current `fieldset`.
233232

234-
``` {code-block} python
235-
:linenos:
233+
```python
236234

237235
from z3c.form import form
238236

@@ -254,8 +252,7 @@ class MyForm(form.Form):
254252

255253
With `plone.z3cform`, you can reorder the field widgets by overriding the `update()` method of the form class.
256254

257-
``` {code-block} python
258-
:linenos:
255+
```python
259256

260257
from z3c.form import form
261258
from z3c.form.interfaces import HIDDEN_MODE
@@ -277,8 +274,7 @@ class MyForm(form.Form):
277274

278275
You also can use `plone.autoform` directives, as in this example used for forms:
279276

280-
``` {code-block} python
281-
:linenos:
277+
```python
282278

283279
from plone.autoform import directives as form
284280
from z3c.form.interfaces import IAddForm, IEditForm
@@ -308,8 +304,7 @@ class IFlexibleContent(form.Schema):
308304
Sometimes you need to pre-load widget values to show when the form is requested.
309305
The following example shows how to do that.
310306

311-
``` {code-block} python
312-
:linenos:
307+
```python
313308

314309
from z3c.form import field
315310
from z3c.form import form
@@ -350,8 +345,7 @@ This will result in a checked option value of `02`.
350345

351346
The following example shows how you can conditionally require widgets.
352347

353-
``` {code-block} python
354-
:linenos:
348+
```python
355349

356350
class ReportForm(form.Form):
357351
""" A form to output an HTML report from chosen parameters """
@@ -370,16 +364,14 @@ class ReportForm(form.Form):
370364
To add CSS classes to a widget, you can use the method `addClass()`.
371365
This is useful when you have JavaScript associated with your form:
372366

373-
``` {code-block} python
374-
:linenos:
367+
```python
375368

376369
widget.addClass("myspecialwidgetclass")
377370
```
378371

379372
You can also override the widget CSS class by changing the `klass` attribute for a given widget:
380373

381-
``` {code-block} python
382-
:linenos:
374+
```python
383375

384376
self.widgets["my_widget"].klass = "my-custom-css-class"
385377
```
@@ -468,8 +460,7 @@ The following code is an example of a custom template `yourwidget.pt` for an `in
468460

469461
Now you can override the template factory in the `updateWidgets()` method of your form class.
470462

471-
``` {code-block} python
472-
:linenos:
463+
```python
473464

474465
from zope.browserpage.viewpagetemplatefile import ViewPageTemplateFile as Z3ViewPageTemplateFile
475466
from z3c.form.interfaces import INPUT_MODE
@@ -545,8 +536,7 @@ Remember to fix the path of the template according to your own paths.
545536

546537
Then create a new marker interface in Python code.
547538

548-
``` {code-block} python
549-
:linenos:
539+
```python
550540

551541
from zope.interface import Interface
552542

@@ -557,8 +547,7 @@ class IDemoWidget(Interface):
557547

558548
Then apply this marker interface to your widgets in `form.update()`.
559549

560-
``` {code-block} python
561-
:linenos:
550+
```python
562551

563552
from zope.interface import alsoProvides
564553

@@ -578,8 +567,7 @@ You can combine several widgets into one with `z3c.form.browser.multil.MultiWidg
578567

579568
The following example shows how to create an input widget with minimum and maximum values.
580569

581-
``` {code-block} python
582-
:linenos:
570+
```python
583571

584572
import zope.interface
585573
import zope.schema

0 commit comments

Comments
 (0)