Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Phil Shafer committed Apr 26, 2015
2 parents 0960770 + 89f889f commit be04385
Show file tree
Hide file tree
Showing 52 changed files with 2,674 additions and 117 deletions.
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

ACLOCAL_AMFLAGS = -I m4

SUBDIRS = libxo xo xolint tests doc
SUBDIRS = libxo xo xolint xohtml tests doc
bin_SCRIPTS=libxo-config
dist_doc_DATA = Copyright

Expand Down
11 changes: 11 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,14 @@ AC_ARG_ENABLE([debug],
AC_MSG_RESULT([$LIBXO_DEBUG])
AM_CONDITIONAL([LIBXO_DEBUG], [test "$LIBXO_DEBUG" != "no"])

AC_MSG_CHECKING([whether to build with text-only rendering])
AC_ARG_ENABLE([text-only],
[ --enable-text-only Turn on text-only rendering],
[LIBXO_TEXT_ONLY=yes; AC_DEFINE([LIBXO_TEXT_ONLY], [1], [Enable text-only rendering])],
[LIBXO_TEXT_ONLY=no])
AC_MSG_RESULT([$LIBXO_TEXT_ONLY])
AM_CONDITIONAL([LIBXO_TEXT_ONLY], [test "$LIBXO_TEXT_ONLY" != "no"])

AC_CHECK_LIB([m], [lrint])
AM_CONDITIONAL([HAVE_LIBM], [test "$HAVE_LIBM" != "no"])

Expand Down Expand Up @@ -233,6 +241,7 @@ AC_CONFIG_FILES([
libxo/xoversion.h
xo/Makefile
xolint/Makefile
xohtml/Makefile
packaging/libxo.pc
doc/Makefile
tests/Makefile
Expand All @@ -253,6 +262,7 @@ AC_MSG_NOTICE([summary of build options:
bindir: ${XO_BINDIR}
includedir: ${XO_INCLUDEDIR}
share dir: ${XO_SHAREDIR}
oxtradoc dir: ${SLAX_OXTRADOCDIR}
compiler: ${CC} (${HAVE_GCC:-no})
compiler flags: ${CFLAGS}
Expand All @@ -262,4 +272,5 @@ AC_MSG_NOTICE([summary of build options:
debug: ${LIBXO_DEBUG:-no}
printf-like: ${HAVE_PRINTFLIKE:-no}
libxo-options: ${LIBXO_OPTS:-no}
text-only: ${LIBXO_TEXT_ONLY:-no}
])
97 changes: 93 additions & 4 deletions doc/libxo.txt
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ A single libxo function call in source code is all that's required:
<host>my-box</host>
<domain>example.com</domain>
JSON:
"host": my-box",
"host": "my-box",
"domain": "example.com"

For brevity, the HTML output is emitted.
Expand Down Expand Up @@ -228,17 +228,17 @@ data, including data type, description, and an XPath location.
<div class="line">
<div class="data" data-tag="blocks">36</div>
<div class="padding"> </div>
<div class="data data-tag="path">./src</div>
<div class="data" data-tag="path">./src</div>
</div>
<div class="line">
<div class="data" data-tag="blocks">40</div>
<div class="padding"> </div>
<div class="data data-tag="path">./bin</div>
<div class="data" data-tag="path">./bin</div>
</div>
<div class="line">
<div class="data" data-tag="blocks">90</div>
<div class="padding"> </div>
<div class="data data-tag="path">./</div>
<div class="data" data-tag="path">./</div>
</div>

** Format Strings @format-strings@
Expand Down Expand Up @@ -285,6 +285,7 @@ content. The roles are listed below; only one role is permitted:
|---+--------------+-------------------------------------------------|
| M | Name | Description |
|---+--------------+-------------------------------------------------|
| C | color/effect | Field has color and effect controls |
| D | decoration | Field is non-text (e.g., colon, comma) |
| E | error | Field is an error message |
| L | label | Field is text that prefixes a value |
Expand All @@ -298,6 +299,56 @@ content. The roles are listed below; only one role is permitted:
| ] | stop anchor | End a section of anchored variable-width text |
|---+--------------+-------------------------------------------------|

**** The Color Role ({C:})

Colors and effects control how text values are displayed; they are
used for display styles (TEXT and HTML). The color content can be
either static, when placed directly within the field descriptor, or a
printf-style format descriptor can be used, if preceded by a slash ("/"):

xo_emit("{C:bold}{Lwc:Cost}{:cost/%u}{C:reset}\n", cost);
xo_emit("{C:/fg-%s,bg-%s}{Lwc:Cost}{:cost/%u}{C:reset}\n",
fg_color, bg_color, cost);

The content should be a comma-separated list of zero or more colors or
display effects. Colors and effects remain in effect until
modified by other "C" roles. If the content is empty, the "reset"
action is performed.

|---------------+-------------------------------------------------|
| Name | Description |
|---------------+-------------------------------------------------|
| bg-XXXXX | Change background color |
| bold | Start bold text effect |
| fg-XXXXX | Change foreground color |
| inverse | Start inverse (aka reverse) text effect |
| no-bold | Stop bold text effect |
| no-inverse | Stop inverse (aka reverse) text effect |
| no-underline | Stop underline text effect |
| normal | Reset effects (only) |
| reset | Reset colors and effects (restore defaults) |
| underline | Start underline text effect |
|---------------+-------------------------------------------------|

The following color names are supported:

|---------------|
| Name |
|---------------|
| black |
| blue |
| cyan |
| default |
| green |
| magenta |
| red |
| white |
| yellow |
|---------------|

Color names are prefixed with either "fg-" or "bg-" to change the
foreground and background colors, respectively.

**** The Decoration Role ({D:})

Decorations are typically punctuation marks such as colons,
Expand Down Expand Up @@ -1404,9 +1455,21 @@ functions like xo_failure, xo_warn, xo_err, etc. The program name is
initialized by xo_parse_args, but subsequent calls to xo_set_program
can override this value.

xo_set_program(argv[0]);

Note that the value is not copied, so the memory passed to
xo_set_program (and xo_parse_args) must be maintained by the caller.

*** xo_set_version

The xo_set_version function records a version number to be emitted as
part of the data for encoding styles (XML and JSON). This version
number is suitable for tracking changes in the content, allowing a
user of the data to discern which version of the data model is in use.

void xo_set_version (const char *version);
void xo_set_version_h (xo_handle_t *xop, const char *version);

*** Field Information (xo_info_t) @info@

HTML data can include additional information in attributes that
Expand Down Expand Up @@ -1705,6 +1768,32 @@ The "-V" option does not report errors, but prints a complete list of
all field names, sorted alphabetically. The output can help spot
inconsistencies and spelling errors.

* xohtml

xohtml is a tool for turning the output of libxo-enabled commands into
html files suitable for display in modern HTML web browsers. It can
be used to test and debug HTML output, as well as to make the user
ache to escape the world of 70s terminal devices.

xohtml is given a command, either on the command line or via the "-c"
option. If not command is given, standard input is used. The
command's output is wrapped in HTML tags, with references to
supporting CSS and Javascript files, and written to standard output or
the file given in the "-f" option. The "-b" option can be used to
provide an alternative base path for the support files.

|--------------+---------------------------------------------------|
| Option | Meaning |
|--------------+---------------------------------------------------|
| -b <base> | Base path for finding css/javascript files |
| -c <command> | Command to execute |
| -f <file> | Output file name |
|--------------+---------------------------------------------------|

The "-c" option takes a full command with arguments, including
any libxo options needed to generate html ("--libxo=html"). This
value must be quoted if it consists of multiple tokens.

* FAQs

This section contains the set of questions that users typically ask,
Expand Down
5 changes: 4 additions & 1 deletion libxo/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,15 @@ man_MANS = \
xo_no_setlocale.3 \
xo_open_container.3 \
xo_open_list.3 \
xo_open_marker.3 \
xo_parse_args.3 \
xo_set_allocator.3 \
xo_set_flags.3 \
xo_set_info.3 \
xo_set_options.3 \
xo_set_style.3 \
xo_set_version.3 \
xo_set_writer.3

EXTRA_DIST =
EXTRA_DIST = ${man_MANS}

Loading

0 comments on commit be04385

Please sign in to comment.