From c51a5d7678c365a87981c1df1b05d51ecb589e97 Mon Sep 17 00:00:00 2001 From: Daniel Ehrenberg Date: Tue, 10 Feb 2009 01:46:02 -0600 Subject: [PATCH 1/2] Making basis/wrap not try to align the last line --- basis/wrap/strings/strings-tests.factor | 4 +++- basis/wrap/wrap.factor | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/basis/wrap/strings/strings-tests.factor b/basis/wrap/strings/strings-tests.factor index 0bea9b5d32..e66572dc1b 100644 --- a/basis/wrap/strings/strings-tests.factor +++ b/basis/wrap/strings/strings-tests.factor @@ -27,7 +27,7 @@ word wrap."> " " wrap-indented-string ] unit-test -[ "this text\nhas lots\nof spaces" ] +[ "this text\nhas lots of\nspaces" ] [ "this text has lots of spaces" 12 wrap-string ] unit-test [ "hello\nhow\nare\nyou\ntoday?" ] @@ -39,3 +39,5 @@ word wrap."> [ "aaa bb\nccccccc\nddddddd" ] [ "aaa bb ccccccc ddddddd" 6 wrap-string ] unit-test \ wrap-string must-infer + +[ "a b c d e f\ng h" ] [ "a b c d e f g h" 11 wrap-string ] unit-test diff --git a/basis/wrap/wrap.factor b/basis/wrap/wrap.factor index 6e5bf31075..0b7f869141 100644 --- a/basis/wrap/wrap.factor +++ b/basis/wrap/wrap.factor @@ -36,8 +36,10 @@ SYMBOL: line-ideal ] each drop ; inline : paragraph-cost ( paragraph -- cost ) - [ head-width>> deviation ] - [ tail-cost>> ] bi + ; + dup lines>> 1list? [ drop 0 ] [ + [ head-width>> deviation ] + [ tail-cost>> ] bi + + ] if ; : min-cost ( paragraphs -- paragraph ) [ paragraph-cost ] min-by ; From bac9705da1e9bbd13953461c0d6bcc67ff2551e0 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Tue, 10 Feb 2009 10:37:46 -0600 Subject: [PATCH 2/2] spiff up id3 docs a bit, and fix help-lint --- extra/id3/id3-docs.factor | 12 ++++++------ extra/id3/id3-tests.factor | 6 +++--- extra/id3/id3.factor | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/extra/id3/id3-docs.factor b/extra/id3/id3-docs.factor index 94128dc3b2..da69c2ced3 100644 --- a/extra/id3/id3-docs.factor +++ b/extra/id3/id3-docs.factor @@ -3,15 +3,15 @@ USING: help.markup help.syntax sequences kernel ; IN: id3 -HELP: id3-parse-mp3-file +HELP: file-id3-tags { $values { "path" "a path string" } - { "object/f" "either a tuple consisting of the data from an MP3 file, or an f indicating this file has no (supported) ID3 information." } } -{ $description "Return a tuple containing the ID3 information parsed out of the MP3 file" } ; + { "object/f" "a tuple storing ID3 metadata or f" } } +{ $description "Return a tuple containing the ID3 information parsed out of the MP3 file, or " { $link f } " if no metadata is present." } ; ARTICLE: "id3" "ID3 tags" -{ $emphasis "ID3" } " tags are textual data that is used to describe the information (title, artist, etc.) in an .MP3 file" -"Parsing an MP3 file: " -{ $subsection id3-parse-mp3-file } ; +"The " { $vocab-link "id3" } " vocabulary contains words for parsing " { $emphasis "ID3" } " tags, which are textual fields storing an MP3's title, artist, and other metadata." $nl +"Parsing ID3 tags from an MP3 file:" +{ $subsection file-id3-tags } ; ABOUT: "id3" diff --git a/extra/id3/id3-tests.factor b/extra/id3/id3-tests.factor index d84f2c8726..b9d45b1b04 100644 --- a/extra/id3/id3-tests.factor +++ b/extra/id3/id3-tests.factor @@ -58,7 +58,7 @@ IN: id3.tests } } } -] [ "resource:extra/id3/tests/blah3.mp3" id3-parse-mp3-file ] unit-test +] [ "resource:extra/id3/tests/blah3.mp3" file-id3-tags ] unit-test [ T{ mp3v2-file @@ -159,7 +159,7 @@ IN: id3.tests } } } -] [ "resource:extra/id3/tests/blah2.mp3" id3-parse-mp3-file ] unit-test +] [ "resource:extra/id3/tests/blah2.mp3" file-id3-tags ] unit-test [ T{ mp3v1-file @@ -178,5 +178,5 @@ IN: id3.tests } { genre 89 } } -] [ "resource:extra/id3/tests/blah.mp3" id3-parse-mp3-file ] unit-test +] [ "resource:extra/id3/tests/blah.mp3" file-id3-tags ] unit-test diff --git a/extra/id3/id3.factor b/extra/id3/id3.factor index b2c2ec0621..64e1ff1d10 100644 --- a/extra/id3/id3.factor +++ b/extra/id3/id3.factor @@ -142,7 +142,7 @@ PRIVATE> ! main stuff -: id3-parse-mp3-file ( path -- object ) +: file-id3-tags ( path -- object/f ) [ { { [ dup id3v2? ] [ read-v2-tag-data ] } ! ( ? -- mp3v2-file )