diff --git a/documentation/source/conf.py b/documentation/source/conf.py index c77aa86..404e579 100644 --- a/documentation/source/conf.py +++ b/documentation/source/conf.py @@ -1,22 +1,12 @@ # Configuration file for the Sphinx documentation builder. -# -# This file only contains a selection of the most common options. For a full -# list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html -# -- Path setup -------------------------------------------------------------- - -# If extensions (or modules to document with autodoc) are in another directory, -# add these directories to sys.path here. If the directory is relative to the -# documentation root, use os.path.abspath to make it absolute, like shown here. - import os import sys sys.path.insert(0, os.path.abspath('../../_packages/sphinx-extensions/current/src/sphinxcontrib')) import dylan.domain -import dylan.themes as dylan_themes # -- Project information ----------------------------------------------------- @@ -25,7 +15,7 @@ author = 'Carl Gay' # The full version, including alpha/beta/rc tags -release = 'v1.2.0' +release = 'v2.0.0' # -- General configuration --------------------------------------------------- @@ -38,9 +28,6 @@ 'sphinx.ext.intersphinx' ] -# Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] - # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. # This pattern also affects html_static_path and html_extra_path. @@ -52,22 +39,5 @@ # without depending on this top-level config file. primary_domain = 'dylan' - -# -- Options for HTML output ------------------------------------------------- - -# The theme to use for HTML and HTML Help pages. See the documentation for -# a list of builtin themes. -html_theme = dylan_themes.get_html_theme_default() - -# Theme options are theme-specific and customize the look and feel of a theme -# further. For a list of options available for each theme, see the -# documentation. -html_theme_options = dylan_themes.get_html_theme_options_default() - -# Add any paths that contain custom themes here, relative to this directory. -html_theme_path = [dylan_themes.get_html_theme_path()] - -# Add any paths that contain custom static files (such as style sheets) here, -# relative to this directory. They are copied after the builtin static files, -# so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] +# sudo pip install -U furo +html_theme = 'furo' diff --git a/documentation/source/index.rst b/documentation/source/index.rst index 1e586ee..581e4a2 100644 --- a/documentation/source/index.rst +++ b/documentation/source/index.rst @@ -11,8 +11,8 @@ The *strings* library was originally defined in `DEP-0004 `_. Some additional background material can be found there. -.. contents:: Contents - :local: +.. toctree:: + :hidden: .. note:: @@ -671,55 +671,20 @@ Case Conversion Functions lowercase!("Hack Dylan!") => error, attempt to modify a string constant -.. generic-function:: lowercase? - :sealed: +.. function:: lowercase? - Returns :drm:`#t` if the argument is entirely composed of - non-uppercase characters. - - :signature: lowercase? (string-or-character) => (is-lowercase?) - :parameter string-or-character: An instance of ``type-union(, )``. - :value is-lowercase?: An instance of :drm:``. - -.. method:: lowercase? - :specializer: - :sealed: - - Returns :drm:`#t` if the given character is not an uppercase alphabetic. - Otherwise :drm:`#f` is returned. + Returns :drm:`#t` if the argument is a lowercase alphabetic character. + Otherwise returns :drm:`#f`. :signature: lowercase? (character) => (is-lowercase?) :parameter character: An instance of :drm:``. :value is-lowercase?: An instance of :drm:``. - :example: - - .. code-block:: dylan - lowercase?('n') => #t - lowercase?('N') => #f - lowercase?('*') => #t - -.. method:: lowercase? - :specializer: - :sealed: - - Returns :drm:`#t` if the argument does not contain any uppercase - alphabetic characters. Otherwise :drm:`#f` is returned. - - :signature: lowercase? (string) => (is-lowercase?) - :parameter string: An instance of :drm:``. - :parameter #key start: An instance of :drm:``, default 0. The index - at which to start checking. - :parameter #key end: An instance of :drm:``, default - ``string.size``. The index before which to stop checking. - :value is-lowercase?: An instance of :drm:``. - :example: - - .. code-block:: dylan + .. code-block:: dylan - lowercase?("Why me?") => #f - lowercase?("Why me?", start: 1) => #t - lowercase?("e.e. cummings") => #t + lowercase?('n') => #t + lowercase?('N') => #f + lowercase?('*') => #f .. generic-function:: uppercase :sealed: @@ -820,54 +785,21 @@ Case Conversion Functions uppercase!("Hack Dylan!") => error, attempt to modify a string constant -.. generic-function:: uppercase? - :sealed: - - Returns :drm:`#t` if the argument is entirely composed of - non-lowercase characters. - - :signature: uppercase? (string-or-character) => (is-uppercase?) - :parameter string-or-character: An instance of ``type-union(, )``. - :value is-uppercase?: An instance of :drm:``. +.. function:: uppercase? -.. method:: uppercase? - :specializer: - :sealed: - - Returns :drm:`#t` if the given character is not a lowercase alphabetic. - Otherwise :drm:`#f` is returned. + Returns :drm:`#t` if the argument is an uppercase alphabetic character. + Otherwise returns :drm:`#f`. :signature: uppercase? (character) => (is-uppercase?) :parameter character: An instance of :drm:``. :value is-uppercase?: An instance of :drm:``. - :example: - - .. code-block:: dylan - - uppercase?('T') => #t - uppercase?('t') => #f - uppercase?('^') => #t - -.. method:: uppercase? - :specializer: - :sealed: - - Returns :drm:`#t` if the argument does not contain any lowercase - alphabetic characters. Otherwise :drm:`#f` is returned. - :signature: uppercase? (string) => (is-uppercase?) - :parameter string: An instance of :drm:``. - :parameter #key start: An instance of :drm:``, default 0. The index - at which to start checking. - :parameter #key end: An instance of :drm:``, default - ``string.size``. The index before which to stop checking. - :value is-uppercase?: An instance of :drm:``. - :example: + .. code-block:: dylan - .. code-block:: dylan + uppercase?('T') => #t + uppercase?('t') => #f + uppercase?('^') => #f - uppercase?("AbC") => #f - uppercase?("ABC") => #t Comparison Functions -------------------- diff --git a/dylan-package.json b/dylan-package.json index 87a369c..2c1d4fb 100644 --- a/dylan-package.json +++ b/dylan-package.json @@ -7,6 +7,6 @@ ], "description": "String manipulation functions", "name": "strings", - "version": "1.2.0", + "version": "2.0.0", "url": "https://github.com/dylan-lang/strings" } diff --git a/strings.dylan b/strings.dylan index 1e2c00f..59d0b40 100644 --- a/strings.dylan +++ b/strings.dylan @@ -129,43 +129,21 @@ define method whitespace? end; -// Returns #t if the required argument could be a value returned from -// 'as-uppercase'. In other words, if the argument does NOT contain -// any lowercase characters. define sealed generic uppercase? - (string-or-character :: , #key) => (uppercase? :: ); + (char :: ) => (uppercase? :: ); define inline method uppercase? - (char :: , #key) => (b :: ) - ~lowercase-code?(as(, char)) -end; - -define method uppercase? - (string :: , - #key start :: = 0, - end: epos :: = string.size) - => (b :: ) - %every?(uppercase?, string, start, epos) + (char :: ) => (b :: ) + uppercase-code?(as(, char)) end; -// Returns #t if the required argument could be a value returned from -// 'as-lowercase'. In other words, if the argument does NOT contain -// any uppercase characters. define sealed generic lowercase? - (string-or-character :: , #key) => (lowercase? :: ); + (char :: ) => (lowercase? :: ); define inline method lowercase? - (char :: , #key) => (b :: ) - ~uppercase-code?(as(, char)) -end; - -define method lowercase? - (string :: , - #key start :: = 0, - end: epos :: = string.size) - => (b :: ) - %every?(lowercase?, string, start, epos) + (char :: ) => (b :: ) + lowercase-code?(as(, char)) end; diff --git a/tests/strings-test-suite.dylan b/tests/strings-test-suite.dylan index 064f76b..e28c634 100644 --- a/tests/strings-test-suite.dylan +++ b/tests/strings-test-suite.dylan @@ -405,16 +405,24 @@ end test; define test test-lowercase? () check-true("a", lowercase?('a')); - check-true("b", lowercase?("abc-$#^^10")); - check-false("c", lowercase?('A')); - check-false("d", lowercase?("aBc-$#^^10")); + check-true("z", lowercase?('z')); + check-false("A", lowercase?('A')); + check-false("Z", lowercase?('Z')); + check-false("@", lowercase?('@')); + check-false("[", lowercase?('[')); + check-false("`", lowercase?('`')); + check-false("{", lowercase?('{')); end test; define test test-uppercase? () - check-true("a", uppercase?('X')); - check-true("b", uppercase?("ABC-$#^^10")); - check-false("c", uppercase?('b')); - check-false("d", uppercase?("aBc-$#^^10")); + check-true("A", uppercase?('A')); + check-true("Z", uppercase?('Z')); + check-false("a", uppercase?('a')); + check-false("z", uppercase?('z')); + check-false("@", uppercase?('@')); + check-false("[", uppercase?('[')); + check-false("`", uppercase?('`')); + check-false("{", uppercase?('{')); end test;