Skip to content

Commit

Permalink
current status
Browse files Browse the repository at this point in the history
  • Loading branch information
pstorz committed Nov 30, 2018
1 parent 9348d3f commit 6a974ce
Show file tree
Hide file tree
Showing 8 changed files with 392 additions and 501 deletions.
2 changes: 1 addition & 1 deletion docs/manuals/en/new_main_reference/Makefile
Expand Up @@ -11,7 +11,7 @@ BUILDDIR = BareosMainReference

# Put it first so that "make" without argument is like "make help".
all:
./convert.sh
./convert_all_tex_files_to_rst.sh
@$(SPHINXBUILD) -M html "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
#@$(SPHINXBUILD) -M latexpdf "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

Expand Down
11 changes: 0 additions & 11 deletions docs/manuals/en/new_main_reference/convert.sh

This file was deleted.

20 changes: 20 additions & 0 deletions docs/manuals/en/new_main_reference/convert_all_tex_files_to_rst.sh
@@ -0,0 +1,20 @@
#!/bin/bash
set -x

ORIGIN_DIR="../main/"
TARGET_DIR="./source/"

for destfile in `cat destfiles.txt`;
do
file=`echo $destfile | sed 's#.*/##g'`
chapterdir=`echo $destfile | sed 's#/.*##g'`
filebase=`basename $destfile .tex`
mkdir -p ${TARGET_DIR}${chapterdir}

./pre_conversion_changes.sh ${ORIGIN_DIR}${file} ${TARGET_DIR}${destfile};

pandoc --verbose --columns=160 -f latex+raw_tex -t rst ${TARGET_DIR}${destfile} -o ${TARGET_DIR}${chapterdir}/${filebase}.rst || exit "could not convert file $file"

./post_conversion_changes.sh ${TARGET_DIR}${chapterdir}/${filebase}.rst

done
49 changes: 49 additions & 0 deletions docs/manuals/en/new_main_reference/destfiles.txt
@@ -0,0 +1,49 @@
chapter01/general.tex
chapter01/state.tex
chapter02/install.tex
chapter03/webui.tex
chapter04/update.tex
chapter05/quickstart.tex
chapter06/tutorial.tex
chapter07/critical.tex
chapter08/configure.tex
chapter09/dirdconf.tex
chapter10/storedconf.tex
chapter11/filedconf.tex
chapter12/messagesres.tex
chapter13/consoleconf.tex
chapter14/monitorconf.tex
chapter15/bconsole.tex
chapter16/restore.tex
chapter17/disk.tex
chapter17/recycling.tex
chapter18/pools.tex
chapter19/autochangers.tex
chapter20/tape-without-autochanger.tex
chapter21/spooling.tex
chapter22/migration.tex
chapter23/always-incremental.tex
chapter24/basejob.tex
chapter26/plugins.tex
chapter27/win32.tex
chapter28/client-initiated-connection.tex
chapter28/passiveclient.tex
chapter28/lanaddress.tex
chapter29/tls.tex
chapter30/dataencryption.tex
chapter31/ndmp.tex
chapter32/catmaintenance.tex
chapter33/security.tex
appendix-a/requirements.tex
appendix-b/supportedoses.tex
appendix-c/programs.tex
appendix-d/bootstrap.tex
appendix-e/verify.tex
appendix-f/backward-compatibility.tex
appendix-g/tables.tex
appendix-h/howto.tex
appendix-i/rescue.tex
appendix-j/troubleshooting.tex
appendix-k/debug.tex
appendix-l/releasenotes.tex
appendix-m/license.tex
275 changes: 275 additions & 0 deletions docs/manuals/en/new_main_reference/post_conversion_changes.sh
@@ -0,0 +1,275 @@
#!/bin/bash

DESTFILE=$1



# links
# perl -i.bak -pe 's#':raw-latex:`\\elink\{fork\}\{http://www.bareos.org/en/faq/items/why_fork.html\}`#`\1 \2>`_#g'




perl -i.bak -pe 's#:raw-latex:`\\label\{(.*)\}`#\n\n.. _`\1`: \1#g' ${DESTFILE}
#``URL:http://download.bareos.org/bareos/release/latest/``
perl -i.bak -pe 's#``URL:(.*)``#`\1 \1>`_#g' ${DESTFILE}
perl -i.bak -pe 's#``\\url\{(.*)\}#`\1 \1>`_#g' ${DESTFILE}


perl -i.bak -pe 's#``path:(.*)``#:file:`\1`#g' ${DESTFILE}


# abbreviations
perl -i.bak -pe 's#:raw-latex:`\\bareosDir(\s*)`#\|bareosDir\|\1#g' ${DESTFILE}
perl -i.bak -pe 's#:raw-latex:`\\bareosFd(\s*)`#\|bareosFd\|\1#g' ${DESTFILE}
perl -i.bak -pe 's#:raw-latex:`\\bareosSd(\s*)`#\|bareosSd\|\1#g' ${DESTFILE}
perl -i.bak -pe 's#:raw-latex:`\\bareosTrayMonitor(\s*)`#\|bareosTrayMonitor\|\1#g' ${DESTFILE}
perl -i.bak -pe 's#:raw-latex:`\\bareosWebui(\s*)`#\|bareosWebui\|\1#g' ${DESTFILE}
perl -i.bak -pe 's#:raw-latex:`\\mysql(\s*)`# \|mysql\|\1#g' ${DESTFILE}
perl -i.bak -pe 's#:raw-latex:`\\postgresql(\s*)`# \|postgresql\|\1#g' ${DESTFILE}
perl -i.bak -pe 's#:raw-latex:`\\sqlite(\s*)`#\|sqlite\|\1#g' ${DESTFILE}
perl -i.bak -pe 's#:raw-latex:`\\vmware(\s*)`#\|vmware\|\1#g' ${DESTFILE}
perl -i.bak -pe 's#:raw-latex:`\\vSphere(\s*)`#\|vsphere\|\1#g' ${DESTFILE}

# link targets
perl -i.bak -pe 's#:raw-latex:`\\ilink\{(.*?)\}\{(.*?)\}`#:ref:`\1 <\2>`#g' ${DESTFILE}
perl -i.bak -pe 's#:raw-latex:`\\nameref\{(.*?)\}`#:ref:`\1`#g' ${DESTFILE}
perl -i.bak -pe 's#\\nameref\{(.*?)\}#:ref:`\1`#g' ${DESTFILE}






perl -i.bak -pe 's#:raw-latex:`\\elink\{(.*)\}\{(.*)\}`(\s*)#`\1 <\2>`_\3#g' ${DESTFILE}
perl -i.bak -pe 's#\\elink\{(.*?)\}\{(.*?)\}(\s*)#`\1 <\2>`_\3#g' ${DESTFILE}





perl -i.bak -pe 's#\\bcommand\{(.*?)\}\{}#:strong:`\1`#g' ${DESTFILE}

perl -i.bak -pe 's#:raw-latex:`\\command\{(.*?)\}`#:program:`\1`#g' ${DESTFILE}

perl -i.bak -pe 's#:raw-latex:`\\configline\{(.*?)\}`#:strong:`\1`#g' ${DESTFILE}
perl -i.bak -pe 's#:raw-latex:`\\configdirective\{(.*?)\}`#:strong:`\1`#g' ${DESTFILE}



# abbreviations
perl -i.bak -pe 's#:raw-latex:`\\bareosDir\(\s*\)`#\|bareosDir\|\1#g' ${DESTFILE}
perl -i.bak -pe 's#:raw-latex:`\\bareosFd\(\s*\)`#\|bareosFd\|\1#g' ${DESTFILE}
perl -i.bak -pe 's#:raw-latex:`\\bareosSd\(\s*\)`#\|bareosSd\|\1#g' ${DESTFILE}
perl -i.bak -pe 's#:raw-latex:`\\bareosTrayMonitor\(\s*\)`#\|bareosTrayMonitor\|\1#g' ${DESTFILE}
perl -i.bak -pe 's#:raw-latex:`\\bareosWebui\(\s*\)`#\|bareosWebui\|\1#g' ${DESTFILE}
perl -i.bak -pe 's#:raw-latex:`\\mysql\(\s*\)`# \|mysql\|\1#g' ${DESTFILE}
perl -i.bak -pe 's#:raw-latex:`\\postgresql\(\s*\)`# \|postgresql\|\1#g' ${DESTFILE}
perl -i.bak -pe 's#:raw-latex:`\\sqlite\(\s*\)`#\|sqlite\|\1#g' ${DESTFILE}
perl -i.bak -pe 's#:raw-latex:`\\vmware\(\s*\)`#\|vmware\|\1#g' ${DESTFILE}
perl -i.bak -pe 's#:raw-latex:`\\vSphere\(\s*\)`#\|vsphere\|\1#g' ${DESTFILE}





# rename sec: to section- as : has special meaning in sphinx
perl -i.bak -pe 's#sec:#section-#g' ${DESTFILE}
perl -i.bak -pe 's#item:#item-#g' ${DESTFILE}


# \package
perl -i.bak -pe 's#:raw-latex:`\\package\{(.*)\}`#**\1**#g' ${DESTFILE}


# remove nonsense lines
perl -i.bak -pe 's# .. raw:: latex##g' ${DESTFILE}

# \parameter
perl -i -pe 's#:raw-latex:`\\parameter\{(.*?)\}`#:option:`\1`#g' < ${SOURCEFILE} > ${DESTFILE}
perl -i -pe 's#\\parameter\{(.*?)\}#:option:`\1`#g' < ${SOURCEFILE} > ${DESTFILE}



# sinceversion
# raw-latex:`\sinceVersion{dir}{requires!jansson}{15.2.0}`
perl -i.bak -pe 's|:raw-latex:`\\sinceVersion\{(.*)\}\{(.*)\}\{(.*)\}`|\3|g' ${DESTFILE}
#sed 's#:raw-latex:`\\sinceVersion\{(.*)\}\{(.*)\}\{(.*)\}`#\n\n.. versionadded:: \3\n \1 \2\n#g' ${DESTFILE}


# file
perl -i.bak -pe 's#:raw-latex:`\\file\{(.*)\}`#:file:`\1`#g' ${DESTFILE}

perl -i.bak -pe 's#:raw-latex:`\\directory\{(.*)\}`#:file:`\1`#g' ${DESTFILE}





#code blocks
# {commands}{get the process ID of a running Bareos daemon}
# command> /command>parameter>ps fax | grep bareos-dir/parameter>
# 2103 ? S 0:00 /usr/sbin/bareos-dir

#.. code-block:: c
# :caption: get the process ID of a running Bareos daemon





perl -i.bak -pe 's#\{commands\}\{(.*)\}#\n.. code-block:: sh\n :caption: \1\n#g' ${DESTFILE}
perl -i.bak -pe 's#\{logging\}\{(.*)\}#\n.. code-block:: sh\n :caption: \1\n#g' ${DESTFILE}
perl -i.bak -pe 's#\{config\}\{(.*)\}#\n.. code-block:: sh\n :caption: \1\n#g' ${DESTFILE}
perl -i.bak -pe 's#\{bconfig\}\{(.*)\}#\n.. code-block:: sh\n :caption: \1\n#g' ${DESTFILE}
perl -i.bak -pe 's#\{bareosConfigResource\}\{(.*)\}#\n.. code-block:: sh\n :caption: \1\n#g' ${DESTFILE}
perl -i.bak -pe 's#\{commandOut\}\{(.*)\}#\n.. code-block:: sh\n :caption: \1\n#g' ${DESTFILE}
perl -i.bak -pe 's#\{bconsole\}\{(.*)\}#\n.. code-block:: sh\n :caption: \1\n#g' ${DESTFILE}


#greater or equal sign
perl -i.bak -pe 's#\$\\ge\$#≥#g' ${DESTFILE}
perl -i.bak -pe 's#\$\\geq\$#≥#g' ${DESTFILE}
perl -i.bak -pe 's#\$\$##g' ${DESTFILE}
perl -i.bak -pe 's#\$=\$#≤#g' ${DESTFILE}

# \user
perl -i.bak -pe 's#:raw-latex:`\\user\{(.*)\}`#**\1**#g' ${DESTFILE}
perl -i.bak -pe 's#\\user\{(.*)\}#**\1**#g' ${DESTFILE}



# remove xml stuff





# resourcetype

perl -i.bak -pe 's#:raw-latex:`\\resourcetype\{(.*)\}\{(.*)\}`#:sup:`\1`\ :strong:`\2`#g' ${DESTFILE}

# \name


# \dbtable
perl -i.bak -pe 's#\\dbtable\{(.*)\}#**\1**#g' ${DESTFILE}

# resourcename

perl -i.bak -pe 's#:raw-latex:`\\resourcename\{(.*)\}\{(.*)\}\{(.*)\}`#**\3**:sup:`\1`:sub:`\2`\ #g' ${DESTFILE}





perl -i.bak -pe 's#:raw-latex:`\\job\{(.*)\}`#**\1**:sup:`Dir`:sub:`job`\ #g' ${DESTFILE}
perl -i.bak -pe 's#:raw-latex:`\\pool\{(.*)\}`#**\1**:sup:`Dir`:sub:`pool`\ #g' ${DESTFILE}







#\dt



#\os



# TODO: add link
perl -i.bak -pe 's#:raw-latex:`\\linkResourceDirective\{(.*)\}\{(.*)\}\{(.*)\}`#**\3**:sup:`\1`:sub:`\2`\ #g' ${DESTFILE}
perl -i.bak -pe 's#:raw-latex:`\\linkResourceDirective\*\{(.*)\}\{(.*)\}\{(.*)\}`#**\3**:sup:`\1`:sub:`\2`\ #g' ${DESTFILE}









# TODO: check if |xxxx| replace can be used
perl -i.bak -pe 's#\\configFileDirUnix#:file:`/etc/bareos/bareos-dir.conf`#g' ${DESTFILE}
perl -i.bak -pe 's#:raw-latex:`\\fileStoragePath`#:file:`/var/lib/bareos/storage/`#g' ${DESTFILE}
perl -i.bak -pe 's#:raw-latex:`\\scriptPathUnix`#:file:`/usr/lib/bareos/scripts/`#g' ${DESTFILE}
perl -i.bak -pe 's#:raw-latex:`\\configPathUnix`#:file:`/etc/bareos/`#g' ${DESTFILE}
perl -i.bak -pe 's#:raw-latex:`\\configFileDirUnix`#:file:`/etc/bareos/bareos-dir.conf`#g' ${DESTFILE}
perl -i.bak -pe 's#:raw-latex:`\\configFileSdUnix`#:file:`/etc/bareos/bareos-sd.conf`#g' ${DESTFILE}
perl -i.bak -pe 's#:raw-latex:`\\configFileFdUnix`#:file:`/etc/bareos/bareos-fd.conf`#g' ${DESTFILE}
perl -i.bak -pe 's#:raw-latex:`\\configFileBconsoleUnix`#:file:`/etc/bareos/bconsole.conf`#g' ${DESTFILE}
perl -i.bak -pe 's#:raw-latex:`\\configFileTrayMonitorUnix`#:file:`/etc/bareos/tray-monitor.conf`#g' ${DESTFILE}
perl -i.bak -pe 's#:raw-latex:`\\configFileBatUnix`#:file:`/etc/bareos/bat.conf`#g' ${DESTFILE}
perl -i.bak -pe 's#:raw-latex:`\\configDirectoryDirUnix`#:file:`/etc/bareos/bareos-dir.d/`#g' ${DESTFILE}
perl -i.bak -pe 's#:raw-latex:`\\configDirectorySdUnix`#:file:`/etc/bareos/bareos-sd.d/`#g' ${DESTFILE}
perl -i.bak -pe 's#:raw-latex:`\\configDirectoryFdUnix`#:file:`/etc/bareos/bareos-fd.d/`#g' ${DESTFILE}
perl -i.bak -pe 's#:raw-latex:`\\configDirectoryBconsoleUnix`#:file:`/etc/bareos/bconsole.d/`#g' ${DESTFILE}
perl -i.bak -pe 's#:raw-latex:`\\configDirectoryTrayMonitorUnix`#:file:`/etc/bareos/tray-monitor.d/`#g' ${DESTFILE}
perl -i.bak -pe 's#:raw-latex:`\\logfileUnix`#:file:`/var/log/bareos/bareos.log`#g' ${DESTFILE}
perl -i.bak -pe 's#:raw-latex:`\\yesno`#yes\\|no#g' ${DESTFILE}
perl -i.bak -pe 's#:raw-latex:`\\NdmpBareos`#NDMP_BAREOS#g' ${DESTFILE}



perl -i.bak -pe 's|:raw-latex:`\\fileset\{(.*)\}`|**\1**|g' ${DESTFILE}

# remove stuff that has no meaning anymore
perl -i.bak -pe 's#\\footnotesize##g' ${DESTFILE}
perl -i.bak -pe 's#\\normalsize##g' ${DESTFILE}
perl -i.bak -pe 's#\\hfill##g' ${DESTFILE}


perl -i.bak -pe 's#:math:`\ldots`#...#g' ${DESTFILE}


# warning




# warning



# clean empty :: at the start of line



#######
# index
#######

#:raw-latex:`\index[general]{Windows!File Daemon!Command Line Options}`
# ->
#:index:`triple: <Windows!File Daemon!Command Line Options>`
#perl -i.bak -pe 's#^(\s*):raw-latex:`\\index\[(.*?)\]\{(.*?)!(.*?)!(.*?)\}`#\1.. index::\n\1 triple: \3; \4; \5;\n\1#g' ${DESTFILE}
perl -i.bak -pe 's#(\s*):raw-latex:`\\index\[(.*?)\]\{(.*?)!(.*?)!(.*?)\}`#\1:index:`\5 <triple: \3;\4;\5>`#g' ${DESTFILE}



#:raw-latex:`\index[general]{Problem!Windows}`
# ->
#:index:`pair: Problem;Windows>`
#perl -i.bak -pe 's#^(\s*):raw-latex:`\\index\[(.*?)\]\{(.*?)!(.*?)\}`#\1.. index::\n\1 pair: \3; \4\n\1#g' ${DESTFILE}
perl -i.bak -pe 's#(\s*):raw-latex:`\\index\[(.*?)\]\{(.*?)!(.*?)\}`#\1:index:`\4 <pair: \3;\4>`#g' ${DESTFILE}


# index
#:raw-latex:`\index[general]{Version numbers}`
# ->
#:index:`Version numbers`
# perl -i.bak -pe 's#^(\s*):raw-latex:`\\index\[(.*?)\]\{(^[\!]*)\}`#\1.. index::\n\1 single: \3\n\1#g' ${DESTFILE}
perl -i.bak -pe 's#(\s*):raw-latex:`\\index\[(.*?)\]\{(.*?)\}`#\1:index:`\3 <single: \3>`#g' ${DESTFILE}







diff --color -ruN ${DESTFILE}.bak ${DESTFILE}

exit 0

0 comments on commit 6a974ce

Please sign in to comment.