DocBox 出力例

このページの内容

DocBox 出力例

bxSites docbox が実際に生成するものの例です。以下のページ はすべて、示したソースに対する実際の実行結果であり、手書きの説明では ありません。

プロジェクトの models/ フォルダーに次のクラスがあるとします。

/**
 * A single book on the shelf, immutable once created.
 *
 * @author Ortus Solutions
 */
class singleton accessors=true {

	/**
	 * The book's title
	 */
	property name="title" type="string";

	/**
	 * Where book records are read from
	 */
	property name="datasource" type="string" inject="coldbox:setting:bookDatasource";

	/**
	 * Build a book.
	 *
	 * @title The book's title
	 * @author The book's author
	 */
	function init( required string title, string author = "Unknown" ) {
		return this
	}

	/**
	 * Return a copy of this book with a new title.
	 *
	 * @newTitle The replacement title
	 *
	 * @return a copy carrying the new title
	 */
	Book function withTitle( required string newTitle ) {}

	private function normalize() {}
}

...bxSites docboxapi/docbox/models/Book.md を次の frontmatter で 書き出します。

---
title: "Book"
summary: "A single book on the shelf, immutable once created."
tags: [api, docbox]
---

そして本文は次のとおりです。コードブロックではなく実際にレンダリングして います。これが生成されたページの本文そのもので、フィルターバーも動作 します。Private チップを押すか、検索ボックスに "title" と入力してみて ください。


Book

models.Book · Class

A single book on the shelf, immutable once created.

Annotations

  • @accessors true
  • @singleton

Properties

PropertyTypeDefaultDescription
titlestringThe book's title
datasourcestringWhere book records are read from @inject coldbox:setting:bookDatasource

Constructor

Any init( required string title, string author = "Unknown" )

Build a book.

ParameterTypeRequiredDefaultDescription
titlestringyesThe book's title
authorstringnoUnknownThe book's author

Public methods

Book withTitle( required string newTitle )

Return a copy of this book with a new title.

ParameterTypeRequiredDefaultDescription
newTitlestringyesThe replacement title
  • Returns a copy carrying the new title

Private methods

Any normalize()


注目すべき点

  • プロパティ表が存在すること。 DocBox 自身の JSON ストラテジーは宣言 された property ブロックを落とします。bx-sites は DocBox が使ったのと 同じクラスメタデータから読み直すため、titledatasource が説明つき で並び、datasource の WireBox inject も残ります。
  • @return のテキストも同じ理由で残ります。 withTitle の下の Returns 行を見てください。
  • private メソッドも含まれます。 Javadoc ジェネレーターとは異なり、 DocBox が報告するのでドキュメント化され、不要なときは Private チップで 隠せます。
  • init はコンストラクターとして、メソッドより前の独立したセクション になります。

設定については DocBox APIリファレンス を、同じプロジェクトから ColdBox verb が生成するものについては ColdBox 出力例 を参照してください。

このページを編集 Markdownをダウンロード 最終更新 Sep 11, 2026, 7:11:15 PM