mirror of
https://github.com/opencv/opencv.git
synced 2025-06-07 17:44:04 +08:00
moved the new docs from docroot to doc
This commit is contained in:
parent
d7592dd1b8
commit
7491596ef8
@ -3,133 +3,24 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
file(GLOB FILES_DOC *.htm *.txt *.jpg *.png *.pdf)
|
file(GLOB FILES_DOC *.htm *.txt *.jpg *.png *.pdf)
|
||||||
file(GLOB FILES_DOC_PAPERS papers/*.pdf papers/*.ps)
|
|
||||||
file(GLOB FILES_DOC_VS vidsurv/*.doc)
|
file(GLOB FILES_DOC_VS vidsurv/*.doc)
|
||||||
file(GLOB FILES_TEX *.tex *.sty *.bib go)
|
file(GLOB FILES_TEX *.tex *.sty *.bib)
|
||||||
file(GLOB FILES_TEX_PICS pics/*.png pics/*.jpg)
|
file(GLOB FILES_TEX_PICS pics/*.png pics/*.jpg)
|
||||||
file(GLOB_RECURSE FILES_PLASTEX plastex/*)
|
|
||||||
|
|
||||||
if(BUILD_LATEX_DOCS AND PDFLATEX_COMPILER)
|
if(BUILD_REFMAN AND PDFLATEX_COMPILER AND HAVE_SPHINX)
|
||||||
|
|
||||||
project(opencv_refman)
|
|
||||||
|
|
||||||
set(refman_copied_srcs)
|
add_subdirectory(opencv1)
|
||||||
|
add_subdirectory(opencv2)
|
||||||
|
|
||||||
#foreach(f ${refman_m4_srcs})
|
endif()
|
||||||
# get_filename_component(basef ${f} NAME_WE)
|
|
||||||
# set(outputf ${CMAKE_CURRENT_BINARY_DIR}/${basef}-c.tex)
|
|
||||||
# add_custom_command(
|
|
||||||
# OUTPUT ${outputf}
|
|
||||||
# DEPENDS ${f}
|
|
||||||
# COMMAND m4
|
|
||||||
# ARGS -DTARGET_LANGUAGE=c ${f} > ${outputf}
|
|
||||||
# WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
# VERBATIM
|
|
||||||
# )
|
|
||||||
# list(APPEND refman_copied_srcs ${outputf})
|
|
||||||
#endforeach()
|
|
||||||
|
|
||||||
foreach(f ${FILES_TEX})
|
|
||||||
get_filename_component(basef ${f} NAME)
|
|
||||||
set(outputf ${CMAKE_CURRENT_BINARY_DIR}/${basef})
|
|
||||||
add_custom_command(
|
|
||||||
OUTPUT ${outputf}
|
|
||||||
DEPENDS ${f}
|
|
||||||
COMMAND ${CMAKE_COMMAND}
|
|
||||||
ARGS -E copy ${f} ${outputf}
|
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
|
||||||
list(APPEND refman_copied_srcs ${outputf})
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
set(pdflatex_args -interaction=batchmode
|
|
||||||
"\"\\newcommand{\\genc}{true}\\newcommand{\\genpy}{true}\\newcommand{\\targetlang}{c}\\input{opencv.tex}\"")
|
|
||||||
|
|
||||||
add_custom_command(
|
|
||||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/opencv.aux
|
|
||||||
DEPENDS ${refman_copied_srcs}
|
|
||||||
COMMAND ${PDFLATEX_COMPILER}
|
|
||||||
ARGS ${pdflatex_args}
|
|
||||||
COMMENT "Latex (first pass)"
|
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
|
||||||
)
|
|
||||||
|
|
||||||
add_custom_command(
|
|
||||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/opencv.bbl
|
|
||||||
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/opencv.aux
|
|
||||||
COMMAND ${BIBTEX_COMPILER}
|
|
||||||
ARGS ${CMAKE_CURRENT_BINARY_DIR}/opencv
|
|
||||||
COMMENT "Bibtex"
|
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
|
||||||
)
|
|
||||||
|
|
||||||
add_custom_command(
|
|
||||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/opencv.pdf
|
|
||||||
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/opencv.bbl
|
|
||||||
COMMAND ${PDFLATEX_COMPILER}
|
|
||||||
ARGS ${pdflatex_args}
|
|
||||||
COMMENT "Latex (second pass)"
|
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
|
||||||
)
|
|
||||||
|
|
||||||
add_custom_command(
|
|
||||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/opencv.log
|
|
||||||
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/opencv.bbl
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/opencv.pdf
|
|
||||||
COMMAND ${PDFLATEX_COMPILER}
|
|
||||||
ARGS ${pdflatex_args}
|
|
||||||
COMMENT "Latex (third pass)"
|
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
|
||||||
)
|
|
||||||
|
|
||||||
set(PICS_OUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/pics")
|
|
||||||
message(STATUS "Copying pictures to the build directory")
|
|
||||||
make_directory(${PICS_OUT_DIR})
|
|
||||||
|
|
||||||
file(GLOB pics RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/pics" pics/*.jpg pics/*.png)
|
|
||||||
|
|
||||||
foreach(p ${pics})
|
|
||||||
configure_file(
|
|
||||||
"pics/${p}"
|
|
||||||
"${PICS_OUT_DIR}/${p}"
|
|
||||||
COPYONLY)
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
set(PYTHON_OUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/python_fragments")
|
|
||||||
message(STATUS "Copying python_fragments to the build directory")
|
|
||||||
make_directory(${PYTHON_OUT_DIR})
|
|
||||||
|
|
||||||
file(GLOB python_fragments RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/python_fragments" python_fragments/*.py)
|
|
||||||
|
|
||||||
foreach(p ${python_fragments})
|
|
||||||
configure_file(
|
|
||||||
"python_fragments/${p}"
|
|
||||||
"${PYTHON_OUT_DIR}/${p}"
|
|
||||||
COPYONLY)
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
#add_custom_target(MakePicsLink
|
|
||||||
# COMMAND ln -sf ${CMAKE_CURRENT_SOURCE_DIR}/pics ${CMAKE_CURRENT_BINARY_DIR}/pics
|
|
||||||
# )
|
|
||||||
|
|
||||||
# Eventually trigger the whole process
|
|
||||||
add_custom_target(ReferenceManual ALL echo
|
|
||||||
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/opencv.log
|
|
||||||
)
|
|
||||||
|
|
||||||
#add_dependencies(ReferenceManual MakePicsLink)
|
|
||||||
|
|
||||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/opencv.pdf"
|
|
||||||
DESTINATION "${OPENCV_DOC_INSTALL_PATH}" COMPONENT main)
|
|
||||||
|
|
||||||
endif() # BUILD_LATEX_DOCS AND PDFLATEX_COMPILER
|
|
||||||
|
|
||||||
install(FILES ${FILES_DOC} DESTINATION "${OPENCV_DOC_INSTALL_PATH}" COMPONENT main)
|
install(FILES ${FILES_DOC} DESTINATION "${OPENCV_DOC_INSTALL_PATH}" COMPONENT main)
|
||||||
install(FILES ${FILES_DOC_PAPERS} DESTINATION "${OPENCV_DOC_INSTALL_PATH}/papers" COMPONENT main)
|
|
||||||
install(FILES ${FILES_DOC_VS} DESTINATION "${OPENCV_DOC_INSTALL_PATH}/vidsurv" COMPONENT main)
|
install(FILES ${FILES_DOC_VS} DESTINATION "${OPENCV_DOC_INSTALL_PATH}/vidsurv" COMPONENT main)
|
||||||
|
|
||||||
########################################### Doxygen Docs #########################################
|
########################################### Doxygen Docs #########################################
|
||||||
|
|
||||||
if(BUILD_DOXYGEN_DOCS AND DOXYGEN_FOUND)
|
if(0)
|
||||||
|
#if(BUILD_DOXYGEN_DOCS AND DOXYGEN_FOUND)
|
||||||
|
|
||||||
set(DOXYGEN_LANGUAGE "English" CACHE STRING "Language used by doxygen")
|
set(DOXYGEN_LANGUAGE "English" CACHE STRING "Language used by doxygen")
|
||||||
mark_as_advanced(DOXYGEN_LANGUAGE)
|
mark_as_advanced(DOXYGEN_LANGUAGE)
|
||||||
@ -160,4 +51,3 @@ exec_program(mkdir ARGS "-p \"${CMAKE_CURRENT_BINARY_DIR}/html/\"")
|
|||||||
install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/html" DESTINATION "${OPENCV_DOC_INSTALL_PATH}/html" COMPONENT main)
|
install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/html" DESTINATION "${OPENCV_DOC_INSTALL_PATH}/html" COMPONENT main)
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
290
doc/_themes/blue/static/default.css_t
vendored
Normal file
290
doc/_themes/blue/static/default.css_t
vendored
Normal file
@ -0,0 +1,290 @@
|
|||||||
|
/**
|
||||||
|
* Sphinx stylesheet -- default theme
|
||||||
|
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
*/
|
||||||
|
|
||||||
|
@import url("basic.css");
|
||||||
|
|
||||||
|
/* -- page layout ----------------------------------------------------------- */
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-family: {{ theme_bodyfont }};
|
||||||
|
font-size: 100%;
|
||||||
|
background-color: {{ theme_footerbgcolor }};
|
||||||
|
color: #000;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.document {
|
||||||
|
background-color: {{ theme_sidebarbgcolor }};
|
||||||
|
}
|
||||||
|
|
||||||
|
div.documentwrapper {
|
||||||
|
float: left;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.bodywrapper {
|
||||||
|
margin: 0 0 0 230px;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.body {
|
||||||
|
background-color: {{ theme_bgcolor }};
|
||||||
|
color: {{ theme_textcolor }};
|
||||||
|
padding: 0 20px 30px 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.feedback {
|
||||||
|
background-color: {{ theme_feedbackbgcolor }};
|
||||||
|
color: {{ theme_feedbacktextcolor }};
|
||||||
|
padding: 20px 20px 30px 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.feedback h2 {
|
||||||
|
margin: 10px 0 10px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.feedback a {
|
||||||
|
color: {{ theme_feedbacklinkcolor }};
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
{%- if theme_rightsidebar|tobool %}
|
||||||
|
div.bodywrapper {
|
||||||
|
margin: 0 230px 0 0;
|
||||||
|
}
|
||||||
|
{%- endif %}
|
||||||
|
|
||||||
|
div.footer {
|
||||||
|
color: {{ theme_footertextcolor }};
|
||||||
|
width: 100%;
|
||||||
|
padding: 9px 0 9px 0;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 75%;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.footer a {
|
||||||
|
color: {{ theme_footertextcolor }};
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.related {
|
||||||
|
background-color: {{ theme_relbarbgcolor }};
|
||||||
|
line-height: 30px;
|
||||||
|
color: {{ theme_relbartextcolor }};
|
||||||
|
}
|
||||||
|
|
||||||
|
div.related a {
|
||||||
|
color: {{ theme_relbarlinkcolor }};
|
||||||
|
}
|
||||||
|
|
||||||
|
div.sphinxsidebar {
|
||||||
|
{%- if theme_stickysidebar|tobool %}
|
||||||
|
top: 30px;
|
||||||
|
margin: 0;
|
||||||
|
position: fixed;
|
||||||
|
overflow: auto;
|
||||||
|
height: 100%;
|
||||||
|
{%- endif %}
|
||||||
|
{%- if theme_rightsidebar|tobool %}
|
||||||
|
float: right;
|
||||||
|
{%- if theme_stickysidebar|tobool %}
|
||||||
|
right: 0;
|
||||||
|
{%- endif %}
|
||||||
|
{%- endif %}
|
||||||
|
}
|
||||||
|
|
||||||
|
{%- if theme_stickysidebar|tobool %}
|
||||||
|
/* this is nice, but it it leads to hidden headings when jumping
|
||||||
|
to an anchor */
|
||||||
|
/*
|
||||||
|
div.related {
|
||||||
|
position: fixed;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.documentwrapper {
|
||||||
|
margin-top: 30px;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
{%- endif %}
|
||||||
|
|
||||||
|
div.sphinxsidebar h3 {
|
||||||
|
font-family: {{ theme_headfont }};
|
||||||
|
color: {{ theme_sidebartextcolor }};
|
||||||
|
font-size: 1.4em;
|
||||||
|
font-weight: normal;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.sphinxsidebar h3 a {
|
||||||
|
color: {{ theme_sidebartextcolor }};
|
||||||
|
}
|
||||||
|
|
||||||
|
div.sphinxsidebar h4 {
|
||||||
|
font-family: {{ theme_headfont }};
|
||||||
|
color: {{ theme_sidebartextcolor }};
|
||||||
|
font-size: 1.3em;
|
||||||
|
font-weight: normal;
|
||||||
|
margin: 5px 0 0 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.sphinxsidebar p {
|
||||||
|
color: {{ theme_sidebartextcolor }};
|
||||||
|
}
|
||||||
|
|
||||||
|
div.sphinxsidebar p.topless {
|
||||||
|
margin: 5px 10px 10px 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.sphinxsidebar ul {
|
||||||
|
margin: 10px;
|
||||||
|
padding: 0;
|
||||||
|
color: {{ theme_sidebartextcolor }};
|
||||||
|
}
|
||||||
|
|
||||||
|
div.sphinxsidebar a {
|
||||||
|
color: {{ theme_sidebarlinkcolor }};
|
||||||
|
}
|
||||||
|
|
||||||
|
div.sphinxsidebar input {
|
||||||
|
border: 1px solid {{ theme_sidebarlinkcolor }};
|
||||||
|
font-family: sans-serif;
|
||||||
|
font-size: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -- body styles ----------------------------------------------------------- */
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: {{ theme_linkcolor }};
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.body p, div.body dd, div.body li {
|
||||||
|
text-align: justify;
|
||||||
|
line-height: 130%;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.body h1,
|
||||||
|
div.body h2,
|
||||||
|
div.body h3,
|
||||||
|
div.body h4,
|
||||||
|
div.body h5,
|
||||||
|
div.body h6 {
|
||||||
|
font-family: {{ theme_headfont }};
|
||||||
|
background-color: {{ theme_headbgcolor }};
|
||||||
|
font-weight: normal;
|
||||||
|
color: {{ theme_headtextcolor }};
|
||||||
|
border-bottom: 1px solid #ccc;
|
||||||
|
margin: 20px -20px 10px -20px;
|
||||||
|
padding: 3px 0 3px 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
a.toc-backref, a.toc-backref:hover {
|
||||||
|
font-family: {{ theme_headfont }};
|
||||||
|
background-color: {{ theme_headbgcolor }};
|
||||||
|
font-weight: normal;
|
||||||
|
color: {{ theme_headtextcolor }};
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.body h1 { margin-top: 0; font-size: 200%; }
|
||||||
|
div.body h2 { font-size: 160%; }
|
||||||
|
div.body h3 { font-size: 140%; }
|
||||||
|
div.body h4 { font-size: 120%; }
|
||||||
|
div.body h5 { font-size: 110%; }
|
||||||
|
div.body h6 { font-size: 100%; }
|
||||||
|
|
||||||
|
a.headerlink {
|
||||||
|
color: {{ theme_headlinkcolor }};
|
||||||
|
font-size: 0.8em;
|
||||||
|
padding: 0 4px 0 4px;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
a.headerlink:hover {
|
||||||
|
background-color: {{ theme_headlinkcolor }};
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
div.body p, div.body dd, div.body li {
|
||||||
|
text-align: justify;
|
||||||
|
line-height: 130%;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.admonition p.admonition-title + p {
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.note {
|
||||||
|
background-color: #eee;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.seealso {
|
||||||
|
background-color: #ffc;
|
||||||
|
border: 1px solid #ff6;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.topic {
|
||||||
|
background-color: #eee;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.warning {
|
||||||
|
background-color: #ffe4e4;
|
||||||
|
border: 1px solid #f66;
|
||||||
|
}
|
||||||
|
|
||||||
|
p.admonition-title {
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
|
||||||
|
p.admonition-title:after {
|
||||||
|
content: ":";
|
||||||
|
}
|
||||||
|
|
||||||
|
pre {
|
||||||
|
padding: 5px;
|
||||||
|
background-color: {{ theme_codebgcolor }};
|
||||||
|
color: {{ theme_codetextcolor }};
|
||||||
|
line-height: 120%;
|
||||||
|
border: 1px solid #ace;
|
||||||
|
border-left: none;
|
||||||
|
border-right: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
tt {
|
||||||
|
color: {{ theme_headtext_color }}
|
||||||
|
background-color: #ecf0f3;
|
||||||
|
padding: 0 1px 0 1px;
|
||||||
|
font-size: 1.2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
tt.descname {
|
||||||
|
color: {{ theme_headtext_color }}
|
||||||
|
background-color: #ecf0f3;
|
||||||
|
padding: 0 1px 0 1px;
|
||||||
|
font-size: 1.6em;
|
||||||
|
}
|
||||||
|
|
||||||
|
dl.cfunction {
|
||||||
|
padding-bottom: 9px;
|
||||||
|
}
|
||||||
|
|
||||||
|
dl.cfunction > dt:first-child {
|
||||||
|
margin-bottom: 7px;
|
||||||
|
border-bottom: 1px dotted black;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.math p {
|
||||||
|
margin-top: 10px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
42
doc/mymath.sty
Normal file
42
doc/mymath.sty
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
\ProvidesPackage{mymath}
|
||||||
|
|
||||||
|
\newcommand{\matTT}[9]{
|
||||||
|
\[
|
||||||
|
\left|\begin{array}{ccc}
|
||||||
|
#1 & #2 & #3\\
|
||||||
|
#4 & #5 & #6\\
|
||||||
|
#7 & #8 & #9
|
||||||
|
\end{array}\right|
|
||||||
|
\]
|
||||||
|
}
|
||||||
|
|
||||||
|
\newcommand{\fork}[4]{
|
||||||
|
\left\{
|
||||||
|
\begin{array}{l l}
|
||||||
|
#1 & \mbox{#2}\\
|
||||||
|
#3 & \mbox{#4}\\
|
||||||
|
\end{array} \right.}
|
||||||
|
\newcommand{\forkthree}[6]{
|
||||||
|
\left\{
|
||||||
|
\begin{array}{l l}
|
||||||
|
#1 & \mbox{#2}\\
|
||||||
|
#3 & \mbox{#4}\\
|
||||||
|
#5 & \mbox{#6}\\
|
||||||
|
\end{array} \right.}
|
||||||
|
|
||||||
|
\newcommand{\vecthree}[3]{
|
||||||
|
\begin{bmatrix}
|
||||||
|
#1\\
|
||||||
|
#2\\
|
||||||
|
#3
|
||||||
|
\end{bmatrix}
|
||||||
|
}
|
||||||
|
|
||||||
|
\newcommand{\vecthreethree}[9]{
|
||||||
|
\begin{bmatrix}
|
||||||
|
#1 & #2 & #3\\
|
||||||
|
#4 & #5 & #6\\
|
||||||
|
#7 & #8 & #9
|
||||||
|
\end{bmatrix}
|
||||||
|
}
|
||||||
|
|
42
doc/reformat.py
Normal file
42
doc/reformat.py
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
import os, sys, re
|
||||||
|
|
||||||
|
finput=open(sys.argv[1], "rt")
|
||||||
|
|
||||||
|
# read the whole file content to s
|
||||||
|
s = "".join(finput.readlines())
|
||||||
|
finput.close()
|
||||||
|
|
||||||
|
# normalize line endings
|
||||||
|
s = re.sub(r"\r\n", "\n", s)
|
||||||
|
|
||||||
|
# remove trailing whitespaces
|
||||||
|
s = re.sub(r"[ \t]+\n", "\n", s)
|
||||||
|
|
||||||
|
# compress multiple empty lines
|
||||||
|
for i in range(5):
|
||||||
|
s = re.sub(r"\n\n\n", "\n\n", s)
|
||||||
|
|
||||||
|
# remove empty line before ".." that terminates a code block
|
||||||
|
s = re.sub(r"\n\n\.\.\n", "\n..\n", s)
|
||||||
|
|
||||||
|
# move :: starting a code block to the end of previous line
|
||||||
|
s = re.sub(r"\n\n::\n", " ::\n", s)
|
||||||
|
|
||||||
|
# remove extra line breaks before/after _ or ,
|
||||||
|
s = re.sub(r"\n[ \t]*([_,])\n", r"\1", s)
|
||||||
|
|
||||||
|
# remove extra line breaks after `
|
||||||
|
s = re.sub(r"`\n", "` ", s)
|
||||||
|
|
||||||
|
# remove extra line breaks before `
|
||||||
|
s = re.sub(r"\n[ \t]*`", " `", s)
|
||||||
|
|
||||||
|
# remove links to wiki
|
||||||
|
s = re.sub(r"\n[ \t]*`id=\d[^`]+`__\n", "", s)
|
||||||
|
|
||||||
|
# remove trailing whitespaces one more time
|
||||||
|
s = re.sub(r"[ \t]+\n", "\n", s)
|
||||||
|
|
||||||
|
foutput=open(sys.argv[2], "wt")
|
||||||
|
foutput.write(s)
|
||||||
|
foutput.close()
|
Loading…
Reference in New Issue
Block a user