Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' of github.com:yjacolin/QGIS-Documentation

  • Loading branch information...
commit dc0f7df2503cdbe559aced3cd18c78d41dae163d 2 parents b480916 + edfbf5b
@yjacolin authored
Showing with 97 additions and 23 deletions.
  1. +2 −0  .gitignore
  2. +41 −23 latex2rst.py
  3. +54 −0 readme.rst
View
2  .gitignore
@@ -4,3 +4,5 @@ Thumb.db
desktop.ini
*.*~
*~
+build
+
View
64 latex2rst.py
@@ -20,6 +20,7 @@
import re
from optparse import OptionParser
+supplement = {"footnote": [], }
def repl1(obj):
eq = obj.group(1)
eq = eq.replace("\n", " ")
@@ -31,7 +32,8 @@ def item(obj):
return l
def footnote(obj):
note = obj.group(1)
- supplement["footnote"] += [note]
+ note.replace('\n', ' ')
+ supplement["footnote"] += ['.. [#] ' + note]
return '[#]_'
def enum(obj):
en = obj.group(1)
@@ -84,9 +86,22 @@ def main():
simple_substitutions = [
# general substitutions:
{
- r"\\textit{(.*)}": r"*\1*",
- r"\\textbf{(.*)}": r"**\1**",
- r"\\texttt{(.*)}": r"``\1``",
+ r" +\n": r"\n",
+ },
+ {
+ r"([a-zA-Z0-9,;:\)])\n([a-zA-Z0-9\*])": r"\1 \2",
+ },
+ {
+ r"\\textit{(.*?)}": r"*\1*",
+ r"\\textbf{(.*?)}": r"**\1**",
+ r"\\texttt{(.*?)}": r"``\1``",
+ r"\\url{(.*?)}": r"\1",
+ r"\A%": r".. ",
+ r"\n%": r"\n.. ",
+ r"(\\label{.*?):(.*?})": r"\1_\2",
+ },
+ {
+ r"\\label{(.*?)}": r"`\1`:",
},
# custom substitutions (you might add your own here):
@@ -95,23 +110,25 @@ def main():
r"\\def\\ee\{.*\}": r"",
},
{
- r"(?<!\\def)\\be(?=[^\w])": r"\\begin{equation}",
- r"(?<!\\def)\\ee(?=[^\w])": r"\\end{equation}",
- r"(?<!\\def)\\ba(?=[^\w])": r"\\begin{array}",
- r"(?<!\\def)\\ea(?=[^\w])": r"\\end{array}",
- r"(?ms)\\left\((\\mat{.+?})\\right\)": r"\1",
- r"\(\\ref{(.+?)}\)": r":eq:`\1`",
+ #r"(?<!\\def)\\be(?=[^\w])": r"\\begin{equation}",
+ #r"(?<!\\def)\\ee(?=[^\w])": r"\\end{equation}",
+ #r"(?<!\\def)\\ba(?=[^\w])": r"\\begin{array}",
+ #r"(?<!\\def)\\ea(?=[^\w])": r"\\end{array}",
+ #r"(?ms)\\left\((\\mat{.+?})\\right\)": r"\1",
+ #r"\(\\ref{(.+?)}\)": r":eq:`\1`",
r"\\qg":r"|qg|",
- r"\\nix{(.*)}":r"|nix| \1",
- r"\\win{(.*)}":r"|win| \1",
- r"\\osx{(.*)}":r"|osx| \1",
- r"(\\cite)":r"FIXME\1",
- r"\\index{(.*)}":r":index:`\1`",
+ r"\\nix{(.*?)}":r"|nix| \1",
+ r"\\win{(.*?)}":r"|win| \1",
+ r"\\osx{(.*?)}":r"|osx| \1",
+ r"(\\cite{(.*?)})":r"[\2]_",
+ r"\\index{(.*?)}":r":index:`\1`",
+ r"\\keyboard{(.*?)}":r":kbd:`\1`",
+ r"\\dialog{(.*?)}":r":guilabel:`\1`",
+ r"\\toolbtntwo{(.*?)}{(.*?)}":r"|\1| :guilabel:`\2`",
},
]
filename = args[0]
s = open(filename).read()
- supplement = {"footnote": [], }
# apply the simple substitutions
for stage in simple_substitutions:
for pattern in stage:
@@ -130,16 +147,17 @@ def main():
s = re.sub(r"(\\end{itemize})", "\n", s)
s = re.sub(r"(\\begin{enumerate})", "\n", s)
s = re.sub(r"(\\end{enumerate})", "\n", s)
- s = re.sub(r"\\footnote{(.*)}", footnote, s)
+ s = re.sub(r"(?ms)\\footnote{(.*?)}", footnote, s)
+ s = re.sub(r"(?ms)\\begin{verbatim}(.+?)\\end{verbatim}", verbatim, s)
# convert titles:
- s = re.sub(r"\\chapter{(.+)}", repl_chapter, s)
- s = re.sub(r"\\section\*?{(.+)}", repl_section, s)
- s = re.sub(r"\\subsection\*?{(.+)}", repl_subsection, s)
- s = re.sub(r"\\subsubsection\*?{(.+)}", repl_subsubsection, s)
- s = re.sub(r"\\minisec\*?{(.+)}", repl_minisec, s)
+ s = re.sub(r"\\chapter{(.+?)}", repl_chapter, s)
+ s = re.sub(r"\\section\*?{(.+?)}", repl_section, s)
+ s = re.sub(r"\\subsection\*?{(.+?)}", repl_subsection, s)
+ s = re.sub(r"\\subsubsection\*?{(.+?)}", repl_subsubsection, s)
+ s = re.sub(r"\\minisec\*?{(.+?)}", repl_minisec, s)
# add supplement:
- s += '\n\n'.join(['\n'.join(supplement[i]) for i in supplement.keys()])
+ s += '\n\n'.join(['\n '.join(supplement[i]) for i in supplement.keys()])
# either save to a file or dump to stdout:
if options.save:
outfile = os.path.splitext(filename)[0] + ".rst"
View
54 readme.rst
@@ -0,0 +1,54 @@
+Installation
+================================================================================
+
+Very basic steps
+--------------------------------------------------------------------------------
+
+* git clone the project
+* add the linfiniti-sphinx-theme git repostiory as a submodule
+* build the documentation
+
+Installation
+--------------------------------------------------------------------------------
+
+Git clone this project.
+
+Create a git submodule support to include the linfiniti-sphinx-theme in your
+git project::
+
+ git submodule add git@github.com:timlinux/linfiniti-sphinx-theme.git \
+ linfiniti-sphinx-theme
+ git submodule
+ git submodule init linfiniti-sphinx-theme
+ git submodule update linfiniti-sphinx-theme
+ git status
+ git commit -m "Import linfiniti-sphinx-theme as a git submodule" -a
+ git push
+ make html
+
+The above being a typical workflow to incorporate the theme as a submodule in
+your project.
+
+.. note:: The theme is frozen at the particular version that was current when
+ you perform the git submodule update command.
+
+If you wish to obtain updates to the theme submodule, the procedure is
+something like this::
+
+ cd <your sphinx project>/linfiniti-sphinx-theme
+ git pull
+ cd ..
+
+Then commit the fact that the submodule now tracks a different SHA1::
+
+ git commit -am "Updates linfiniti theme to latest version"
+
+Build the documentation
+--------------------------------------------------------------------------------
+
+You can build the html in the following way::
+
+ build html
+
+(TODO)
+
Please sign in to comment.
Something went wrong with that request. Please try again.