summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJovansonlee Cesar <ivanceras@gmail.com>2018-09-05 18:37:29 +0800
committerJovansonlee Cesar <ivanceras@gmail.com>2018-09-05 18:37:29 +0800
commit3dcf8bd411d288986a8574080e35ac42685b3c3c (patch)
tree7ee2c995fb6584ccba059723cf0f1f66915070a8
parent7ee0f63677da1e33b7264f382bdf6a3b52b9535d (diff)
Make build to stable version
Bump up version
-rw-r--r--svgbob/Cargo.lock2
-rw-r--r--svgbob/Cargo.toml2
-rw-r--r--svgbob/src/element.rs5
-rw-r--r--svgbob/src/enhance.rs8
-rw-r--r--svgbob/src/enhance_circle.rs34
-rw-r--r--svgbob/src/grid.rs4
-rw-r--r--svgbob/src/lib.rs8
-rw-r--r--svgbob/src/optimizer.rs2
-rw-r--r--svgbob/src/point.rs10
9 files changed, 39 insertions, 36 deletions
diff --git a/svgbob/Cargo.lock b/svgbob/Cargo.lock
index 2a509d6..c494259 100644
--- a/svgbob/Cargo.lock
+++ b/svgbob/Cargo.lock
@@ -80,7 +80,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "svgbob"
-version = "0.3.0"
+version = "0.3.1"
dependencies = [
"handlebars 0.21.1 (registry+https://github.com/rust-lang/crates.io-index)",
"pom 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
diff --git a/svgbob/Cargo.toml b/svgbob/Cargo.toml
index 41577bf..40fc798 100644
--- a/svgbob/Cargo.toml
+++ b/svgbob/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "svgbob"
-version = "0.3.0"
+version = "0.3.1"
authors = ["Jovansonlee Cesar <ivanceras@gmail.com>"]
description = "Transform your ascii diagrams into happy little SVG"
repository = "https://github.com/ivanceras/svgbob"
diff --git a/svgbob/src/element.rs b/svgbob/src/element.rs
index f3b0912..de1ce3c 100644
--- a/svgbob/src/element.rs
+++ b/svgbob/src/element.rs
@@ -19,7 +19,8 @@ use element::{
Feature::{Arrow,ArrowStart,Circle,Square,OpenCircle,BigOpenCircle,Nothing},
};
use unicode_width::UnicodeWidthStr;
-use point;
+//use point;
+use svg;
@@ -35,6 +36,7 @@ pub enum Element {
impl Element{
+ /*
fn longer_line<'a>(&'a self, other: &'a Element) -> &'a Element {
match self{
Element::Line(s1, e1, _, _, _) => match other{
@@ -53,6 +55,7 @@ impl Element{
_ => panic!("only for lines"),
}
}
+ */
}
#[derive(Debug, Clone, PartialEq, PartialOrd, Ord, Eq)]
diff --git a/svgbob/src/enhance.rs b/svgbob/src/enhance.rs
index 19cc815..1d49ca0 100644
--- a/svgbob/src/enhance.rs
+++ b/svgbob/src/enhance.rs
@@ -2,7 +2,7 @@ use focus_char::FocusChar;
use fragments::Fragment;
use location::Location;
use location::Direction::{Bottom, BottomLeft, BottomRight, Left, Right, Top, TopLeft, TopRight};
-use block::Block::{A, C, E, F, J, K, M, O, P, Q, R, S, T, U, W, Y};
+use block::Block::{A, C, E, F, J, K, M, O, P, Q, S, T, U, W, Y};
use point_block::PointBlock;
use fragments::{line, arc, arrow_line, open_circle};
@@ -32,7 +32,7 @@ impl<'g> Enhance for FocusChar<'g> {
let o = &PointBlock::block(O);
let p = &PointBlock::block(P);
let q = &PointBlock::block(Q);
- let r = &PointBlock::block(R);
+ //let r = &PointBlock::block(R);
let s = &PointBlock::block(S);
let t = &PointBlock::block(T);
let u = &PointBlock::block(U);
@@ -50,13 +50,13 @@ impl<'g> Enhance for FocusChar<'g> {
let top_right = || Location::go(TopRight);
let bottom_left = || Location::go(BottomLeft);
let bottom_right = || Location::go(BottomRight);
- let top2 = || Location::jump(Top,2);
+ //let top2 = || Location::jump(Top,2);
let top_left2 = || top().go_left(2);
let top_right2 = || top().go_right(2);
let bottom_right2 = || bottom().go_right(2);
let bottom_left2 = || bottom().go_left(2);
- let top2_right = || top2().right();
+ //let top2_right = || top2().right();
// _ underscore
if self.is('_') {
diff --git a/svgbob/src/enhance_circle.rs b/svgbob/src/enhance_circle.rs
index 140be02..3794a67 100644
--- a/svgbob/src/enhance_circle.rs
+++ b/svgbob/src/enhance_circle.rs
@@ -73,7 +73,7 @@ impl<'g> EnhanceCircle for FocusChar<'g> {
let bottom2_right2 = || Location::jump(Bottom, 2).go_right(2);
let bottom2_right3 = || Location::jump(Bottom, 2).go_right(3);
let bottom2_right4 = || Location::jump(Bottom, 2).go_right(4);
- let bottom2_right5 = || Location::jump(Bottom, 2).go_right(5);
+ //let bottom2_right5 = || Location::jump(Bottom, 2).go_right(5);
let bottom2_right6 = || Location::jump(Bottom, 2).go_right(6);
let left2 = || Location::jump(Left,2);
let right2 = || Location::jump(Right,2);
@@ -98,16 +98,16 @@ impl<'g> EnhanceCircle for FocusChar<'g> {
let bottom3_left2 = || Location::jump(Bottom,3).go_left(2);
let bottom3_left3 = || Location::jump(Bottom,3).go_left(3);
let bottom3_left4 = || Location::jump(Bottom,3).go_left(4);
- let bottom3_left5 = || Location::jump(Bottom,3).go_left(5);
+ //let bottom3_left5 = || Location::jump(Bottom,3).go_left(5);
let left3 = || Location::jump(Left,3);
let right3 = || Location::jump(Right,3);
let top_right3 = || top().go_right(3);
let top_left3 = || top().go_left(3);
let bottom_right3 = || bottom().go_right(3);
- let bottom_left3 = || bottom().go_left(3);
+ //let bottom_left3 = || bottom().go_left(3);
- let top4 = || Location::jump(Top,4);
- let bottom4 = || Location::jump(Bottom,4);
+ //let top4 = || Location::jump(Top,4);
+ //let bottom4 = || Location::jump(Bottom,4);
let left4 = || Location::jump(Left,4);
let right4 = || Location::jump(Right,4);
let top_right4 = || top().go_right(4);
@@ -115,8 +115,8 @@ impl<'g> EnhanceCircle for FocusChar<'g> {
let bottom_right4 = || bottom().go_right(4);
let bottom_left4 = || bottom().go_left(4);
- let top5 = || Location::jump(Top,5);
- let bottom5 = || Location::jump(Bottom,5);
+ //let top5 = || Location::jump(Top,5);
+ //let bottom5 = || Location::jump(Bottom,5);
let left5 = || Location::jump(Left,5);
let right5 = || Location::jump(Right,5);
let top_right5 = || top().go_right(5);
@@ -124,23 +124,23 @@ impl<'g> EnhanceCircle for FocusChar<'g> {
let bottom_right5 = || bottom().go_right(5);
let bottom_left5 = || bottom().go_left(5);
- let top6 = || Location::jump(Top,6);
- let bottom6 = || Location::jump(Bottom,6);
+ //let top6 = || Location::jump(Top,6);
+ //let bottom6 = || Location::jump(Bottom,6);
let left6 = || Location::jump(Left,6);
let right6 = || Location::jump(Right,6);
let top_right6 = || top().go_right(6);
- let top_left6 = || top().go_left(6);
- let bottom_right6 = || bottom().go_right(6);
+ //let top_left6 = || top().go_left(6);
+ //let bottom_right6 = || bottom().go_right(6);
let bottom_left6 = || bottom().go_left(6);
- let top7 = || Location::jump(Top,7);
- let bottom7 = || Location::jump(Bottom,7);
- let left7 = || Location::jump(Left,7);
+ //let top7 = || Location::jump(Top,7);
+ //let bottom7 = || Location::jump(Bottom,7);
+ //let left7 = || Location::jump(Left,7);
let right7 = || Location::jump(Right,7);
- let top_right7 = || top().go_right(7);
- let top_left7 = || top().go_left(7);
+ //let top_right7 = || top().go_right(7);
+ //let top_left7 = || top().go_left(7);
let bottom_right7 = || bottom().go_right(7);
- let bottom_left7 = || bottom().go_left(7);
+ //let bottom_left7 = || bottom().go_left(7);
// circle 4
diff --git a/svgbob/src/grid.rs b/svgbob/src/grid.rs
index cbdaedb..5cb5b37 100644
--- a/svgbob/src/grid.rs
+++ b/svgbob/src/grid.rs
@@ -7,7 +7,6 @@ use svg::Node;
use svg::node::element::{
Definitions,
Marker,
- Path as SvgPath,
Rectangle as SvgRect,
Style,
Circle as SvgCircle,
@@ -19,6 +18,7 @@ use pom::TextInput;
use pom::parser::{sym,none_of};
use settings::Settings;
use unicode_width::UnicodeWidthChar;
+use pom;
#[derive(Debug)]
pub struct Grid {
@@ -398,6 +398,7 @@ fn arrow_marker() -> Marker {
marker
}
+/*
fn clear_arrow_marker() -> Marker {
let mut marker = Marker::new()
.set("id", "clear_triangle")
@@ -417,6 +418,7 @@ fn clear_arrow_marker() -> Marker {
marker.append(path);
marker
}
+*/
/// <marker id="dot" viewBox="0 0 10 10" refX="5" refY="5"
diff --git a/svgbob/src/lib.rs b/svgbob/src/lib.rs
index 5b0e6f4..6445f34 100644
--- a/svgbob/src/lib.rs
+++ b/svgbob/src/lib.rs
@@ -29,14 +29,10 @@
//! </svg>
//!
//!
-//#![deny(warnings)]
-#![feature(extern_prelude)]
-extern crate pom;
-#[cfg(test)]
-#[macro_use]
-extern crate pretty_assertions;
+#![deny(warnings)]
extern crate svg;
extern crate unicode_width;
+extern crate pom;
pub use grid::Grid;
pub use settings::Settings;
diff --git a/svgbob/src/optimizer.rs b/svgbob/src/optimizer.rs
index 9a5b732..603ee6e 100644
--- a/svgbob/src/optimizer.rs
+++ b/svgbob/src/optimizer.rs
@@ -129,7 +129,7 @@ impl Optimizer {
// TODO: order the elements in such a way that
// the start -> end -> start chains nicely
- pub fn optimize(&self, settings: &Settings) -> Vec<Vec<Element>> {
+ pub fn optimize(&self, _settings: &Settings) -> Vec<Vec<Element>> {
let mut tracing_consumed_locs: Vec<(Loc,usize)> = vec![];
let mut optimized = vec![];
diff --git a/svgbob/src/point.rs b/svgbob/src/point.rs
index efd09da..b73edd1 100644
--- a/svgbob/src/point.rs
+++ b/svgbob/src/point.rs
@@ -26,7 +26,12 @@ impl Point {
self.y += y;
}
}
+// 3 points are collinear when the area of the triangle connecting them is 0;
+pub fn collinear(a: &Point, b: &Point, c: &Point) -> bool {
+ a.x * (b.y - c.y) + b.x * (c.y - a.y) + c.x * (a.y - b.y) == 0.0
+}
+/*
pub fn is_on_line(point: &Point, start: &Point, end: &Point) -> bool {
((point.x - start.x) / (end.x - start.x)) == ((point.y - start.y) / (end.y - start.y))
}
@@ -37,11 +42,8 @@ pub fn on_segment(q: &Point, p:&Point, r:&Point)-> bool {
q.y <= p.y.max(r.y) && q.y >= p.y.min(r.y)
}
-// 3 points are collinear when the area of the triangle connecting them is 0;
-pub fn collinear(a: &Point, b: &Point, c: &Point) -> bool {
- a.x * (b.y - c.y) + b.x * (c.y - a.y) + c.x * (a.y - b.y) == 0.0
-}
pub fn distance(a: &Point, b: &Point) -> f32{
((b.x - a.x ).powi(2) + (b.y - a.y).powi(2)).sqrt()
}
+*/