bkyk8rc3zvpnsf5inmcqq4n3k98cv6hj-my-site-hyper-literate-git.test.suzanne.soy-0.0.1

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

running.scrbl (10378B)


      1 #lang scribble/manual
      2 @(require "utils.rkt"
      3           scribble/bnf
      4           (for-label setup/xref))
      5 
      6 @(define fn (italic "fn"))
      7 
      8 @title[#:tag "running"]{Running @exec{scribble}}
      9 
     10 The @exec{scribble} command-line tool (also available as @as-index{@exec{raco
     11 scribble}}) runs a Scribble document and renders it to a specific
     12 format. Select a format with one of the following flags, where the
     13 output name @|fn| is by default the document source name without
     14 its file suffix:
     15 
     16 @itemlist[
     17 
     18  @item{@DFlag{html} --- a single HTML page @filepath{@|fn|.html},
     19        plus CSS sources and needed image files; this mode is the
     20        default if no format is specified}
     21 
     22  @item{@DFlag{htmls} --- multiple HTML pages (and associated files) in
     23        a @filepath{@|fn|} directory, starting with
     24        @filepath{@|fn|/index.html}}
     25 
     26  @item{@DFlag{html-tree} @nonterm{n} --- HTML pages in a directory
     27        tree up to @nonterm{n} layers deep; a tree of depth @exec{0} is
     28        equivalent to using @DFlag{html}, and a tree of depth @exec{1}
     29        is equivalent to using @DFlag{htmls}}
     30 
     31  @item{@DFlag{latex} --- LaTeX source @filepath{@|fn|.tex}, plus
     32        any needed additional files (such as non-standard class files)
     33        needed to run @exec{latex} or @exec{pdflatex}}
     34 
     35  @item{@DFlag{pdf} --- PDF @filepath{@|fn|.pdf} that is generated
     36        via @exec{pdflatex}}
     37 
     38  @item{@DFlag{xelatex} --- PDF @filepath{@|fn|.pdf} that is generated
     39        via @exec{xelatex}}
     40 
     41  @item{@DFlag{dvipdf} --- PDF @filepath{@|fn|.pdf} that is generated
     42        via @exec{latex}, @exec{dvips}, and @exec{pstopdf}}
     43 
     44  @item{@DFlag{latex-section} @nonterm{n} --- LaTeX source
     45        @filepath{@|fn|.tex} plus additional @filepath{.tex} files to
     46        be included in the enclosing document's preamble, where the
     47        enclosing document must use the UTF-8 input encoding and T1
     48        font encoding; use @tt{1} for @nonterm{n} to make the rendered
     49        document a section, @tt{2} for a subsection, etc.}
     50 
     51  @item{@DFlag{text} --- plain text in a single file
     52        @filepath{@|fn|.txt}, with non-ASCII content encoded as UTF-8}
     53 
     54  @item{@DFlag{markdown} --- Markdown text in a single file
     55        @filepath{@|fn|.md}, with non-ASCII content encoded as UTF-8}
     56 
     57 ]
     58 
     59 Use @DFlag{dest-name} to specify a @|fn| other than the default name,
     60 but only when a single source file is provided. Use the @DFlag{dest}
     61 flag to specify a destination directory (for any number of source
     62 files). Use @DFlag{dest-base} to add a prefix to the name of each
     63 support file that is generated or copied to the destination.
     64 
     65 After all flags, provide one or more document sources, where each
     66 source declares a module. The module should either have a @racket[doc]
     67 @tech[#:doc '(lib "scribblings/reference/reference.scrbl")]{submodule}
     68 that exports @racket[doc] as a @racket[part], or it should directly
     69 export @racket[doc] as a @racket[part]. (The submodule is tried first,
     70 and the main module is not directly loaded or evaluated if the
     71 submodule can be loaded on its own.) Use @DFlag{doc-binding} to
     72 access an alternate exported name in place of @racket[doc].
     73 
     74 When multiple documents are rendered at the same time, cross-reference
     75 information in one document is visible to the other documents. See
     76 @secref["xref-flags"] for information on references that cross
     77 documents that are built separately.
     78 
     79 @history[#:changed "1.4" @elem{Added @DFlag{dvipdf}.}
     80          #:changed "1.18" @elem{Added @DFlag{doc-binding}.}
     81          #:changed "1.19" @elem{Added @DFlag{xelatex}.}]
     82 
     83 @section{Extra and Format-Specific Files}
     84 
     85 Use the @DFlag{style} flag to specify a format-specific file to adjust
     86 the output style file for certain formats. For HTML (single-page or
     87 multi-page) output, the style file should be a CSS file that is
     88 applied after all other CSS files, and that may therefore override
     89 some style properties. For Latex (or PDF) output, the style file
     90 should be a @filepath{.tex} file that can redefine Latex commands.
     91 When a particular Scribble function needs particular CSS or Latex
     92 support, however, a better option is to use a @racket[css-addition] or
     93 @racket[tex-addition] style property so that the support is included
     94 automatically; see @secref["config"] for more information.
     95 
     96 In rare cases, use the @DFlag{style} flag to specify a format-specific
     97 base style file. For HTML (single-page or multi-page) output, the
     98 style file should be a CSS file to substitute for
     99 @filepath{scribble.css} in the @filepath{scribble} collection. For
    100 Latex (or PDF) output, the style file should be a @filepath{.tex} file
    101 to substitute for @filepath{scribble.tex} in the @filepath{scribble}
    102 collection. The @DFlag{style} flag is rarely useful, because the
    103 content of @filepath{scribble.css} or @filepath{scribble.tex} is
    104 weakly specified; replacements must define all of the same styles, and
    105 the set of styles can change across versions of Racket.
    106 
    107 Use @DFlag{prefix} to specify an alternate format-specific start of
    108 the output file. For HTML output, the starting file specifies the
    109 @tt{DOCTYPE} declaration of each output HTML file as a substitute for
    110 @filepath{scribble-prefix.html} in the @filepath{scribble}
    111 collection. For Latex (or PDF) output (but not Latex-section output), the starting file specifies
    112 the @ltx{documentclass} declaration and initial @ltx{usepackage}
    113 declarations as a substitute for @filepath{scribble-prefix.tex} in the
    114 @filepath{scribble} collection. See also @racket[html-defaults],
    115 @racket[latex-defaults], and @secref["config"].
    116 
    117 For any output form, use the @DPFlag{extra} flag to add a needed file
    118 to the build destination, such as an image file that is referenced in
    119 the generated output but not included via @racket[image] (which copies
    120 the file automatically).
    121 
    122 @section[#:tag "xref-flags"]{Handling Cross-References}
    123 
    124 Cross references within a document or documents rendered together are
    125 always resolved. When cross references span documents that are
    126 rendered separately, cross-reference information needs to be saved and
    127 loaded explicitly. Cross-reference information is format-specific, but
    128 HTML-format information is usable for Latex (or PDF) or text rendering.
    129 
    130 A Racket installation includes HTML-format cross-reference information
    131 for all installed documentation. Each document's information is in a
    132 separate file, so that loading all relevant files would be tedious.
    133 The @PFlag{m} or @DPFlag{main-xref-in} flag loads cross-reference
    134 information for all installed documentation, so
    135 
    136 @commandline{scribble +m mine.scrbl}
    137 
    138 renders @filepath{mine.scrbl} to @filepath{mine.html} with
    139 cross-reference links to the Racket installation's documentation.
    140 (The @filepath{racket-index} package must be installed to use
    141 @PFlag{m}/@DPFlag{main-xref-in}.)
    142 
    143 The @DPFlag{xref-in} flag loads cross-reference information by calling
    144 a specified module's function. The @racketmodname[setup/xref] module
    145 provides @racket[load-collections-xref] to load cross-reference
    146 information for all installed documentation, and @PFlag{m} or
    147 @DPFlag{main-xref-in} is just a shorthand for @exec{++xref-in
    148 setup/xref load-collections-xref}.
    149 
    150 The @DFlag{redirect-main} flag for HTML output redirects links to the local
    151 installation's documentation (not user-scope documentation) to a given URL, such as
    152 @tt{http://docs.racket-lang.org/}. Beware that documentation links
    153 sometimes change (although Scribble generates HTML paths and anchors
    154 in a relatively stable way), so
    155 @tt{http://download.racket-lang.org/docs/@italic{version}/html/} may be
    156 more reliable when building with an installation for @italic{version}.
    157 The @DFlag{redirect-main} flag is ignored for non-HTML output.
    158 
    159 The @DFlag{redirect} flag is like @DFlag{redirect-main}, except that
    160 it builds on the given URL to indicate a cross-reference tag that is
    161 more stable than an HTML path and anchor (in case the documentation
    162 for a function changes sections, for example), and it can generate
    163 redirected linked for documentation that is installed in user scope.
    164 The URL @tt{https://docs.racket-lang.org/local-redirect/index.html} can
    165 work for these redirections.
    166 
    167 For cross-references among documentation that is not part of the
    168 Racket installation, use @DFlag{info-out} to save information from a
    169 document build and use @DPFlag{info-in} to load previously saved
    170 information. For example, if @filepath{c.scrbl} refers to information
    171 in @filepath{a.scrbl} and @filepath{b.scrbl}, then
    172 
    173 @commandline{scribble --info-out a.sxref a.scrbl}
    174 @commandline{scribble --info-out b.sxref b.scrbl}
    175 @commandline{scribble ++info-in a.sxref ++info-in b.sxref c.scrbl}
    176 
    177 builds @filepath{c.html} with cross-reference links into
    178 @filepath{a.html} and @filepath{b.html}.
    179 
    180 
    181 @section{Selecting an Image Format}
    182 
    183 Use the @DPFlag{convert} @nonterm{fmt} flag to select @nonterm{fmt} as
    184 a preferred image format to use when rendering a document that
    185 includes values that can be converted to different image formats. The
    186 @nonterm{fmt} argument can be @exec{pdf}, @exec{ps}, @exec{png},
    187 @exec{svg}, or @exec{gif}, but a renderer typically supports only a
    188 subset of those formats.
    189 
    190 Use @DPFlag{convert} @nonterm{fmt} multiple times to specify multiple
    191 preferred formats, where a @nonterm{fmt} earlier in the command line
    192 take precedence over @nonterm{fmt}s specified later.
    193 
    194 For example, to generate Latex sources with images in Encapsulated
    195 PostScript format (so that the result works with @exec{latex} instead
    196 of @exec{pdflatex}), combine @DFlag{latex} with @exec{@DPFlag{convert}
    197 ps}. To generate HTML pages with images converted to SVG format
    198 instead of PNG format, combine @DFlag{html} with
    199 @exec{@DPFlag{convert} svg}.
    200 
    201 @history[#:changed "1.4" @elem{Added @DPFlag{convert} support.}]
    202 
    203 @section{Passing Command-Line Arguments to Documents}
    204 
    205 When @exec{scribble} loads and renders a document module, by default
    206 it sets @racket[current-command-line-arguments] to an empty vector.
    207 Use the @DPFlag{arg} flag (any number of times) to add a string to
    208 @racket[current-command-line-arguments].
    209 
    210 For example,
    211 
    212 @commandline{scribble ++arg --mode ++arg fast turtle.scrbl}
    213 
    214 causes @racket[(current-command-line-arguments)] to return
    215 @racket['#("--mode" "fast")] while @filepath{turtle.scrbl} is loaded
    216 and rendered, which could affect the content that
    217 @filepath{turtle.scrbl} generates if it uses
    218 @racket[current-command-line-arguments].
    219 
    220 @history[#:changed "1.1" @elem{Added the empty-vector default and @DPFlag{arg} flag.}]