Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: improve LaTex to Sphinx conversion
Add special post pandoc conversion script "latex-scan.py", that cope better with LaTex contexts then the perl regexes. The script "post_conversion_changes.sh" is no longer called. index are now inline markups, instead of extra blocks. This matches the current use of index better. However, this required a text, that will be displayed and indexed. We therefore write the index as [TAG={0}->{1}->{2}]. This can be manually replaced later. The conversion of tables do not work in a lot of cases and therefore the converted tables are not shown at all. We cope with this by doubling the tables: 1: original LaTex table as a raw block, 2: table converted to Sphinx/rst. Probaly not shown or shown with errors. Also done a lot of smaller fixes.
- Loading branch information
1 parent
f3e9084
commit f25ff26
Showing
8 changed files
with
1,224 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 29 additions & 7 deletions
36
docs/manuals/en/new_main_reference/convert_all_tex_files_to_rst.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,47 @@ | ||
#!/bin/bash | ||
set -x | ||
|
||
#set -x | ||
|
||
ORIGIN_DIR="../main/" | ||
WORK_DIR="./build/" | ||
TARGET_DIR="./source/" | ||
|
||
for destfile in `cat destfiles.txt | grep -v ^#`; | ||
do | ||
PHASE=${1:-ALL} | ||
FILES=${2:-$(cat destfiles.txt | grep -v ^#)} | ||
|
||
for destfile in $FILES; do | ||
file=`echo $destfile | sed 's#.*/##g'` | ||
chapterdir=`echo $destfile | sed 's#/.*##g'` | ||
filebase=`basename $destfile .tex` | ||
|
||
mkdir -p ${WORK_DIR}${chapterdir} | ||
mkdir -p ${TARGET_DIR}${chapterdir} | ||
|
||
if [ "${chapterdir}" != "developers" ]; then | ||
|
||
./pre_conversion_changes.sh ${ORIGIN_DIR}${file} ${TARGET_DIR}${destfile}; | ||
if [ $PHASE == "ALL" ] || [ $PHASE == "prepandoc" ]; then | ||
printf "%-50s (%s)\n" "$destfile" "prepandoc" | ||
./pre_conversion_changes.sh ${ORIGIN_DIR}${file} ${WORK_DIR}${destfile} | ||
fi | ||
|
||
pandoc --verbose --columns=500 -f latex+raw_tex -t rst ${TARGET_DIR}${destfile} -o ${TARGET_DIR}${chapterdir}/${filebase}.rst || exit "could not convert file $file" | ||
if [ $PHASE == "ALL" ] || [ $PHASE == "pandoc" ]; then | ||
printf "%-50s (%s)\n" "$destfile" "pandoc" | ||
pandoc --verbose --columns=500 -f latex+raw_tex -t rst ${WORK_DIR}${destfile} -o ${WORK_DIR}${chapterdir}/${filebase}.rst || exit "could not convert file ${WORK_DIR}${destfile}" | ||
#pandoc --verbose --columns=500 -f latex+raw_tex -t rst --filter latex-scan.py ${TARGET_DIR}${destfile} -o ${TARGET_DIR}${chapterdir}/${filebase}.rst || exit "could not convert file $file" | ||
fi | ||
|
||
./post_conversion_changes.sh ${TARGET_DIR}${chapterdir}/${filebase}.rst | ||
if [ $PHASE == "ALL" ] || [ $PHASE == "postpandoc" ]; then | ||
printf "%-50s (%s)\n" "$destfile" "postpandoc" | ||
# ./post_conversion_changes.sh ${TARGET_DIR}${chapterdir}/${filebase}.rst | ||
printf "%s\n" ".. ATTENTION do not edit this file manually." > ${TARGET_DIR}${chapterdir}/${filebase}.rst | ||
printf "%s\n\n" " It was automatically converted from the corresponding .tex file" >> ${TARGET_DIR}${chapterdir}/${filebase}.rst | ||
cat ${WORK_DIR}${chapterdir}/${filebase}.rst | ./latex-scan.py --standalone >> ${TARGET_DIR}${chapterdir}/${filebase}.rst 2>${WORK_DIR}${chapterdir}/${filebase}.latex-scan.log || exit "failed to post convert ${WORK_DIR}${chapterdir}/${filebase}.rst" | ||
fi | ||
else | ||
# developers files are only copied over | ||
echo "not doing: cp ../developers/source/${file} ${TARGET_DIR}${chapterdir}" | ||
if [ $PHASE == "ALL" ]; then | ||
#cp ../developers/source/${file} ${TARGET_DIR}${chapterdir} | ||
echo "not doing: cp ../developers/source/${file} ${TARGET_DIR}${chapterdir}" | ||
fi | ||
fi | ||
done |
Oops, something went wrong.