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

using tag::foo[] around table rows #2632

Open
janicesignalfx opened this issue Mar 26, 2018 · 4 comments
Open

using tag::foo[] around table rows #2632

janicesignalfx opened this issue Mar 26, 2018 · 4 comments

Comments

@janicesignalfx
Copy link

I am designing a docset that uses a lot of tables. Each header, property, parameter, etc has its own row. Properties, parameters, etc that appear in many different calls/functions/methods are placed inside files in common directories and tagged using a set pattern for individual inclusion in the various tables. Rows that are specific to a single API call are placed in a data file for that call and defined there.

However I just encountered a specific case where I need to reuse some parameters in exactly two tables within the same call space. This case will occur in the majority of entries of a specific type of reference entry that does not have a common data file model because everything else is either a one off or reused across entries. Rather than littering the common files with these "two-off" rows, I tried doing it this way:

Table 1:

.{callname} {method-action} parameters
[%header, caption="Table {counter:tablenum}: ", cols="2a,1,3a,4a"]
|===
| Parameter 
| Type 
| Constraints 
| Description

tag::A[]
| paramName
| float
| 
* constraint1
| descriptiom
end::A[]

|===

Table 2:

.{callname} {method-action} parameters
[%header, caption="Table {counter:tablenum}: ", cols="2a,1,3a,4a"]
|===
| Parameter 
| Type 
| Constraints 
| Description

include::file.adoc[tag=A]

|===

The tag works and table 2 includes the repeated row, but Table 1 thinks the tag start macro is part of the last heading and displays it there.

I realize why this is happening and that tables break on the | (on reflection, I am somewhat surprised the include worked), but am wondering if there's a way to override this and make the tag work without being visible - it would be a lot cleaner than the other solutions I can think of for single sourcing "two-off" rows where the reuse is within a small scope of the document (essentially the same reference page).

@mojavelinux
Copy link
Member

When you use tags in an AsciiDoc document, you must hide them using a line comment.

//tag::A[]
| paramName
| float
| 
* constraint1
| descriptiom
//end::A[]

Otherwise, they will be treated as content. The tag directives can appear anywhere on a line as long as it's the last thing on that line.

@mojavelinux
Copy link
Member

(btw, we use this technical in a lot of places in the Asciidoctor user manual).

@janicesignalfx
Copy link
Author

janicesignalfx commented Mar 26, 2018

I saw that comments were required in the docs - it didn't register originally for some reason and the other places I use the tags are never included anywhere except via the tag mechanism so it doesn't matter for them. I thought I tried that without success before I posted. However, I tried it again just and it's working. Thanks, and sorry to bother you with something that wound up being user error.

@mojavelinux
Copy link
Member

I'm glad to hear it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants