Re: [PATCH] docs-rst: add documentation about how to insert images

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Nov 23, 2016 at 07:30:21AM -0200, Mauro Carvalho Chehab wrote:
> Em Wed, 23 Nov 2016 08:34:11 +0100
> Daniel Vetter <daniel@xxxxxxxx> escreveu:
> 
> > On Mon, Nov 21, 2016 at 05:42:07PM -0200, Mauro Carvalho Chehab wrote:
> > > Em Mon, 21 Nov 2016 17:03:55 +0100
> > > Daniel Vetter <daniel@xxxxxxxx> escreveu:
> 
> > > > I'm a complete noob with buildsystems, but can't we do some magic that
> > > > just unconditionally converst all the .dot and .svg files, as needed?  
> > > 
> > > Well, we could call find to discover all *.svg files under Documentation,
> > > calling something like:
> > > 	find Documentation/ -name '*.svg' |grep -v /output
> > > 
> > > However, there are some SVG files under two directories:
> > > 
> > > 	Documentation/blockdev/drbd/
> > > 	Documentation/RCU/
> > > 
> > > We might do something more complex that would grep the image names
> > > at the ReST file, but that would be too hacky, IMHO.
> > > 
> > > That aren't part of the Sphinx build system yet. So, we would end
> > > by either needing to explicitly excluding them on the command shell
> > > or to create some files that would never be used.  
> > 
> > Yeah I considered this, but imo that's not too bad really. As long as we
> > clean up the resulting mess again (which we can again do with a find, once
> > we've made sure all the checked-in binaries are gone). It's not perfect,
> > but for documentation easy-of-use for adding new diagrams imo trumps that
> > slight issue.
> 
> The patch doing that is really simple. See enclosed. I placed it
> on the top of the previous ones. You can get all of them at:
> 	https://git.linuxtv.org/mchehab/experimental.git/log/?h=svg-images-v2
> 
> This is the output of it, for pdfdocs make target:
> 
>   GENPDF  Documentation/RCU/Design/Data-Structures/blkd_task.svg
>   GENPDF  Documentation/RCU/Design/Data-Structures/TreeMapping.svg
>   GENPDF  Documentation/RCU/Design/Data-Structures/HugeTreeClassicRCU.svg
>   GENPDF  Documentation/RCU/Design/Data-Structures/TreeLevel.svg
>   GENPDF  Documentation/RCU/Design/Data-Structures/BigTreeClassicRCU.svg
>   GENPDF  Documentation/RCU/Design/Data-Structures/BigTreePreemptRCUBHdyntickCB.svg
>   GENPDF  Documentation/RCU/Design/Data-Structures/nxtlist.svg
>   GENPDF  Documentation/RCU/Design/Data-Structures/BigTreeClassicRCUBHdyntick.svg
>   GENPDF  Documentation/RCU/Design/Data-Structures/TreeMappingLevel.svg
>   GENPDF  Documentation/RCU/Design/Data-Structures/BigTreeClassicRCUBH.svg
>   GENPDF  Documentation/RCU/Design/Requirements/ReadersPartitionGP1.svg
>   GENPDF  Documentation/RCU/Design/Data-Structures/BigTreePreemptRCUBHdyntick.svg
>   GENPDF  Documentation/RCU/Design/Requirements/GPpartitionReaders1.svg
>   GENPDF  Documentation/media/typical_media_device.svg
>   GENPDF  Documentation/media/uapi/dvb/dvbstb.svg
>   GENPDF  Documentation/media/uapi/v4l/bayer.svg
>   GENPDF  Documentation/media/uapi/v4l/subdev-image-processing-crop.svg
>   GENPDF  Documentation/media/uapi/v4l/fieldseq_bt.svg
>   GENPDF  Documentation/media/uapi/v4l/constraints.svg
>   GENPDF  Documentation/media/uapi/v4l/vbi_hsync.svg
>   GENPDF  Documentation/media/uapi/v4l/nv12mt_example.svg
>   GENPDF  Documentation/media/uapi/v4l/vbi_625.svg
>   GENPDF  Documentation/media/uapi/v4l/vbi_525.svg
>   GENPDF  Documentation/media/uapi/v4l/subdev-image-processing-full.svg
>   GENPDF  Documentation/media/uapi/v4l/nv12mt.svg
>   GENPDF  Documentation/media/uapi/v4l/fieldseq_tb.svg
>   GENPDF  Documentation/media/uapi/v4l/crop.svg
>   GENPDF  Documentation/media/uapi/v4l/subdev-image-processing-scaling-multi-source.svg
>   GENPDF  Documentation/media/uapi/v4l/selection.svg
>   GENPDF  Documentation/blockdev/drbd/DRBD-data-packets.svg
>   GENPDF  Documentation/blockdev/drbd/DRBD-8.3-data-packets.svg
>   DOT     Documentation/scsi/scsi_transport_srp/rport_state_diagram.dot
>   DOT     Documentation/media/uapi/v4l/pipeline.dot
>   DOT     Documentation/blockdev/drbd/conn-states-8.dot
>   DOT     Documentation/blockdev/drbd/drbd-connection-state-overview.dot
>   DOT     Documentation/blockdev/drbd/node-states-8.dot
>   DOT     Documentation/blockdev/drbd/disk-states-8.dot
>   GENPDF  Documentation/scsi/scsi_transport_srp/rport_state_diagram.svg
>   GENPDF  Documentation/media/uapi/v4l/pipeline.svg
>   GENPDF  Documentation/blockdev/drbd/drbd-connection-state-overview.svg
>   GENPDF  Documentation/blockdev/drbd/conn-states-8.svg
>   GENPDF  Documentation/blockdev/drbd/node-states-8.svg
>   GENPDF  Documentation/blockdev/drbd/disk-states-8.svg
>   SPHINX  latexdocs --> file:///devel/v4l/docs/Documentation/output/latex
> 
> > > It could be simpler if someone would convert the stuff there to
> > > ReST.
> > >   
> > > > A bit a hack, but would avoid the most of the above integration trickery.
> > > > And once we've resolved that, we could maybe do a small kernel-figure
> > > > extension, which does the alt tags automatically?  
> > > 
> > > That would indeed work better, as just adding the tag at sphinx would
> > > be enough, but I'm not familiar enough with Python to write it.
> > > Some day I may have enough reasons to dedicate some time to study
> > > Python, but such day didn't arrive yet, as I don't have any other
> > > demand that would require it. So, I would prefer if someone else more
> > > familiar with Python could do that.  
> > 
> > Well, I helped hack together the kernel-doc python with no clue of python
> > too ;-) And we have a few pythonistas here who can point out the most
> > glaring issues.
> 
> Yeah, python is not complex. I wrote once a python script to provide a gui
> for pw-client without knowing anything about the language. I may end doing
> it if no one else step up, when I have enough time (as it would take
> much more than the 5 mins spent writing the enclosed patch).
> 
> > Anyway, just suggestions here that might be worth looking into before we
> > start using diagrams/svg much more widely.
> > -Daniel
> 
> 
> Thanks,
> Mauro
> 
> [PATCH RFC] docs-rst: automatically convert SVG and Graphviz images
> 
> Instead of explicitly specifying the *.dot and *.svg files to
> convert, find them at the filesystem.
> 
> Signed-off-by: Mauro Carvalho Chehab <mchehab@xxxxxxxxxxxxxxxx>

Yeah, I like this a lot more, since it simplifies things a bunch.

Reviewed-by: Daniel Vetter <daniel.vetter@xxxxxxxx>

> 
> diff --git a/Documentation/.gitignore b/Documentation/.gitignore
> index e74fec8693b2..65ac39009e89 100644
> --- a/Documentation/.gitignore
> +++ b/Documentation/.gitignore
> @@ -1,2 +1,9 @@
>  output
>  *.pyc
> +*.pdf
> +blockdev/drbd/conn-states-8.svg
> +blockdev/drbd/disk-states-8.svg
> +blockdev/drbd/drbd-connection-state-overview.svg
> +blockdev/drbd/node-states-8.svg
> +media/uapi/v4l/pipeline.svg
> +scsi/scsi_transport_srp/rport_state_diagram.svg
> diff --git a/Documentation/Makefile.sphinx b/Documentation/Makefile.sphinx
> index adc24ffa4c6a..6a78a6edefbe 100644
> --- a/Documentation/Makefile.sphinx
> +++ b/Documentation/Makefile.sphinx
> @@ -17,11 +17,15 @@ LATEXOPTS     = -interaction=batchmode
>  
>  # Handle SVG and graphviz images
>  
> +DOTS := $(shell find Documentation/ -name '*.dot')
> +IMAGES := $(shell find Documentation/ -name '*.svg' |grep -v /output)
> +IMAGES += $(patsubst %.dot,%.svg,$(DOTS))
> +
>  DOTTGT := $(patsubst %.dot,%.svg,$(DOTS))
> -IMGDOT := $(patsubst %,$(srctree)/Documentation/%,$(DOTTGT))
> +IMGDOT := $(patsubst %,$(srctree)/%,$(DOTTGT))
>  
>  IMGTGT := $(patsubst %.svg,%.pdf,$(IMAGES))
> -IMGPDF := $(patsubst %,$(srctree)/Documentation/%,$(IMGTGT))
> +IMGPDF := $(patsubst %,$(srctree)/%,$(IMGTGT))
>  
>  cmd = $(echo-cmd) $(cmd_$(1))
>  
> diff --git a/Documentation/media/Makefile b/Documentation/media/Makefile
> index b27c202beefb..50f685f958a7 100644
> --- a/Documentation/media/Makefile
> +++ b/Documentation/media/Makefile
> @@ -1,29 +1,3 @@
> -# Rules to convert DOT and SVG to Sphinx images
> -
> -UAPI_V4L = media/uapi/v4l
> -
> -DOTS += \
> -	$(UAPI_V4L)/pipeline.dot \
> -
> -IMAGES += \
> -	media/typical_media_device.svg \
> -	media/uapi/dvb/dvbstb.svg \
> -	$(UAPI_V4L)/bayer.svg \
> -	$(UAPI_V4L)/constraints.svg \
> -	$(UAPI_V4L)/crop.svg \
> -	$(UAPI_V4L)/fieldseq_bt.svg \
> -	$(UAPI_V4L)/fieldseq_tb.svg \
> -	$(UAPI_V4L)/nv12mt.svg \
> -	$(UAPI_V4L)/nv12mt_example.svg \
> -	$(UAPI_V4L)/pipeline.svg \
> -	$(UAPI_V4L)/selection.svg \
> -	$(UAPI_V4L)/subdev-image-processing-full.svg \
> -	$(UAPI_V4L)/subdev-image-processing-scaling-multi-source.svg \
> -	$(UAPI_V4L)/subdev-image-processing-crop.svg \
> -	$(UAPI_V4L)/vbi_525.svg \
> -	$(UAPI_V4L)/vbi_625.svg \
> -	$(UAPI_V4L)/vbi_hsync.svg \
> -
>  # Rules to convert a .h file to inline RST documentation
>  
>  PARSER = $(srctree)/Documentation/sphinx/parse-headers.pl

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux