Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve asciidoc example template #538

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ build/examples: bin/protoc build tmp/googleapis examples/proto/*.proto examples/
@$(EXAMPLE_CMD) --doc_opt=html,example.html:Ignore* examples/proto/*.proto
@$(EXAMPLE_CMD) --doc_opt=json,example.json:Ignore* examples/proto/*.proto
@$(EXAMPLE_CMD) --doc_opt=markdown,example.md:Ignore* examples/proto/*.proto
@$(EXAMPLE_CMD) --doc_opt=examples/templates/asciidoc.tmpl,example.txt:Ignore* examples/proto/*.proto
@$(EXAMPLE_CMD) --doc_opt=examples/templates/asciidoc.tmpl,example.adoc:Ignore* examples/proto/*.proto

##@: Dev

Expand Down
18 changes: 14 additions & 4 deletions examples/doc/example.txt → examples/doc/example.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@



[[com.example.Booking]]
=== Booking
Represents the booking of a vehicle.

Expand All @@ -26,12 +27,13 @@ Vehicles are some cool shit. But drive carefully!

|payment_received | <<bool,bool>> | |Has payment been received?

|color_preference | <<string,string>> | |Color preference of the customer.
|color_preference | <<string,string>> | |**Deprecated.** Color preference of the customer.

|===========================================



[[com.example.BookingStatus]]
=== BookingStatus
Represents the status of a vehicle booking.

Expand All @@ -47,6 +49,7 @@ Represents the status of a vehicle booking.



[[com.example.BookingStatusID]]
=== BookingStatusID
Represents the booking status ID.

Expand All @@ -60,6 +63,7 @@ Represents the booking status ID.



[[com.example.EmptyBookingMessage]]
=== EmptyBookingMessage
An empty message for testing

Expand All @@ -73,6 +77,7 @@ An empty message for testing



[[com.example.Address]]
=== Address
Represents a mail address.

Expand All @@ -96,6 +101,7 @@ Represents a mail address.



[[com.example.Customer]]
=== Customer
Represents a customer.

Expand Down Expand Up @@ -128,6 +134,7 @@ Represents a customer.



[[com.example.Manufacturer]]
=== Manufacturer
Represents a manufacturer of cars.

Expand All @@ -141,12 +148,13 @@ Represents a manufacturer of cars.

|details | <<string,string>> |optional |Manufacturer details (minimum orders et.c.).

|category | <<com.example.Manufacturer.Category,Manufacturer.Category>> |optional |Manufacturer category.
|category | <<com.example.Manufacturer.Category,Manufacturer.Category>> |optional |Manufacturer category. Default: CATEGORY_EXTERNAL

|===========================================



[[com.example.Model]]
=== Model
Represents a vehicle model.

Expand All @@ -168,6 +176,7 @@ Represents a vehicle model.



[[com.example.Vehicle]]
=== Vehicle
Represents a vehicle that can be hired.

Expand All @@ -185,14 +194,15 @@ Represents a vehicle that can be hired.

|category | <<com.example.Vehicle.Category,Vehicle.Category>> |optional |Vehicle category.

|daily_hire_rate_dollars | <<sint32,sint32>> |optional |Dollars per day.
|daily_hire_rate_dollars | <<sint32,sint32>> |optional |Dollars per day. Default: 50

|daily_hire_rate_cents | <<sint32,sint32>> |optional |Cents per day.

|===========================================



[[com.example.Vehicle.Category]]
=== Vehicle.Category
Represents a vehicle category. E.g. "Sedan" or "Truck".

Expand All @@ -210,7 +220,7 @@ Represents a vehicle category. E.g. "Sedan" or "Truck".



[[Manufacturer.Category]]
[[com.example.Manufacturer.Category]]
=== Manufacturer.Category
Manufacturer category. A manufacturer may be either inhouse or external.

Expand Down
5 changes: 3 additions & 2 deletions examples/templates/asciidoc.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,23 @@

{{range .Messages}}

[[{{.FullName}}]]
=== {{.LongName}}
{{nobr .Description}}

{{if .HasFields}}
|===========================================
|*Field* |*Type* |*Label* |*Description*
{{range .Fields}}
|{{.Name}} | <<{{.FullType}},{{.LongType}}>> |{{.Label}} |{{.Description}}
|{{.Name}} | <<{{.FullType}},{{.LongType}}>> |{{.Label}} |{{if (index .Options "deprecated"|default false)}}**Deprecated.** {{end}}{{nobr .Description}}{{if .DefaultValue}} Default: {{.DefaultValue}}{{end}}
{{end}}
|===========================================
{{end}}
{{end}}

{{range .Enums}}

[[{{.LongName}}]]
[[{{.FullName}}]]
=== {{.LongName}}
{{.Description}}

Expand Down