Changeset a316b1f in rtems-docs


Ignore:
Timestamp:
01/20/16 01:37:04 (7 years ago)
Author:
Amar Takhar <amar@…>
Branches:
4.11, 5, am, master
Children:
7c1f215
Parents:
89f2347
git-author:
Amar Takhar <amar@…> (01/20/16 01:37:04)
git-committer:
Amar Takhar <verm@…> (05/03/16 00:51:25)
Message:

Add support for singlehtml (inlined) HTML file, plus some other fixes.

  • This is still broken.
  • Rename sphinx_rtd_theme so it doesn't pickup locally installed ones
  • Add a hack to theme.css to get around inliner bug.
  • Some unrelated fixups in common/waf.py

Unfortunatly several dozen fixes got merged into this.

Files:
1 added
1 deleted
4 edited
25 moved

Legend:

Unmodified
Added
Removed
  • common/conf.py

    r89f2347 ra316b1f  
    8181# a list of builtin themes.
    8282
    83 import sphinx_rtd_theme
    84 html_theme = "sphinx_rtd_theme"
    85 html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
     83import sphinx_rtd_theme_rtems
     84html_theme = "sphinx_rtd_theme_rtems"
     85html_theme_path = [sphinx_rtd_theme_rtems.get_html_theme_path()]
    8686
    8787# Theme options are theme-specific and customize the look and feel of a theme
     
    170170# Grouping the document tree into LaTeX files. List of tuples
    171171# (source start file, target name, title, author, documentclass [howto/manual]).
    172 latex_documents = [
    173         ('index', '@FILE_DOC@.tex', u'RTEMS @DOC@ Documentation', u'RTEMS Documentation Project', 'manual'),
    174 ]
     172latex_documents = [] # must be overridden in local conf.py
    175173
    176174# Additional stuff for LaTeX
     175#    'fontpkg':      r'\usepackage{mathpazo}',
    177176latex_elements = {
    178     'fontpkg':      r'\usepackage{mathpazo}',
    179177    'papersize':    'a4paper',
    180178    'pointsize':    '12pt',
    181179    'preamble':     r'''
    182180\usepackage{rtemsstyle}
    183 
    184 % i hate you latex, here too
    185 \DeclareUnicodeCharacter{2603}{\\N\{SNOWMAN\}}
    186181'''
    187182}
    188183
    189 latex_use_parts = True
    190184
    191185latex_additional_files = ['../common/rtemsstyle.sty', '../common/logo.pdf']
    192 
    193186latex_use_modindex = False
    194 
    195 
    196187
    197188
     
    202193# For "manual" documents, if this is true, then toplevel headings are parts,
    203194# not chapters.
    204 #latex_use_parts = False
     195latex_use_parts = True
    205196
    206197# If true, show page references after internal links.
    207 #latex_show_pagerefs = False
     198latex_show_pagerefs = True
    208199
    209200# If true, show URL addresses after external links.
    210 #latex_show_urls = False
     201latex_show_urls=True
    211202
    212203# Documents to append as an appendix to all manuals.
     
    217208
    218209
    219 # -- Options for manual page output --------------------------------------------
    220 
    221 # One entry per manual page. List of tuples
    222 # (source start file, name, description, authors, manual section).
    223 man_pages = [
    224         ('index', '@FILE_DOC@', u'RTEMS @DOC@ Documentation', [u'RTEMS Documentation Project'], 1)
    225 ]
    226 
    227 # If true, show URL addresses after external links.
    228 #man_show_urls = False
    229 
    230 
    231 # -- Options for Texinfo output ------------------------------------------------
    232 
    233 # Grouping the document tree into Texinfo files. List of tuples
    234 # (source start file, target name, title, author,
    235 #  dir menu entry, description, category)
    236 texinfo_documents = [
    237         ('index', '@FILE_DOC@', u'RTEMS @DOC@ Documentation', u'RTEMS Documentation Project', 'RTEMSwafBuild', 'RTEMS', 'Miscellaneous'),
    238 ]
    239 
    240 # Documents to append as an appendix to all manuals.
    241 #texinfo_appendices = []
    242 
    243 # If false, no module index is generated.
    244 #texinfo_domain_indices = True
    245 
    246 # How to display URL addresses: 'footnote', 'no', or 'inline'.
    247 #texinfo_show_urls = 'footnote'
    248 
    249 
    250210# Example configuration for intersphinx: refer to the Python standard library.
    251 intersphinx_mapping = {'http://docs.python.org/': None}
     211#intersphinx_mapping = {'http://docs.python.org/': None}
    252212
    253213highlight_language = "c"
  • common/rtemsstyle.sty

    r89f2347 ra316b1f  
    4646  \fancyfoot[LO]{{\nouppercase{\rightmark}}}
    4747  \fancyfoot[RE]{{\nouppercase{\leftmark}}}
    48   \fancyhead[LE,RO]{{ \@title, \py@release}}
     48  \fancyhead[LE,RO]{{\@title, \py@release}}
     49  \fancyhead[RE,LO]{{\chaptername\:\thechapter\:Section\:\thesection}}
    4950  \renewcommand{\headrulewidth}{0.4pt}
    5051  \renewcommand{\footrulewidth}{0.4pt}
     
    7374\renewcommand\thepart{\@Roman\c@part}
    7475\renewcommand\part{%
    75    \pagestyle{plain}
     76   \pagestyle{normal}
    7677   \if@noskipsec \leavevmode \fi
    7778   \cleardoublepage
  • common/waf.py

    r89f2347 ra316b1f  
    22from waflib.Build import BuildContext
    33
     4sphinx_min_version = (1,3)
    45
    5 sphinx_min_version = (1,3)
    66
    77def cmd_spell(ctx):
     
    3636
    3737
    38 
    3938def check_sphinx_version(ctx, minver):
    40 #       try:
    4139        version = ctx.cmd_and_log(ctx.env.BIN_SPHINX_BUILD + ['--version']).split(" ")[-1:][0]
    4240        ver = tuple(map(int, version.split(".")))
    43 #       except Exception:
    44 #               ctx.fatal("Version check failed please report")
    4541
    4642        if ver < minver:
     
    4945        return ver
    5046
     47
    5148def cmd_configure(ctx):
    5249        ctx.load('tex')
    53 
    5450
    5551        if not ctx.env.PDFLATEX or not ctx.env.MAKEINDEX:
     
    5854        ctx.find_program("sphinx-build", var="BIN_SPHINX_BUILD", mandatory=True)
    5955        ctx.find_program("aspell", var="BIN_ASPELL", mandatory=False)
    60 
     56        ctx.find_program("inliner", var="BIN_INLINER", mandatory=False)
    6157
    6258        ctx.start_msg("Checking if Sphinx is at least %s.%s" % sphinx_min_version)
     
    6662
    6763
     64def doc_pdf(ctx, source_dir, conf_dir):
     65        ctx(
     66                rule    = "${BIN_SPHINX_BUILD} -b latex -c %s -j %d -d build/doctrees %s build/latex" % (conf_dir, ctx.options.jobs, source_dir),
     67                cwd             = ctx.path.abspath(),
     68                source  = ctx.path.ant_glob('**/*.rst'),
     69                target  = "latex/%s.tex" % ctx.path.name
     70        )
     71
     72        ctx.add_group()
     73
     74        ctx(
     75                features        = 'tex',
     76                cwd                     = "%s/latex/" % ctx.path.get_bld().abspath(),
     77                type            = 'pdflatex',
     78                source          = ctx.bldnode.find_or_declare("latex/%s.tex" % ctx.path.name),
     79                prompt          = 0
     80        )
     81
     82
     83def doc_singlehtml(ctx, source_dir, conf_dir):
     84        if not ctx.env.BIN_INLINER:
     85                ctx.fatal("Node inliner is required install with 'npm install -g inliner' (https://github.com/remy/inliner)")
     86
     87        ctx(
     88                rule    = "${BIN_SPHINX_BUILD} -b singlehtml -c %s -j %d -d build/doctrees %s build/singlehtml" % (conf_dir, ctx.options.jobs, source_dir),
     89                cwd             = ctx.path.abspath(),
     90                source  = ctx.path.ant_glob('**/*.rst'),
     91                target  = "singlehtml/index.html"
     92        )
     93
     94        ctx.add_group()
     95
     96        ctx(
     97                rule    = "${BIN_INLINER} ${SRC} > ${TGT}",
     98                source  = "singlehtml/index.html",
     99                target  = "singlehtml/%s.html" % ctx.path.name
     100        )
     101
     102
     103def html_resources(ctx):
     104        for dir in ["_static", "_templates"]:
     105                files = ctx.path.parent.find_node("common").ant_glob("%s/*" % dir)
     106                ctx.path.get_bld().make_node(dir).mkdir() # dirs
     107
     108                ctx(
     109                        features    = "subst",
     110                        is_copy     = True,
     111                        source      = files,
     112                        target      = [ctx.bldnode.find_node(dir).get_bld().make_node(x.name) for x in files]
     113                )
     114
    68115
    69116def cmd_build(ctx, conf_dir=".", source_dir="."):
    70117        srcnode = ctx.srcnode.abspath()
    71118
     119        if not ctx.env.PDFLATEX or not ctx.env.MAKEINDEX:
     120                ctx.fatal('The programs pdflatex and makeindex are required')
     121
     122
    72123        if ctx.options.pdf:
    73 
    74                 ctx(
    75                         rule    = "${BIN_SPHINX_BUILD} -b latex -c %s -j %d -d build/doctrees %s build/latex" % (conf_dir, ctx.options.jobs, source_dir),
    76                         cwd             = ctx.path.abspath(),
    77                         source  = ctx.path.ant_glob('**/*.rst'),
    78                         target  = "latex/%s.tex" % ctx.path.name
    79                 )
    80 
    81                 ctx.add_group()
    82 
    83                 ctx(
    84                         features        = 'tex',
    85                         cwd                     = "%s/latex/" % ctx.path.get_bld().abspath(),
    86                         type            = 'pdflatex',
    87                         source          = ctx.bldnode.find_or_declare("latex/%s.tex" % ctx.path.name),
    88                         prompt          = 0
    89                 )
    90 
     124                doc_pdf(ctx, source_dir, conf_dir)
     125        elif ctx.options.singlehtml:
     126                html_resources(ctx)
     127                doc_singlehtml(ctx, source_dir, conf_dir)
    91128        else:
    92         # Copy HTML resources.
    93                 for dir in ["_static", "_templates"]:
    94                         files = ctx.path.parent.find_node("common").ant_glob("%s/*" % dir)
    95                         ctx.path.get_bld().make_node(dir).mkdir() # dirs
    96 
    97                         ctx(
    98                                 features    = "subst",
    99                                 is_copy     = True,
    100                                 source      = files,
    101                                 target      = [ctx.bldnode.find_node(dir).get_bld().make_node(x.name) for x in files]
    102                         )
    103 
     129                html_resources(ctx)
    104130                ctx(
    105131                        rule   = "${BIN_SPHINX_BUILD} -b html -c %s -j %d -d build/doctrees %s build/html" % (conf_dir, ctx.options.jobs, source_dir),
     
    111137def cmd_options(ctx):
    112138        ctx.add_option('--pdf', action='store_true', default=False, help="Build PDF.")
     139        ctx.add_option('--singlehtml', action='store_true', default=False, help="Build Single HTML file, requires Node Inliner")
     140
    113141
    114142def cmd_options_path(ctx):
     
    152180
    153181        cmd_build(ctx, conf_dir="build", source_dir="build")
    154 
    155 
  • filesystem/conf.py

    r89f2347 ra316b1f  
    88
    99latex_documents = [
    10         ('index', 'filesystem.tex', u'RTEMS Filesystem Documentation', u'RTEMS Documentation Project', 'manual'),
     10        ('index', 'filesystem.tex', u'RTEMS Filesystem', u'RTEMS Documentation Project', 'manual'),
    1111]
    12 
Note: See TracChangeset for help on using the changeset viewer.