[media] v4l: doc: Remove row numbers from tables
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Mon, 5 Sep 2016 11:44:34 +0000 (08:44 -0300)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Thu, 22 Sep 2016 10:03:14 +0000 (07:03 -0300)
commitc2b66cafdf020856f6981d03efd9f2706d5f0156
tree53fc68378fd5a4205b0872ca16e4f3160da1fe45
parentc19584882a435bbe41fa555620c7261ba9155ae2
[media] v4l: doc: Remove row numbers from tables

Shorten the tables by removing row numbers in comments, allowing for
later insertion of rows with minimal diffs.

All changes have been generated by the following script.

import io
import re
import sys

def process_table(fname, data):
if fname.endswith('hist-v4l2.rst'):
data = re.sub(u'\n{1,2}\t( ?)  -( ?) ?', u'\n\t\\1 -\\2', data, flags = re.MULTILINE)
data = re.sub(u'\n(\t|       )-  \.\. row [0-9]+\n\t  ?-( ?) ?', u'\\1* -\\2', data, flags = re.MULTILINE)
else:
data = re.sub(u'\n{1,2}       -( ?) ?', u'\n      -\\1', data, flags = re.MULTILINE)
data = re.sub(u'(\n?)(\n\n    -  \.\. row 1\n)', u'\n\\2', data, flags = re.MULTILINE)
data = re.sub(u'\n    -  \.\. row [0-9]+\n      -( ?) ?', u'    * -\\1', data, flags = re.MULTILINE)
data = re.sub(u'\n    -  \.\. row [0-9]+\n       \.\. (_[A-Z0-9_`-]*:)', u'\n    -  .. \\1', data, flags = re.MULTILINE)
data = re.sub(u'\n    -  \.\. (_[A-Z0-9_`-]*:)\n      -', u'    * .. \\1\n\n      -', data, flags = re.MULTILINE)
data = re.sub(u'^       - ', u'      -', data, flags = re.MULTILINE)
data = re.sub(u'^(\t{1,2})  ', u'\\1', data, flags = re.MULTILINE)

return data

def process_file(fname, data):
buf = io.StringIO(data)
output = ''
in_table = False
table_separator = 0

for line in buf.readlines():
if line.find('.. flat-table::') != -1:
in_table = True
table = ''
elif in_table and not re.match('^[\t\n]|(    )', line):
in_table = False
output += process_table(fname, table)

if in_table:
table += line
else:
output += line

if in_table:
in_table = False
output += process_table(fname, table)

return output

fname = sys.argv[1]

data = file(fname, 'rb').read().decode('utf-8')
data = process_file(fname, data)
file(fname, 'wb').write(data.encode('utf-8'))

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
112 files changed:
Documentation/media/uapi/v4l/buffer.rst
Documentation/media/uapi/v4l/control.rst
Documentation/media/uapi/v4l/dev-raw-vbi.rst
Documentation/media/uapi/v4l/dev-rds.rst
Documentation/media/uapi/v4l/dev-sdr.rst
Documentation/media/uapi/v4l/dev-sliced-vbi.rst
Documentation/media/uapi/v4l/dev-subdev.rst
Documentation/media/uapi/v4l/diff-v4l.rst
Documentation/media/uapi/v4l/extended-controls.rst
Documentation/media/uapi/v4l/field-order.rst
Documentation/media/uapi/v4l/hist-v4l2.rst
Documentation/media/uapi/v4l/pixfmt-002.rst
Documentation/media/uapi/v4l/pixfmt-003.rst
Documentation/media/uapi/v4l/pixfmt-006.rst
Documentation/media/uapi/v4l/pixfmt-007.rst
Documentation/media/uapi/v4l/pixfmt-013.rst
Documentation/media/uapi/v4l/pixfmt-grey.rst
Documentation/media/uapi/v4l/pixfmt-indexed.rst
Documentation/media/uapi/v4l/pixfmt-m420.rst
Documentation/media/uapi/v4l/pixfmt-nv12.rst
Documentation/media/uapi/v4l/pixfmt-nv12m.rst
Documentation/media/uapi/v4l/pixfmt-nv16.rst
Documentation/media/uapi/v4l/pixfmt-nv16m.rst
Documentation/media/uapi/v4l/pixfmt-nv24.rst
Documentation/media/uapi/v4l/pixfmt-packed-rgb.rst
Documentation/media/uapi/v4l/pixfmt-packed-yuv.rst
Documentation/media/uapi/v4l/pixfmt-reserved.rst
Documentation/media/uapi/v4l/pixfmt-sbggr16.rst
Documentation/media/uapi/v4l/pixfmt-sdr-cs08.rst
Documentation/media/uapi/v4l/pixfmt-sdr-cs14le.rst
Documentation/media/uapi/v4l/pixfmt-sdr-cu08.rst
Documentation/media/uapi/v4l/pixfmt-sdr-cu16le.rst
Documentation/media/uapi/v4l/pixfmt-sdr-ru12le.rst
Documentation/media/uapi/v4l/pixfmt-srggb10.rst
Documentation/media/uapi/v4l/pixfmt-srggb10p.rst
Documentation/media/uapi/v4l/pixfmt-srggb12.rst
Documentation/media/uapi/v4l/pixfmt-srggb8.rst
Documentation/media/uapi/v4l/pixfmt-tch-td08.rst
Documentation/media/uapi/v4l/pixfmt-tch-td16.rst
Documentation/media/uapi/v4l/pixfmt-tch-tu08.rst
Documentation/media/uapi/v4l/pixfmt-tch-tu16.rst
Documentation/media/uapi/v4l/pixfmt-uv8.rst
Documentation/media/uapi/v4l/pixfmt-uyvy.rst
Documentation/media/uapi/v4l/pixfmt-vyuy.rst
Documentation/media/uapi/v4l/pixfmt-y10.rst
Documentation/media/uapi/v4l/pixfmt-y10b.rst
Documentation/media/uapi/v4l/pixfmt-y12.rst
Documentation/media/uapi/v4l/pixfmt-y12i.rst
Documentation/media/uapi/v4l/pixfmt-y16-be.rst
Documentation/media/uapi/v4l/pixfmt-y16.rst
Documentation/media/uapi/v4l/pixfmt-y41p.rst
Documentation/media/uapi/v4l/pixfmt-y8i.rst
Documentation/media/uapi/v4l/pixfmt-yuv410.rst
Documentation/media/uapi/v4l/pixfmt-yuv411p.rst
Documentation/media/uapi/v4l/pixfmt-yuv420.rst
Documentation/media/uapi/v4l/pixfmt-yuv420m.rst
Documentation/media/uapi/v4l/pixfmt-yuv422m.rst
Documentation/media/uapi/v4l/pixfmt-yuv422p.rst
Documentation/media/uapi/v4l/pixfmt-yuv444m.rst
Documentation/media/uapi/v4l/pixfmt-yuyv.rst
Documentation/media/uapi/v4l/pixfmt-yvyu.rst
Documentation/media/uapi/v4l/pixfmt-z16.rst
Documentation/media/uapi/v4l/subdev-formats.rst
Documentation/media/uapi/v4l/v4l2-selection-flags.rst
Documentation/media/uapi/v4l/v4l2-selection-targets.rst
Documentation/media/uapi/v4l/vidioc-create-bufs.rst
Documentation/media/uapi/v4l/vidioc-cropcap.rst
Documentation/media/uapi/v4l/vidioc-dbg-g-chip-info.rst
Documentation/media/uapi/v4l/vidioc-dbg-g-register.rst
Documentation/media/uapi/v4l/vidioc-decoder-cmd.rst
Documentation/media/uapi/v4l/vidioc-dqevent.rst
Documentation/media/uapi/v4l/vidioc-dv-timings-cap.rst
Documentation/media/uapi/v4l/vidioc-encoder-cmd.rst
Documentation/media/uapi/v4l/vidioc-enum-dv-timings.rst
Documentation/media/uapi/v4l/vidioc-enum-fmt.rst
Documentation/media/uapi/v4l/vidioc-enum-frameintervals.rst
Documentation/media/uapi/v4l/vidioc-enum-framesizes.rst
Documentation/media/uapi/v4l/vidioc-enum-freq-bands.rst
Documentation/media/uapi/v4l/vidioc-enuminput.rst
Documentation/media/uapi/v4l/vidioc-enumoutput.rst
Documentation/media/uapi/v4l/vidioc-enumstd.rst
Documentation/media/uapi/v4l/vidioc-expbuf.rst
Documentation/media/uapi/v4l/vidioc-g-audio.rst
Documentation/media/uapi/v4l/vidioc-g-audioout.rst
Documentation/media/uapi/v4l/vidioc-g-crop.rst
Documentation/media/uapi/v4l/vidioc-g-ctrl.rst
Documentation/media/uapi/v4l/vidioc-g-dv-timings.rst
Documentation/media/uapi/v4l/vidioc-g-edid.rst
Documentation/media/uapi/v4l/vidioc-g-enc-index.rst
Documentation/media/uapi/v4l/vidioc-g-ext-ctrls.rst
Documentation/media/uapi/v4l/vidioc-g-fbuf.rst
Documentation/media/uapi/v4l/vidioc-g-fmt.rst
Documentation/media/uapi/v4l/vidioc-g-frequency.rst
Documentation/media/uapi/v4l/vidioc-g-jpegcomp.rst
Documentation/media/uapi/v4l/vidioc-g-modulator.rst
Documentation/media/uapi/v4l/vidioc-g-parm.rst
Documentation/media/uapi/v4l/vidioc-g-priority.rst
Documentation/media/uapi/v4l/vidioc-g-selection.rst
Documentation/media/uapi/v4l/vidioc-g-sliced-vbi-cap.rst
Documentation/media/uapi/v4l/vidioc-g-tuner.rst
Documentation/media/uapi/v4l/vidioc-querycap.rst
Documentation/media/uapi/v4l/vidioc-queryctrl.rst
Documentation/media/uapi/v4l/vidioc-reqbufs.rst
Documentation/media/uapi/v4l/vidioc-s-hw-freq-seek.rst
Documentation/media/uapi/v4l/vidioc-subdev-enum-frame-interval.rst
Documentation/media/uapi/v4l/vidioc-subdev-enum-frame-size.rst
Documentation/media/uapi/v4l/vidioc-subdev-enum-mbus-code.rst
Documentation/media/uapi/v4l/vidioc-subdev-g-crop.rst
Documentation/media/uapi/v4l/vidioc-subdev-g-fmt.rst
Documentation/media/uapi/v4l/vidioc-subdev-g-frame-interval.rst
Documentation/media/uapi/v4l/vidioc-subdev-g-selection.rst
Documentation/media/uapi/v4l/vidioc-subscribe-event.rst