diff --git a/CHANGELOG.md b/CHANGELOG.md index b676c80e..fc214208 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # asciinema player changelog +## 2.6.1 (2018-02-21) + +* Fixed support for idle_time_limit embedded in the v2 recording +* Add support for italic text style + ## 2.6.0 (2017-11-10) * Added support for [asciicast v2](https://github.com/asciinema/asciinema/blob/develop/doc/asciicast-v2.md) recording format diff --git a/README.md b/README.md index 211465de..7061177e 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ terminal session files called Asciicast is a capture of terminal's raw output, which has to be interpreted during the playback, so the player comes with its own interpreter based on [Paul Williams' parser for ANSI-compatible video -terminals](http://vt100.net/emu/dec_ansi_parser). Its output is fully compatible +terminals](https://vt100.net/emu/dec_ansi_parser). Its output is fully compatible with most widely used terminal emulators like xterm, Gnome Terminal, iTerm etc. You can see the player in action on [asciinema.org](https://asciinema.org). @@ -398,6 +398,6 @@ source [contributors](https://github.com/asciinema/asciinema-player/contributors ## License -Copyright © 2011-2017 Marcin Kulik. +Copyright © 2011-2018 Marcin Kulik. All code is licensed under the Apache License, Version 2.0. See LICENSE file for details. diff --git a/dev/clj/user.clj b/dev/clj/user.clj index d554a8b2..6a0052fe 100644 --- a/dev/clj/user.clj +++ b/dev/clj/user.clj @@ -1,9 +1,6 @@ (ns user - (:require [schema.core :as s]) (:use [figwheel-sidecar.repl-api :as ra])) -(s/set-fn-validation! true) - (defn start [] (ra/start-figwheel!)) (defn stop [] (ra/stop-figwheel!)) diff --git a/dev/cljs/asciinema/player/dev.cljs b/dev/cljs/asciinema/player/dev.cljs index 1dd09976..55bfd06c 100644 --- a/dev/cljs/asciinema/player/dev.cljs +++ b/dev/cljs/asciinema/player/dev.cljs @@ -11,13 +11,10 @@ [asciinema.player.asciicast.v1 :as v1] [clojure.walk :as walk] [cljs.core.async :refer [chan >! " {"fg" 2}] [" " {}] ["|" {"inverse" true}] ["#include" {"fg" 4, "bold" true}] [" " {}] ["" {"fg" 2}] [" " {}]] [["#include" {"fg" 4, "bold" true}] [" " {}] ["" {"fg" 2}] [" " {}] ["|" {"inverse" true}] ["#include" {"fg" 4, "bold" true}] [" " {}] ["" {"fg" 2}] [" " {}]] [[" " {}] ["|" {"inverse" true}] [" " {}]] [["#include" {"fg" 4, "bold" true}] [" " {}] ["" {"fg" 2}] [" " {}] ["|" {"inverse" true}] ["#include" {"fg" 4, "bold" true}] [" " {}] ["" {"fg" 2}] [" " {}]] [[" " {}] ["|" {"inverse" true}] [" " {}]] [["#include" {"fg" 4, "bold" true}] [" " {}] ["" {"fg" 2}] [" " {}] ["|" {"inverse" true}] ["#include" {"fg" 4, "bold" true}] [" " {}] ["" {"fg" 2}] [" " {}]] [["#include" {"fg" 4, "bold" true}] [" " {}] ["" {"fg" 2}] [" " {}] ["|" {"inverse" true}] ["#include" {"fg" 4, "bold" true}] [" " {}] ["" {"fg" 2}] [" " {}]] [[" " {}] ["|" {"inverse" true}] [" " {}]] [["// TODO: remove me " {"fg" 1}] ["|" {"inverse" true}] ["// TODO: remove me " {"fg" 1}]] [["#include" {"fg" 4, "bold" true}] [" " {}] ["" {"fg" 2}] [" " {}] ["|" {"inverse" true}] ["#include" {"fg" 4, "bold" true}] [" " {}] ["" {"fg" 2}] [" " {}]] [["#include" {"fg" 4, "bold" true}] [" " {}] ["" {"fg" 2}] [" " {}] ["|" {"inverse" true}] ["#include" {"fg" 4, "bold" true}] [" " {}] ["" {"fg" 2}] [" " {}]] [[" " {}] ["|" {"inverse" true}] [" " {}]] [["-UUU:----F1 " {"inverse" true}] ["embedded_server_socket.hpp" {"bold" true, "inverse" true}] ["|-UUU:----F1 " {"inverse" true}] ["embedded_server_socket.hpp" {"bold" true, "inverse" true}] [" " {"inverse" true}]] [[" " {}]]]) (defonce poster-json (walk/keywordize-keys poster-js)) diff --git a/project.clj b/project.clj index d0b61098..61ca05a2 100644 --- a/project.clj +++ b/project.clj @@ -1,22 +1,22 @@ -(defproject player "2.6.0" +(defproject player "2.6.1" :description "asciinema player" :url "https://github.com/asciinema/asciinema-player" :license {:name "Apache 2.0" :url "http://www.apache.org/licenses/LICENSE-2.0"} - :dependencies [[org.clojure/clojure "1.8.0"] - [org.clojure/clojurescript "1.9.671"] - [org.clojure/core.async "0.2.374"] + :dependencies [[org.clojure/clojure "1.9.0"] + [org.clojure/clojurescript "1.9.946"] + [org.clojure/core.async "0.4.474"] [reagent "0.7.0"] [devcards "0.2.2" :exclusions [cljsjs/react cljsjs/create-react-class cljsjs/react-dom-server cljsjs/react-dom]] [org.clojure/test.check "0.9.0"] [org.clojure/core.match "0.3.0-alpha4"] [prismatic/schema "1.1.6"]] - :plugins [[lein-cljsbuild "1.1.5"] + :plugins [[lein-cljsbuild "1.1.7"] [lein-figwheel "0.5.14"] [lein-less "1.7.5"] - [lein-doo "0.1.7"] + [lein-doo "0.1.8"] [lein-kibit "0.1.3"]] :min-lein-version "2.5.3" @@ -24,12 +24,11 @@ :clean-targets ^{:protect false} ["resources/public/js" "target" "out"] :source-paths ["src" "vt/src"] - :resource-paths ["resources" "vt/resources"] :profiles {:dev {:dependencies [[com.cemerick/piggieback "0.2.1"] [org.clojure/tools.nrepl "0.2.10"] [environ "1.0.1"] - [figwheel-sidecar "0.5.0-1"]] + [figwheel-sidecar "0.5.14"]] :plugins [[refactor-nrepl "1.1.0"]] :source-paths ["dev/clj" "dev/cljs"]} :repl {:plugins [[cider/cider-nrepl "0.10.0"]]}} @@ -43,9 +42,9 @@ :output-to "resources/public/js/dev.js" :output-dir "resources/public/js/dev" :source-map true - :foreign-libs [{:file "public/element.js" + :foreign-libs [{:file "resources/public/element.js" :provides ["asciinema.player.element"]} - {:file "codepoint-polyfill.js" + {:file "vt/resources/codepoint-polyfill.js" :provides ["asciinema.vt.codepoint-polyfill"]}] :optimizations :none :pretty-print true}} @@ -56,15 +55,15 @@ :output-to "resources/public/js/devcards.js" :output-dir "resources/public/js/devcards" :source-map-timestamp true - :foreign-libs [{:file "public/element.js" + :foreign-libs [{:file "resources/public/element.js" :provides ["asciinema.player.element"]}] :optimizations :none}} :test {:source-paths ["src" "test"] :compiler {:output-to "resources/public/js/test.js" :source-map true - :foreign-libs [{:file "public/element.js" + :foreign-libs [{:file "resources/public/element.js" :provides ["asciinema.player.element"]} - {:file "codepoint-polyfill.js" + {:file "vt/resources/codepoint-polyfill.js" :provides ["asciinema.vt.codepoint-polyfill"]}] :optimizations :none :pretty-print false @@ -74,9 +73,9 @@ :output-dir "resources/public/js/release" :closure-defines {goog.DEBUG false} :preamble ["license.js" "public/CustomEvent.js" "public/CustomElements.min.js"] - :foreign-libs [{:file "public/element.js" + :foreign-libs [{:file "resources/public/element.js" :provides ["asciinema.player.element"]} - {:file "codepoint-polyfill.js" + {:file "vt/resources/codepoint-polyfill.js" :provides ["asciinema.vt.codepoint-polyfill"]}] :optimizations :advanced :elide-asserts true diff --git a/resources/license.js b/resources/license.js index 842b593c..262679f1 100644 --- a/resources/license.js +++ b/resources/license.js @@ -1,6 +1,6 @@ /** - * asciinema-player v2.6.0 + * asciinema-player v2.6.1 * - * Copyright 2011-2017, Marcin Kulik + * Copyright 2011-2018, Marcin Kulik * */ diff --git a/src/asciinema/player/asciicast/v2.cljs b/src/asciinema/player/asciicast/v2.cljs index 3c2e6881..fb2bc478 100644 --- a/src/asciinema/player/asciicast/v2.cljs +++ b/src/asciinema/player/asciicast/v2.cljs @@ -24,7 +24,7 @@ events (rest asciicast) width (or vt-width (:width header)) height (or vt-height (:height header)) - idle-time-limit (or idle-time-limit (:idle_time_limit asciicast))] + idle-time-limit (or idle-time-limit (:idle_time_limit header))] {:version 2 :width width :height height diff --git a/src/asciinema/player/core.cljs b/src/asciinema/player/core.cljs index 37a9a989..b691ef92 100644 --- a/src/asciinema/player/core.cljs +++ b/src/asciinema/player/core.cljs @@ -6,7 +6,6 @@ [asciinema.player.messages :as m] [asciinema.player.processing] [asciinema.player.source :as source :refer [make-source]] - [schema.core :as s] [clojure.string :as str])) (defn parse-npt [t] @@ -15,8 +14,7 @@ components (map * (reverse numbers) (iterate #(* 60 %) 1))] (apply + components)))) -(s/defn parse-json-poster :- (s/protocol screen/Screen) - [json :- s/Str] +(defn parse-json-poster [json] (let [lines (-> json (.replace (js/RegExp. "\\s" "g") "") js/atob @@ -24,10 +22,7 @@ (js->clj :keywordize-keys true))] {:lines lines})) -(s/defn parse-text-poster :- (s/protocol screen/Screen) - [text :- s/Str - width :- s/Num - height :- s/Num] +(defn parse-text-poster [text width height] (-> (vt/make-vt (or width 80) (or height 24)) (vt/feed-str text))) diff --git a/src/asciinema/player/source.cljs b/src/asciinema/player/source.cljs index 9b442ea2..91ce1cd6 100644 --- a/src/asciinema/player/source.cljs +++ b/src/asciinema/player/source.cljs @@ -1,6 +1,6 @@ (ns asciinema.player.source (:refer-clojure :exclude [js->clj]) - (:require [cljs.core.async :refer [chan >! ! ! value-ch @value)) - value-ch)))) + value-ch))) (defn make-recording-ch-fn [thing vt-width vt-height idle-time-limit] (lazy-promise-chan diff --git a/src/asciinema/player/view.cljs b/src/asciinema/player/view.cljs index d9935c54..894e27d5 100644 --- a/src/asciinema/player/view.cljs +++ b/src/asciinema/player/view.cljs @@ -42,15 +42,16 @@ color)] (str prefix color)))) -(defn part-class-name [{:keys [fg bg bold blink underline inverse cursor]}] +(defn part-class-name [{:keys [fg bg bold blink underline inverse italic cursor]}] (let [fg-final (if inverse (or bg "bg") fg) bg-final (if inverse (or fg "fg") bg) fg-class (color-class-name fg-final bold "fg-") bg-class (color-class-name bg-final blink "bg-") bold-class (when bold "bright") + italic-class (when italic "italic") underline-class (when underline "underline") cursor-class (when cursor "cursor") - classes (remove nil? [fg-class bg-class bold-class underline-class cursor-class])] + classes (remove nil? [fg-class bg-class bold-class italic-class underline-class cursor-class])] (when (seq classes) (string/join " " classes)))) diff --git a/test/asciinema/player/asciicast_test.cljs b/test/asciinema/player/asciicast_test.cljs index 76e39721..13b4d90f 100644 --- a/test/asciinema/player/asciicast_test.cljs +++ b/test/asciinema/player/asciicast_test.cljs @@ -41,6 +41,13 @@ (is (= (select-keys (a/load asciicast nil 30 2.5) [:width :height :duration]) {:width 80 :height 30 :duration 6.0})))) + (testing "v2 format, vec, with idle_time_limit" + (let [asciicast [{:version 2 :width 80 :height 24 :idle_time_limit 2.5} + [1.0 "o" "foo"] + [4.0 "i" "iii"] + [10.0 "o" "bar"]]] + (is (= (:duration (a/load asciicast)) 6.0)))) + (testing "v2 format, string" (let [asciicast "[{\"version\":2,\"width\":80,\"height\":24},[1,\"o\",\"foo\"],[2,\"i\",\"iii\"],[3,\"o\",\"bar\"]]" asciicast (a/load asciicast nil 30)]