Skip to content
This repository was archived by the owner on Mar 9, 2021. It is now read-only.

Commit

Permalink
restructure docs, general cleanup + more
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickarlt committed Nov 17, 2013
1 parent 4afe92a commit 3527749
Show file tree
Hide file tree
Showing 85 changed files with 461 additions and 2,036 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ complexity.xml
# Ignore environment variables set on this machine
.env

# Ignore the docpad output
out
# Ignore the doc output
docs-build

# Mac
.DS_Store
Expand Down
70 changes: 54 additions & 16 deletions config.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,37 @@
module CustomRenderers
class SemanticTOC < Redcarpet::Render::HTML_TOC


def preprocess text
@current_level = 0
@headers = []
text
end

def header text, level
if level > 1
buf = ""

id = text.downcase.strip.gsub(' ', '-').gsub(/\(.+\)/, '').gsub(/[^\w-]/, '')

if(@headers.include?(id))
while @headers.include?(id) do
if id[-1].to_i.zero?
id = id + "-1"
else
id[-1] = (id[-1].to_i + 1).to_s
end

if !@headers.include?(id)
@headers.push(id)
break
end
end
else
@headers.push(id)
end

buf = ""

if level > 1 && level < 5

if (@current_level == 0)
@level_offset = level - 1;
Expand All @@ -31,8 +55,9 @@ def header text, level
buf << "</li><li>"
end

buf << "<a href='##{text.downcase.strip.gsub(' ', '-').gsub(/\(.+\)/, '').gsub(/[^\w-]/, '')}'>#{text}</a>"
buf << "<a href='##{id}'>#{text}</a>"
end
buf
end

def postprocess text
Expand All @@ -42,19 +67,39 @@ def postprocess text

class Markdown < Redcarpet::Render::HTML


TableOfContentsRenderer = ::Redcarpet::Markdown.new(CustomRenderers::SemanticTOC)

include Redcarpet::Render::SmartyPants

def preprocess text
@headers = []
toc = TableOfContentsRenderer.render text
text.gsub!("<!-- table_of_contents -->", toc)
return text
end

def header text, level
if level > 1
if level > 1 && level < 5
id = text.downcase.strip.gsub(' ', '-').gsub(/\(.+\)/, '').gsub(/[^\w-]/, '')

if(@headers.include?(id))
while @headers.include?(id) do
if id[-1].to_i.zero?
id = id + "-1"
else
id[-1] = (id[-1].to_i + 1).to_s
end

if !@headers.include?(id)
@headers.push(id)
break
end
end
else
@headers.push(id)
end

"<h#{level}>
<a id='#{id}' class='section-link'></a>
<a href='##{id}' class='header-link'>Link</a>
Expand All @@ -79,10 +124,14 @@ def header text, level

set :fonts_dir,'assets/fonts'

set :index_file, "index.html"
set :index_file, 'index.html'

set :markdown_engine, :redcarpet

set :source, 'docs'

set :build_dir, 'docs-build'

set :markdown,
:renderer => CustomRenderers::Markdown,
:fenced_code_blocks => true,
Expand All @@ -97,17 +146,6 @@ def header text, level

activate :rouge_syntax

# Documentation TOC
def get_pages
@pages = sitemap.resources.find_all { |page| page.url.match(/\/documentation\/.*/) }
# Sort by date of project
# @projects.sort! { |a,b| a.data['order'].to_i <=> b.data['order'].to_i }
end

ready do
get_pages
end

# Build-specific configuration
configure :build do
activate :minify_css
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ title: ArcGIS Parser
layout: documentation
---
# ArcGIS JSON Parser

<!-- table_of_contents -->

This plugin handles 2 way conversion between [GeoJSON](http://geojson.org/geojson-spec.html) and the [ArcGIS Geometry](http://help.arcgis.com/en/arcgisserver/10.0/apis/rest/geometry.html) format used by Esri.
Expand Down Expand Up @@ -57,18 +58,18 @@ var ArcGIS = require('terraformer-arcgis-parser');

#### ArcGIS.parse(json, options)

`Terraformer.ArcGIS.convert(json, options)` - Converts a GeoJSON or a [Terraformer.Primitive]() into the ArdGIS JSON format.
`Terraformer.ArcGIS.prase(json, options)` - Converts a GeoJSON or a [Terraformer.Primitive]() into the ArdGIS JSON format.

| Option | Type | Default | Description |
| --- | --- | --- | --- |
| `sr` | Number | 4236 | This is used to set the value of `spatialReference.wkid` on the output. By default this will use 4326. |
| `idAttribute` | String | "OBJECTID" | When converting GeoJSON Features the `id` key of your feature will be set on the `OBJECTID` field in your output. If you want to assign your id to a different key you should set this to the string of the key your wish to assign the `id` to. |
| `sr` | `Number` | `4236` | This is used to set the value of `spatialReference.wkid` on the output. By default this will use 4326. |
| `idAttribute` | `String` | `"OBJECTID"` | When converting GeoJSON Features the `id` key of your feature will be set on the `OBJECTID` field in your output. If you want to assign your id to a different key you should set this to the string of the key your wish to assign the `id` to. |

_Notes_
##### Notes

Terraformer will also handle converting `FeatureCollection` and `GeometryCollection` objects to arrays of ArcGIS geometries or features. However it will **Not** do this in reverse as there is no official structure for arrays of features and geometries in ArcGIS and all the output features will not have `id` properties. See [this issue](https://github.com/Esri/Terraformer/issues/104) for more details.

_Example_
##### Example

```js
//parse an ArcGIS Geometry to GeoJSON
Expand All @@ -86,13 +87,13 @@ var point = Terraformer.ArcGIS.parse({

| Option | Type | Default | Description |
| --- | --- | --- | --- |
| `idAttribute` | `String` | `"OBJECTID"`<br>`"FID"` | When converting ArcGIS Feature the `attributes` will contain id of the feature. This is usually called `OBJECTID` or `FID`. If your feature does not use the `OBJECTID` or `FID` keys as its id, you should define what the key representing your Features ID is.
| `idAttribute` | `String` | `"OBJECTID" "FID"` | When converting ArcGIS Feature the `attributes` will contain id of the feature. This is usually called `OBJECTID` or `FID`. If your feature does not use the `OBJECTID` or `FID` keys as its id, you should define what the key representing your Features ID is.

_Notes_
##### Notes

If the object is in the Web Mercator spatial reference it will be converted to WGS84.

_Example_
##### Example

```js
// take a Terraformer.Primitive or GeoJSON and convert it to ArcGIS JSON object
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ code {
@include narrowTrack;
padding: 3px;
color: darken($green, 10);
em {
color: $gray;
}
}

pre {
Expand All @@ -115,10 +118,9 @@ pre {
margin-bottom: 1*$baseline;
overflow-x: auto;
display: block;
padding: 1em;
padding: 1rem;
background: #002b36;
color: #839496;
padding-bottom: 1*$baseline;
@include respond-to($tablet-mid) {
width: 100%;
}
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
max-width: $container-max;
margin: auto;
padding-top: 36*$point;
padding-bottom: 36*$point;
padding-left: $edge;
width: 80%;

Expand All @@ -15,44 +16,28 @@
}

.subhead {
@include clearfix;
position: relative;
background-color: transparent;
padding-top: 1*$baseline;
padding-bottom: 2*$baseline;
clear: both;
h2 {
@include p28-5;
@include OpenLight;
padding-top: 4*$baseline;
padding-left: 4*$pica;
margin-bottom: -11*$p;
line-height: 2*$baseline;
width: 0.5*$measure;
margin-left: 0.5*$measure;
@include respond-to($tablet-mid) {
padding-top: 1*$baseline;
width: 0.33*$measure;
margin-left: 0.66*$measure;
}
}

h3 {
@include OpenBold;
@include p13-5;
padding-left: 4*$pica;
width: 0.5*$measure;
margin-left: 0.5*$measure;
@include respond-to($tablet-mid) {
width: 0.33*$measure;
margin-left: 0.66*$measure;
}
}
img {
width: 0.5*$measure;
margin: auto;
float: left;
display: inline;
position: absolute;
margin-left: -0.5*$measure;
width: 0.4*$measure;
@include respond-to($tablet-mid) {
width: 0.66*$measure;
display: none;
}
}
}
Expand Down Expand Up @@ -145,4 +130,9 @@
width: 0.66*$measure;
}
}
}

.index {
padding-left: $edge;
width: 60%;
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
padding: 3*$baseline 0 0 0;
width: 100%;
section {
width: 50%;
width: 65%;
margin: auto;
}
h1 {
Expand All @@ -27,10 +27,14 @@
padding-left: 9em;
width: 45%;
padding-top: 1*$baseline;
padding-bottom: 3*$baseline;
@include respond-to($tablet-mid) {
@include p18;
padding-top: 1*$baseline;
}
}
.cover-actions {
padding-left: 21.5rem;
padding-bottom: 3*$baseline;
width: 45%;
}
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,11 @@ nav {

footer {
margin: 0;
padding-top: 3*$baseline;
padding-top: 1*$baseline;
padding-bottom: 0;
width: $container-width;
color: $white;
background-color: $darkest-gray;
background-color: $darker-gray;
text-align: center;
p {
@include Open;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
border: none;
display: none;
position: absolute;
margin-top: -4*$p;
margin-left: -3em;
margin-right: 0.5em;
color: darken($cream, 15);
Expand All @@ -37,6 +36,24 @@
}
}

h2 {
.header-link, .back-to-top-link {
margin-top: 8*$p;
}
}

h3 {
.header-link, .back-to-top-link {
margin-top: -3*$p;
}
}

h4 {
.header-link, .back-to-top-link {
margin-top: -4*$p;
}
}

.back-to-top-link {
right: 0;
float: right;
Expand All @@ -47,7 +64,6 @@
.section-link {
border: none;
position: absolute;
width: 100%;
height: 40px;
top: -40px;
display: block;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,4 @@
@import "modules/header";
@import "modules/icons";
@import "modules/semantic-toc";
@import "modules/drawer";

@import "modules/drawer";
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 3527749

Please sign in to comment.