chiark / gitweb /
html: Move to otter-base
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 1 Apr 2021 10:52:29 +0000 (11:52 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 1 Apr 2021 10:52:29 +0000 (11:52 +0100)
No uses yet.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
13 files changed:
Cargo.lock
Cargo.toml
base/Cargo.toml
base/html.rs [moved from src/html.rs with 100% similarity]
base/imports.rs
base/lib.rs
base/prelude.rs
daemon/cmdlistener.rs
src/global.rs
src/imports.rs
src/lib.rs
src/prelude.rs
src/spec.rs

index 6f8af030aa6b90bf9ab764d4c73219c2f5599a6e..463209fad6596f846dc0d019cf8bb9fc427f47d5 100644 (file)
@@ -2109,7 +2109,6 @@ dependencies = [
  "flexi_logger",
  "fs2",
  "glob 0.3.0",
- "htmlescape",
  "index_vec",
  "inventory",
  "lazy-init",
@@ -2168,6 +2167,7 @@ dependencies = [
  "derive_more",
  "extend",
  "fehler",
+ "htmlescape",
  "if_chain",
  "itertools",
  "num-derive",
index 4b8fcf5514fc3ba61c47118d9376233539c15ff0..1958c634bbf0c7233a9089bc3ea01a4b02638210 100644 (file)
@@ -16,7 +16,6 @@ failure="0.1.8"
 fehler="1"
 fs2="0.4"
 glob="0.3"
-htmlescape="0.3"
 inventory="0.1"
 lazy-init="0.5"
 lazy_static="1"
index fc469fb89484765d98c7aa35b1d4daff23166383..61bb8532acd009590a93555c46793b18f28905b0 100644 (file)
@@ -16,6 +16,7 @@ path = "lib.rs"
 arrayvec = "0.5"
 derive_more = "0.99"
 extend="1"
+htmlescape="0.3"
 if_chain = "1"
 itertools="0.10"
 num-derive="0.3"
similarity index 100%
rename from src/html.rs
rename to base/html.rs
index cc2bb839f1f42d95fb10c4b20cf7aa3fb144f66c..b10733bd4add469b10a5dab8c7edf79f5ab88f36 100644 (file)
@@ -5,6 +5,7 @@
 pub use arrayvec;
 pub use derive_more;
 pub use extend;
+pub use htmlescape;
 pub use if_chain;
 pub use itertools;
 pub use num_derive;
index 9dcb9b9dd02fb2a9aa8c048167c96f97f55c014f..d4610694e6e32a4cf10bcefa01fc88e28d915489 100644 (file)
@@ -6,5 +6,6 @@ pub mod imports;
 pub mod prelude;
 
 pub mod geometry;
+pub mod html;
 pub mod zcoord;
 pub mod misc;
index 30cfe48bb7777c2e95c35b2616ca6af78e903752..143677e2f2ab1f54f9c51660ce12f33419aea2b8 100644 (file)
@@ -2,17 +2,21 @@
 // SPDX-License-Identifier: AGPL-3.0-or-later
 // There is NO WARRANTY.
 
+pub use std::borrow::Borrow;
 pub use std::cmp::{max, Ordering};
 pub use std::convert::{TryFrom, TryInto};
 pub use std::fmt::{self, Debug, Display, Formatter};
 pub use std::hash::{Hash, Hasher};
 pub use std::iter;
+pub use std::mem;
 pub use std::num::{TryFromIntError, Wrapping};
+pub use std::ops::{Deref, DerefMut, Index, IndexMut};
 pub use std::str;
 pub use std::str::FromStr;
 
 pub use arrayvec::ArrayVec;
 pub use derive_more::*;
+pub use extend::ext;
 pub use fehler::{throw, throws};
 pub use if_chain::if_chain;
 pub use itertools::izip;
@@ -22,6 +26,9 @@ pub use serde_with::SerializeDisplay;
 pub use thiserror::Error;
 pub use void::Void;
 
+pub use crate::html::*;
+
 pub use crate::geometry::{CoordinateOverflow, PosC};
+pub use crate::{hformat, hformat_as_display, hwrite};
 pub use crate::misc::default;
 pub use crate::misc::display_as_debug;
index 83829941e4762944ab35e8cca6d486597087aedd..22f26468a2551bb38273601e016dcf6f96d12d71 100644 (file)
@@ -541,7 +541,7 @@ fn execute_game_insn<'cs, 'igr, 'ig: 'igr>(
       update_links(cs,ag,ig, |ig_links|{
         let mut new_links: LinksTable = (**ig_links).clone();
         let url: Url = (&url).try_into()?;
-        let show: Html = (kind, url.as_str()).into();
+        let show: Html = (kind, url.as_str()).to_html();
         new_links[kind] = Some(url.into_string());
         let new_links = Arc::new(new_links);
         *ig_links = new_links.clone();
index 7d363be53ffbb8e9f7d5da6cfe764273c3946cb0..7d0c74ccc8ca4e5ccd2807d40dcbdaa31be008cb 100644 (file)
@@ -523,8 +523,10 @@ impl Display for InstanceName {
 fn link_a_href(k: &HtmlStr, v: &str) -> Html {
   hformat!("<a href={}>{}</a>", v, k)
 }
-impl From<(LinkKind, &str)> for Html {
-  fn from((k, v): (LinkKind, &str)) -> Html {
+#[ext(pub)]
+impl (LinkKind, &str) {
+  fn to_html(self) -> Html {
+    let (k, v) = self;
     link_a_href(&k.to_html(), v)
   }
 }
@@ -534,7 +536,7 @@ impl From<&LinksTable> for Html {
     let mut s = links.iter()
       .filter_map(|(k,v)| {
         let v = v.as_ref()?;
-        Some(Html::from((k, v.as_str())))
+        Some((k, v.as_str()).to_html())
       })
       .chain(iter::once(
         link_a_href(Html::lit("Shapelib").into(), "/_/shapelib.html")
index 0bd1ab06dfe5f51b4afff38cb77f77b23c7ad6b3..ec6e02b7cc0dde6ef7832d20a2677a333c0ab009 100644 (file)
@@ -17,7 +17,6 @@ pub use failure;
 pub use flexi_logger;
 pub use fs2;
 pub use glob;
-pub use htmlescape;
 pub use index_vec;
 pub use lazy_init;
 pub use lazy_static;
index a15a6b3cfa7276d6ec34bf8aa5f03325a1bb7c82..5ddbdc100633de61338e6f65ee8cb4a88803cc99 100644 (file)
@@ -18,7 +18,6 @@ pub mod debugreader;
 pub mod error;
 pub mod gamestate;
 pub mod global;
-pub mod html;
 pub mod hand;
 pub mod hidden;
 pub mod keydata;
index 0aed003eabbb4df508a50a0fa3b4c447d53fe848..c1ce3290371c91e44124114e1415b4e7bb9bc53b 100644 (file)
@@ -5,11 +5,11 @@
 use crate::imports::*;
 
 pub use crate::imports::{flexi_logger, thiserror};
-
 pub use crate::imports::serde_json;
 
+pub use otter_base::prelude::*;
+
 pub use std::any::Any;
-pub use std::borrow::Borrow;
 pub use std::borrow::Cow;
 pub use std::cmp::{self, max, min, Ordering};
 pub use std::collections::VecDeque;
@@ -33,9 +33,7 @@ pub use std::io::{Seek, SeekFrom};
 pub use std::iter;
 pub use std::iter::repeat_with;
 pub use std::marker::PhantomData;
-pub use std::mem;
 pub use std::num::{NonZeroUsize, TryFromIntError, Wrapping};
-pub use std::ops::{Deref, DerefMut, Index, IndexMut};
 pub use std::os::linux::fs::MetadataExt; // todo why linux for st_mode??
 pub use std::os::unix;
 pub use std::os::unix::ffi::OsStrExt;
@@ -63,7 +61,6 @@ pub use downcast_rs::{impl_downcast, Downcast};
 pub use either::{Either, Left, Right};
 pub use enum_dispatch::enum_dispatch;
 pub use enum_map::{Enum, EnumMap};
-pub use extend::ext;
 pub use fehler::{throw, throws};
 pub use flexi_logger::LogSpecification;
 pub use fs2::FileExt;
@@ -114,7 +111,6 @@ pub use crate::dbgc;
 pub use crate::{deref_to_field, deref_to_field_mut};
 pub use crate::ensure_eq;
 pub use crate::from_instance_lock_error;
-pub use crate::{hformat, hformat_as_display, hwrite};
 pub use crate::matches_doesnot;
 pub use crate::trace_dbg;
 
@@ -133,7 +129,6 @@ pub use crate::fake_rng::*;
 pub use crate::gamestate::*;
 pub use crate::global::*;
 pub use crate::hidden::*;
-pub use crate::html::*;
 pub use crate::keydata::*;
 pub use crate::mgmtchannel::*;
 pub use crate::nwtemplates;
index 14fc298d4c3e35f3a31127d71aa56980631d27d9..c547f7859bb5f0b75305489f67ff848396af8876 100644 (file)
@@ -21,12 +21,12 @@ use strum::{EnumString, Display};
 use thiserror::Error;
 
 use otter_base::geometry::{Coord,Pos};
+use otter_base::hformat_as_display;
 use otter_base::misc::display_as_debug;
 
 use crate::accounts::AccountName;
 use crate::error::UnsupportedColourSpec;
 use crate::gamestate::PieceSpec;
-use crate::hformat_as_display;
 use crate::prelude::default;
 
 pub use imp::PlayerAccessSpec;