{"size": 3398, "ext": "scrbl", "max_stars_repo_path": "share/pkgs/simple-tree-text-markup-doc/scribblings/simple-tree-text-markup/construct.scrbl", "max_stars_repo_name": "takikawa/racket-ppa", "max_stars_repo_stars_event_min_datetime": "2018-07-29T04:13:52.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-14T16:11:17.000Z", "max_issues_repo_path": "share/pkgs/simple-tree-text-markup-doc/scribblings/simple-tree-text-markup/construct.scrbl", "max_issues_repo_name": "takikawa/racket-ppa", "max_issues_repo_issues_event_min_datetime": "2017-08-25T20:26:37.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-26T17:48:40.000Z", "max_forks_repo_path": "share/pkgs/simple-tree-text-markup-doc/scribblings/simple-tree-text-markup/construct.scrbl", "max_forks_repo_name": "takikawa/racket-ppa", "max_forks_repo_forks_event_min_datetime": "2021-07-26T00:31:14.000Z", "max_forks_repo_forks_event_max_datetime": "2021-10-09T05:02:43.000Z"}
{"max_stars_count": 10, "max_issues_count": 15, "max_forks_count": 2, "avg_line_length": 39.0574712644, "max_line_length": 86, "alphanum_fraction": 0.7448499117}
#lang scribble/doc

@(require (for-label (only-in simple-tree-text-markup/data markup? image-markup)
                     (prefix-in data/ simple-tree-text-markup/data)
                     (except-in simple-tree-text-markup/construct image-markup)
		     racket) ; srcloc
          scribble/manual)

@title[#:style 'toc #:tag "simple-tree-text-markup-construct"]{Markup Construction}

@defmodule[simple-tree-text-markup/construct]

While the struct definitions in
@racketmodname[simple-tree-text-markup/data] can also be used for
constructing markup, the procedures exported here are somewhat more
convenient to use, and do a fair amount of normalization upon
constructions.

@defproc[(srcloc-markup [srcloc srcloc?] [markup markup?]) markup?]{
This constructs a markup object that will represent a link to a source
location, represented by @racket[srcloc], where the link visualization
is represented by @racket[markup].
}

@defproc[(framed-markup [markup markup?]) markup?]{
This markup constructor puts a frame around @racket[markup].
}

@defthing[empty-markup markup?]{
This is the empty markup object.
}

@defthing[empty-line markup?]{
This is a markup object representing an empty line, i.e. empty
vertical space.
}

@defproc[(number [number number?]
		 [#:exact-prefix exact-prefix (or/c 'always 'never 'when-necessary) 'never]
		 [#:inexact-prefix inexact-prefix (or/c 'always 'never 'when-necessary) 'never]
		 [#:fraction-view fraction-view (or/c #f 'mixed 'improper 'decimal) #f])
  markup?]{
This constructs markup for a number to be rendered in a format that can be read back.

The @racket[exact-prefix] argument specifies whether the representation
should carry a @litchar{#e} prefix: Always, never, or when necessary to
identify a representation that would otherwise be considered inexact.

Similarly for @racket[inexact-prefix].  Note however that @racket['when-necessary]
is usually equivalent to @racket['never], as inexact numbers are always
printed with a decimal dot, which is sufficient to identify a number
representation as inexact.

The @racket[fraction-view] field specifies how exact non-integer reals
- fractions - should be rendered: As a mixed fraction, an improper fraction,
or a decimal, possibly identifying periodic digits.  For @racket['decimal],
if it's not possible to render the number as a decimal exactly, a fraction
representation might be generated. For @racket['mixed] an improper fraction
representation might be generated if a mixed representation could not be read
back.

If @racket[fraction-view] is @racket[#f], this option comes from some
unspecified user preference.
}

@defproc[(horizontal [markup markup?] ...) markup?]{
This procedure arranges the @racket[markup] arguments horizontally.
}

@defproc[(vertical [markup markup?] ...) markup?]{
This procedure arranges the @racket[markup] arguments vertically.
}
@defproc[(transform-markup [mappers (listof pair?)]
                           [markup markup?])
	 markup?]{
This is the same as @racketlink[data/transform-markup]{@racketfont{transform-markup}}.
}

@defproc[(markup-transform-image-data [transform-image-data (any/c . -> . any/c)]
				      [markup markup?])
	 markup?]{
This walks over a markup tree, leaving everything unchanged except
@racket[image-markup] values.  For those, it applies
@racket[transform-image-data] to its @racket[data]field, replacing
it by the return value.
}
