Re: V4L docs and docbook

2016-02-19 Thread Mauro Carvalho Chehab
Em Fri, 19 Feb 2016 08:28:13 +
Russel Winder  escreveu:

> On Thu, 2016-02-18 at 07:28 -0200, Mauro Carvalho Chehab wrote:
> > Em Thu, 18 Feb 2016 07:10:14 -0200
> > […]
> > 
> > Stupid me: it should be just:
> > asciidoc book.asciidoc
> > 
> > Still, there are lots of broken things there, and lots of errors when
> > building it:
> > https://mchehab.fedorapeople.org/media-kabi-docs-test/book.html
> > 
> > Ok, I would expect the need to handling some things manually, but
> > it worries that it broke the tables. For example, see
> > "Table 1. Control IDs" at https://mchehab.fedorapeople.org/media-kabi
> > -docs-test/book.html
> > 
> > It was mapped as a 3 cols table, but this is how it should be,
> > instead:
> > https://linuxtv.org/downloads/v4l-dvb-apis/control.html
> > 
> > As this table has actually 5 cols, because some controls have a list
> > of multiple values (see V4L2_CID_COLORFX for example).  
> 
> I will not be able to do anything to help with any of this today, but I
> can try and take a look tomorrow.
> 
> Certainly an automated translation will not do all the complicated
> bits, that will need manual intervention.

True, although I would feel more comfortable if we can use a tool for
those nested tables, as there are a lot of them at the V4L2 part of
the media kAPI doc. It would probably worth to either write a script
or to patch an existing tool like pandoc to make it work with
nested tables.

> I may well be able to assist
> on this. I think the transform from DocBook/XML is worth a bit of up
> front effort now, so as to make everything so much easier for all
> concerned in the future. Obviously I do not have data relating to this
> project, just experience and anecdotal evidence from others.


Thanks!

-- 
Thanks,
Mauro


pgpacpHMbBfzT.pgp
Description: Assinatura digital OpenPGP


Re: V4L docs and docbook

2016-02-18 Thread Mauro Carvalho Chehab
Em Thu, 18 Feb 2016 11:37:41 +0200
Jani Nikula  escreveu:

> On Thu, 18 Feb 2016, Mauro Carvalho Chehab  wrote:
> > Are there any tools that would convert from DocBook to ASCIIDoc?  
> 
> I used pandoc when I tested the asciidoc pipeline. Something along the
> lines of this for filtering docbook in stdin to asciidoc in stdout:
> 
> pandoc --atx-headers -f docbook -t asciidoc
>

Results are at:
https://mchehab.fedorapeople.org/media-kabi-docs-test/pandoc_asciidoc/

pandoc/asciidoc also broke the tables.


Thanks,
Mauro
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: V4L docs and docbook

2016-02-18 Thread Jani Nikula
On Thu, 18 Feb 2016, Mauro Carvalho Chehab  wrote:
> Are there any tools that would convert from DocBook to ASCIIDoc?

I used pandoc when I tested the asciidoc pipeline. Something along the
lines of this for filtering docbook in stdin to asciidoc in stdout:

pandoc --atx-headers -f docbook -t asciidoc


BR,
Jani.


-- 
Jani Nikula, Intel Open Source Technology Center
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: V4L docs and docbook

2016-02-18 Thread Jani Nikula
On Thu, 18 Feb 2016, Russel Winder  wrote:
> On Wed, 2016-02-17 at 21:51 -0200, Mauro Carvalho Chehab wrote:
>> […]
>> 
>> We have 2 types of documentation for the Kernel part of the
>> subsystem,
>> Both using DocBook:
>> - The uAPI documentation:
>>  https://linuxtv.org/downloads/v4l-dvb-apis
>> - The kAPI documentation:
>>  https://linuxtv.org/downloads/v4l-dvb-internals/device-drivers/
>> mediadev.html
> […]
>
> I may not be introducing new data here but…
>
> Whilst ReStructuredText and Markdown are fairly popular text markup
> languages, they are not related to the DocBook/XML toolchain.
>
> Many people, especially authors of books etc. are not really willing to
> write in DocBook/XML even though it is the re-purposable representation
> of choice for most of the major publishers. This led to ASCIIDoc.
>
> ASCIIDoc is a plain text markup language in the same way
> ReStructuredText and Markdown are, but it's intention was always to be
> a lightweight front end to DocBook/XML so as to allow authors to write
> in a nice markup language but work with the DocBook/XML toolchain.

We have been looking at asciidoc too, so much so that there are draft
patches by Jon and me to build some of the documentation from asciidoc
source. Both are in the thread starting at [1]. But we really need to
consider reStructuredText too [2].

I think this thread is about figuring out how much we really depend on
DocBook. There is a lot of pain in dealing with DocBook, especially as a
source format, but also as an intermediate format. If we can produce the
end results (html, pdf, man, ...) from the source markup directly, it's
a win.

> ASCIIDoc has gained quite a strong following. So much so that it now
> has a life of its own separate from the DocBook/XML tool chain. There
> is ASCIIDoctor which generates PDF, HTML,… from the source without
> using DocBook/XML, yet the source can quite happily go through a
> DocBook/XML toolchain as well.

See some of the other threads. Asciidoc seems to be in maintenance
mode. Asciidoctor depends on a ruby environment which is not met with
enthusiasm. The HTML output can only be chunked (split to several pages)
via the DocBook output. Sphinx is active, doesn't add a lot of new
dependencies, and seems to be able to natively output all the end
results people have so far said they care about.

> Many of the open source projects I am involved with are now using
> ASCIIDoctor as the documentation form. This has increased the number of
> non-main-contributor contributions via pull requests. It is so much
> easier to work with ASCIIDoc(tor) source than DocBook/XML source. 

I'm hopeful this holds for any of the lightweight markups.


BR,
Jani.


[1] http://lkml.kernel.org/r/1453764522-29030-1-git-send-email-cor...@lwn.net
[2] http://lkml.kernel.org/r/20160213145317.247c6...@lwn.net

-- 
Jani Nikula, Intel Open Source Technology Center
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: V4L docs and docbook

2016-02-18 Thread Mauro Carvalho Chehab
Em Thu, 18 Feb 2016 06:31:14 -0200
Mauro Carvalho Chehab  escreveu:

> Em Thu, 18 Feb 2016 08:17:00 +
> Russel Winder  escreveu:
> 
> > On Wed, 2016-02-17 at 21:51 -0200, Mauro Carvalho Chehab wrote:  
> > > […]
> > > 
> > > We have 2 types of documentation for the Kernel part of the
> > > subsystem,
> > > Both using DocBook:
> > > - The uAPI documentation:
> > >   https://linuxtv.org/downloads/v4l-dvb-apis
> > > - The kAPI documentation:
> > >   https://linuxtv.org/downloads/v4l-dvb-internals/device-drivers/
> > > mediadev.html
> > […]
> > 
> > I may not be introducing new data here but…
> > 
> > Whilst ReStructuredText and Markdown are fairly popular text markup
> > languages, they are not related to the DocBook/XML toolchain.
> > 
> > Many people, especially authors of books etc. are not really willing to
> > write in DocBook/XML even though it is the re-purposable representation
> > of choice for most of the major publishers. This led to ASCIIDoc.
> > 
> > ASCIIDoc is a plain text markup language in the same way
> > ReStructuredText and Markdown are, but it's intention was always to be
> > a lightweight front end to DocBook/XML so as to allow authors to write
> > in a nice markup language but work with the DocBook/XML toolchain.
> > 
> > ASCIIDoc has gained quite a strong following. So much so that it now
> > has a life of its own separate from the DocBook/XML tool chain. There
> > is ASCIIDoctor which generates PDF, HTML,… from the source without
> > using DocBook/XML, yet the source can quite happily go through a
> > DocBook/XML toolchain as well.
> > 
> > Many of the open source projects I am involved with are now using
> > ASCIIDoctor as the documentation form. This has increased the number of
> > non-main-contributor contributions via pull requests. It is so much
> > easier to work with ASCIIDoc(tor) source than DocBook/XML source.   
> 
> Are there any tools that would convert from DocBook to ASCIIDoc?

Answering myself:

I found one tool at:
https://github.com/oreillymedia/docbook2asciidoc

That seemed to work. I ran it with:
$ make DOCBOOKS=media_api.xml htmldocs 2>&1 | grep -v "element.*: 
validity error : ID .* already defined"
$ xmllint --noent --postvalid 
"$PWD/Documentation/DocBook/media_api.xml" >/tmp/x.xml 2>/dev/null
$ java -jar saxon9he.jar -s /tmp/x.xml -o book.asciidoc d2a_docbook.xsl 
chunk-output=true

And it produced a series of documents, that I stored at:
https://mchehab.fedorapeople.org/media-kabi-docs-test/

I noticed, however, that it kept some things using DocBook xml. Perhaps
because some things cannot be translated to markup (see appa.asciidoc)?

Also, converting them to HTML produced me some errors, but perhaps because
I don't know what I'm doing ;)

What I did was:
for i in book-docinfo.xml *.asciidoc; do asciidoc $i; done

errors enclosed.

Yet, it seems there are some hope on using asciidoc for the kAPI
documentation.

Thanks,
Mauro

---

asciidoc: ERROR: book.asciidoc: line 9: only book doctypes can contain level 0 
sections
asciidoc: ERROR: ch01.asciidoc: line 588: only book doctypes can contain level 
0 sections
asciidoc: ERROR: ch02.asciidoc: line 2: section title not permitted in 
delimited block
asciidoc: ERROR: ch03.asciidoc: line 2: section title not permitted in 
delimited block
asciidoc: ERROR: ch03.asciidoc: line 370: illegal style name: capture example
asciidoc: ERROR: ch04.asciidoc: line 2: section title not permitted in 
delimited block
asciidoc: ERROR: ch04.asciidoc: line 719: illegal style name: to do
asciidoc: ERROR: ch05.asciidoc: line 2: section title not permitted in 
delimited block
asciidoc: ERROR: ch06.asciidoc: line 2: section title not permitted in 
delimited block
asciidoc: ERROR: ch07.asciidoc: line 2: section title not permitted in 
delimited block
asciidoc: ERROR: ch07.asciidoc: line 907: illegal style name: Solution?
asciidoc: ERROR: ch07.asciidoc: line 2208: illegal style name: to do - OSS/ALSA
asciidoc: ERROR: appa.asciidoc: line 3: section title not permitted in 
delimited block
asciidoc: WARNING: appa.asciidoc: line 7: missing style: [blockdef-pass]: 
appendix
asciidoc: ERROR: appb.asciidoc: line 2: section title not permitted in 
delimited block
asciidoc: WARNING: appb.asciidoc: line 7: missing style: [paradef-default]: 
appendix
asciidoc: ERROR: appc.asciidoc: line 3: section title not permitted in 
delimited block
asciidoc: WARNING: appc.asciidoc: line 7: missing style: [blockdef-pass]: 
appendix
asciidoc: ERROR: appd.asciidoc: line 3: section title not permitted in 
delimited block
asciidoc: WARNING: appd.asciidoc: line 7: missing style: [blockdef-pass]: 
appendix
asciidoc: ERROR: appe.asciidoc: line 3: section title not permitted in 
delimited block
asciidoc: WARNING: appe.asciidoc: line 5: missing style: [paradef-default]: 
appendix
asciidoc: ERROR: book.asciidoc: line 142: section title not permitted in 
delimited block

Re: V4L docs and docbook

2016-02-18 Thread Mauro Carvalho Chehab
Em Thu, 18 Feb 2016 08:17:00 +
Russel Winder  escreveu:

> On Wed, 2016-02-17 at 21:51 -0200, Mauro Carvalho Chehab wrote:
> > […]
> > 
> > We have 2 types of documentation for the Kernel part of the
> > subsystem,
> > Both using DocBook:
> > - The uAPI documentation:
> > https://linuxtv.org/downloads/v4l-dvb-apis
> > - The kAPI documentation:
> > https://linuxtv.org/downloads/v4l-dvb-internals/device-drivers/
> > mediadev.html  
> […]
> 
> I may not be introducing new data here but…
> 
> Whilst ReStructuredText and Markdown are fairly popular text markup
> languages, they are not related to the DocBook/XML toolchain.
> 
> Many people, especially authors of books etc. are not really willing to
> write in DocBook/XML even though it is the re-purposable representation
> of choice for most of the major publishers. This led to ASCIIDoc.
> 
> ASCIIDoc is a plain text markup language in the same way
> ReStructuredText and Markdown are, but it's intention was always to be
> a lightweight front end to DocBook/XML so as to allow authors to write
> in a nice markup language but work with the DocBook/XML toolchain.
> 
> ASCIIDoc has gained quite a strong following. So much so that it now
> has a life of its own separate from the DocBook/XML tool chain. There
> is ASCIIDoctor which generates PDF, HTML,… from the source without
> using DocBook/XML, yet the source can quite happily go through a
> DocBook/XML toolchain as well.
> 
> Many of the open source projects I am involved with are now using
> ASCIIDoctor as the documentation form. This has increased the number of
> non-main-contributor contributions via pull requests. It is so much
> easier to work with ASCIIDoc(tor) source than DocBook/XML source. 

Are there any tools that would convert from DocBook to ASCIIDoc?

Thanks,
Mauro


pgp06fUKfAiNJ.pgp
Description: Assinatura digital OpenPGP


Re: V4L docs and docbook

2016-02-17 Thread Hans Verkuil
Hi Jon,

On 02/17/2016 10:52 PM, Jonathan Corbet wrote:
> Hey, Mauro,
> 
> There's been a conversation going on that I keep meaning to bring you
> into.  In short, there's a fair amount of interest in improving our
> formatted kernel documentation, and, in particular, making it easier to
> write; I'd like to be sure that work doesn't leave media behind.
> 
> Work pushed by Daniel Vetter and company has been aiming toward the
> ability to use a lightweight markup language in the in-source kerneldoc
> comments.  Initially Markdown was targeted; the most likely choice now
> looks like ReStructuredText, though no decision has been made.  I've been
> pushing for moving all of our formatted documentation to whatever markup
> we use, leaving DocBook behind.  There are, I think, a lot of good
> reasons to want to do that, including consistency between the template
> files and the in-source comments, ease of authoring, and a less unwieldy
> toolchain.

I looked at ReStructuredText and it looks like it will be a pain to convert
the media DocBook code to that, and the main reason is the poor table support.
The syntax for that looks very painful and the media DocBook is full of tables.

BTW, my daily build scripts also rebuilds the media spec and it is available
here: https://hverkuil.home.xs4all.nl/spec/media.html

Also missing in ReStructuredText seems to be support for formulas (see for
example the Colorspaces section in the spec), although to be fair standard
DocBook doesn't do a great job at that either.

Now, I hate DocBook so going to something easier would certainly be nice,
but I think it is going to be a difficult task.

Someone would have to prove that going to another formatting tool will
produce good results for our documentation. We can certainly give a few
representative sections of our doc to someone to convert, and if that
looks OK, then the full conversion can be done.

We have (and still are) put a lot of effort into our documentation and
we would like to keep the same level of quality.

Regards,

Hans

> 
> Various proof-of-concept patches have gone around showing that this idea
> seems to be feasible.  The latest discussion is at:
> 
>   http://thread.gmane.org/gmane.linux.documentation/35773
> 
> The media community has a lot of investment in DocBook documentation.
> Converting to another markup form is relatively easy, and it's something
> I would be willing to help with when the time comes.  But it occurred to
> me that I should probably ask what you all think of this.
> 
> There is no flag day here; there's no reason to rip out the current
> DocBook-based build infrastructure as long as somebody's using it.  But
> it would be nice to get rid of it eventually and work toward the creation
> of a more integrated set of kernel documentation.
> 
> So...is this an idea that fills you with horror, or does it maybe have
> some appeal?  Do you have any questions?
> 
> One other question I had for you was: which of the allegedly supported
> output formats are important to you?
> 
> Thanks,
> 
> jon
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: V4L docs and docbook

2016-02-17 Thread Mauro Carvalho Chehab
Hi Jon,

Em Wed, 17 Feb 2016 14:52:54 -0700
Jonathan Corbet  escreveu:

> Hey, Mauro,
> 
> There's been a conversation going on that I keep meaning to bring you
> into.  In short, there's a fair amount of interest in improving our
> formatted kernel documentation, and, in particular, making it easier to
> write; I'd like to be sure that work doesn't leave media behind.
> 
> Work pushed by Daniel Vetter and company has been aiming toward the
> ability to use a lightweight markup language in the in-source kerneldoc
> comments.  Initially Markdown was targeted; the most likely choice now
> looks like ReStructuredText, though no decision has been made.  I've been
> pushing for moving all of our formatted documentation to whatever markup
> we use, leaving DocBook behind.  There are, I think, a lot of good
> reasons to want to do that, including consistency between the template
> files and the in-source comments, ease of authoring, and a less unwieldy
> toolchain.
> 
> Various proof-of-concept patches have gone around showing that this idea
> seems to be feasible.  The latest discussion is at:
> 
>   http://thread.gmane.org/gmane.linux.documentation/35773
> 
> The media community has a lot of investment in DocBook documentation.
> Converting to another markup form is relatively easy, and it's something
> I would be willing to help with when the time comes.  But it occurred to
> me that I should probably ask what you all think of this.
> 
> There is no flag day here; there's no reason to rip out the current
> DocBook-based build infrastructure as long as somebody's using it.  But
> it would be nice to get rid of it eventually and work toward the creation
> of a more integrated set of kernel documentation.
> 
> So...is this an idea that fills you with horror, or does it maybe have
> some appeal?  Do you have any questions?

As you can see at:
https://linuxtv.org/docs.php

We have 2 types of documentation for the Kernel part of the subsystem,
Both using DocBook:
- The uAPI documentation:
https://linuxtv.org/downloads/v4l-dvb-apis
- The kAPI documentation:

https://linuxtv.org/downloads/v4l-dvb-internals/device-drivers/mediadev.html

The kAPI uses kernel-doc. I believe it should be easy to convert and/or
add markup tags there to improve it. Actually, this is one of the things
we currently miss. So, anything to improve it will be very welcomed.

The uAPI is a different story. What we have there is a join of two
different documents:
- The V4L2 documentation, written directly in DocBook
- The DVB API documentation, written originally in LaTex and later
  migrated to DocBook.

Such documentation uses extensive usage of the DocBook features,
so, I think it won't be trivial to convert it.

In addition, we have some scripts embedded at the DocBook/media
Makefile that create cross-references between the public API
headers and the DocBook, warning us if some new ioctl, define,
enum, ... was created without the corresponding documentation.

While not perfect, those scripts help a lot for us to be sure that
no uAPI changes would reach upstream without the corresponding
documentation. They work by parsing the uapi/*.h files we use and
adding references to (almost) every data type there. As those
headers are included at the documentation as appendices, DocBook
generation with xmllint will check if all references exist and will
produce an alert if something is missing. I even run xmllint manually
to make it pedantic, using the script below:

make cleanmediadocs
make DOCBOOKS=media_api.xml htmldocs 2>&1 | grep -v "element.*: 
validity error : ID .* already defined"
echo
echo "Do some pedantic checks and generate DocBook/media/media_api.html 
without chunks"
echo
xmllint --noent --postvalid "$PWD/Documentation/DocBook/media_api.xml" 
>/tmp/x.xml 2>/dev/null
xmllint --noent --postvalid --noout /tmp/x.xml
xmlto html-nochunks -m ./Documentation/DocBook/stylesheet.xsl -o 
Documentation/DocBook/media Documentation/DocBook/media_api.

I run the above script every time a patch touches on one of the public
API headers, as part of my reviewing process.

I believe that porting it to whatever other documentation system we
decide would be painful and would require a lot of effort.

Also, as we're touching the documentation on almost all Kernel versions, 
such porting effort should happen quickly, as otherwise it would either
prevent us from adding new features at the subsystem, or we would need to
keep 2 copies of the documentation, and the ones porting it would have to
port later the new additions.

So, I guess we'll likely need to postpone converting the uAPI document
until we can find someone with time and knowledge to do it quicky.

> One other question I had for you was: which of the allegedly supported
> output formats are important to you?

The most important format is html, on both on multiple docs, like the one
hosted at 

V4L docs and docbook

2016-02-17 Thread Jonathan Corbet
Hey, Mauro,

There's been a conversation going on that I keep meaning to bring you
into.  In short, there's a fair amount of interest in improving our
formatted kernel documentation, and, in particular, making it easier to
write; I'd like to be sure that work doesn't leave media behind.

Work pushed by Daniel Vetter and company has been aiming toward the
ability to use a lightweight markup language in the in-source kerneldoc
comments.  Initially Markdown was targeted; the most likely choice now
looks like ReStructuredText, though no decision has been made.  I've been
pushing for moving all of our formatted documentation to whatever markup
we use, leaving DocBook behind.  There are, I think, a lot of good
reasons to want to do that, including consistency between the template
files and the in-source comments, ease of authoring, and a less unwieldy
toolchain.

Various proof-of-concept patches have gone around showing that this idea
seems to be feasible.  The latest discussion is at:

http://thread.gmane.org/gmane.linux.documentation/35773

The media community has a lot of investment in DocBook documentation.
Converting to another markup form is relatively easy, and it's something
I would be willing to help with when the time comes.  But it occurred to
me that I should probably ask what you all think of this.

There is no flag day here; there's no reason to rip out the current
DocBook-based build infrastructure as long as somebody's using it.  But
it would be nice to get rid of it eventually and work toward the creation
of a more integrated set of kernel documentation.

So...is this an idea that fills you with horror, or does it maybe have
some appeal?  Do you have any questions?

One other question I had for you was: which of the allegedly supported
output formats are important to you?

Thanks,

jon
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html