Skip to content

Commit

Permalink
restore oy docs
Browse files Browse the repository at this point in the history
  • Loading branch information
fajarpnugroho committed Nov 23, 2023
2 parents ca630ef + 381ada4 commit a800ab5
Show file tree
Hide file tree
Showing 359 changed files with 9,096 additions and 280 deletions.
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ CODE_OF_CONDUCT.md
deploy.sh
font-selection.json
README.md
Vagrantfile
Vagrantfile
4 changes: 2 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ updates:
- package-ecosystem: bundler
directory: "/"
schedule:
interval: daily
interval: monthly
open-pull-requests-limit: 10
target-branch: dev
target-branch: master
versioning-strategy: increase-if-necessary
7 changes: 2 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ on:

jobs:
test:
runs-on: ubuntu-latest
# See https://github.com/oyindonesia/oybayar-docs/pull/119 about the reason of using 20.04
runs-on: ubuntu-20.04

strategy:
matrix:
Expand All @@ -29,10 +30,6 @@ jobs:
gems-${{ runner.os }}-${{ matrix.ruby-version }}-
gems-${{ runner.os }}-
# necessary to get ruby 2.3 to work nicely with bundler vendor/bundle cache
# can remove once ruby 2.3 is no longer supported
- run: gem update --system

- run: bundle config set deployment 'true'
- name: bundle install
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Deploy

on:
push:
branches: [ 'main' ]
branches: [ 'master' ]

jobs:
deploy:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ on:
jobs:
push_to_registry:
name: Push Docker image to Docker Hub
# See https://github.com/oyindonesia/oybayar-docs/pull/119 about the reason of using 20.04
# runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- name: Check out the repo
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ build/
_yardoc
doc/
.idea/
vendor/

# Vagrant artifacts
ubuntu-*-console.log
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.5.9
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ gem 'middleman', '~> 4.4'
gem 'middleman-syntax', '~> 3.2'
gem 'middleman-autoprefixer', '~> 3.0'
gem 'middleman-sprockets', '~> 4.1'
gem 'middleman-livereload', '~> 3.4'
gem 'rouge', '~> 3.21'
gem 'redcarpet', '~> 3.6.0'
gem 'nokogiri', '~> 1.13.3'
Expand Down
1 change: 1 addition & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ GEM
contracts (0.16.1)
dotenv (2.8.1)
erubis (2.7.0)
eventmachine (1.2.7)
execjs (2.7.0)
fast_blank (1.0.1)
fastimage (2.2.6)
Expand Down
26 changes: 21 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,23 @@

<p align="center"><em>The example above was created with Slate. Check it out at <a href="https://slatedocs.github.io/slate">slatedocs.github.io/slate</a>.</em></p>

Features
**Prerequisite**
1. Install docker
`brew install docker`
2. Install docker compose
`brew install docker-compose`

**How to Run in Local**
------------
1. Build the Docker image:
`docker-compose build`
2. Start the container:
`docker-compose up -d`
3. To check the container logs:
`docker-compose logs -f`
4. Open the application in your web browser by visiting `http://localhost:4567/`

**Features**
------------

* **Clean, intuitive design** — With Slate, the description of your API is on the left side of your documentation, and all the code examples are on the right side. Inspired by [Stripe's](https://stripe.com/docs/api) and [PayPal's](https://developer.paypal.com/webapps/developer/docs/api/) API docs. Slate is responsive, so it looks great on tablets, phones, and even in print.
Expand All @@ -32,7 +48,7 @@ Features

Getting started with Slate is super easy! Simply press the green "use this template" button above and follow the instructions below. Or, if you'd like to check out what Slate is capable of, take a look at the [sample docs](https://slatedocs.github.io/slate/).

Getting Started with Slate
**Getting Started with Slate**
------------------------------

To get started with Slate, please check out the [Getting Started](https://github.com/slatedocs/slate/wiki#getting-started)
Expand All @@ -43,7 +59,7 @@ We support running Slate in three different ways:
* [Using Vagrant](https://github.com/slatedocs/slate/wiki/Using-Slate-in-Vagrant)
* [Using Docker](https://github.com/slatedocs/slate/wiki/Using-Slate-in-Docker)

Companies Using Slate
**Companies Using Slate**
---------------------------------

* [NASA](https://api.nasa.gov)
Expand All @@ -60,14 +76,14 @@ Companies Using Slate

You can view more in [the list on the wiki](https://github.com/slatedocs/slate/wiki/Slate-in-the-Wild).

Questions? Need Help? Found a bug?
**Questions? Need Help? Found a bug?**
--------------------

If you've got questions about setup, deploying, special feature implementation in your fork, or just want to chat with the developer, please feel free to [start a thread in our Discussions tab](https://github.com/slatedocs/slate/discussions)!

Found a bug with upstream Slate? Go ahead and [submit an issue](https://github.com/slatedocs/slate/issues). And, of course, feel free to submit pull requests with bug fixes or changes to the `dev` branch.

Contributors
**Contributors**
--------------------

Slate was built by [Robert Lord](https://lord.io) while at [TripIt](https://www.tripit.com/). The project is now maintained by [Matthew Peveler](https://github.com/MasterOdin) and [Mike Ralphson](https://github.com/MikeRalphson).
Expand Down
5 changes: 4 additions & 1 deletion config.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Unique header generation
require './lib/unique_head.rb'

activate :i18n, :mount_at_root => :en, :langs => [:id, :en]
activate :livereload

# Markdown
set :markdown_engine, :redcarpet
set :markdown,
Expand All @@ -23,7 +26,7 @@
# Activate the syntax highlighter
activate :syntax
ready do
require './lib/monokai_sublime_slate.rb'
require './lib/oy_theme.rb'
require './lib/multilang.rb'
end

Expand Down
17 changes: 17 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: '3'
services:
slate:
build: .
command: ["build"]
volumes:
- "./build:/srv/slate/build"
- "./source:/srv/slate/source"
slate_serve:
image: slatedocs/slate
command: ["serve"]
ports:
- "4567:4567"
volumes:
- "./source:/srv/slate/source"
depends_on:
- slate
96 changes: 96 additions & 0 deletions lib/oy_theme.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# -*- coding: utf-8 -*- #
# frozen_string_literal: true

# this is based on https://github.com/rouge-ruby/rouge/blob/master/lib/rouge/themes/monokai_sublime.rb
# but without the added background, and changed styling for JSON keys to be soft_yellow instead of white

module Rouge
module Themes
class OyTheme < CSSTheme
name 'oy.theme.slate'

palette :black => '#000000'
palette :bright_green => '#a6e22e'
palette :bright_pink => '#f92672'
palette :carmine => '#960050'
palette :dark => '#49483e'
palette :dark_grey => '#888888'
palette :dark_red => '#aa0000'
palette :dimgrey => '#75715e'
palette :emperor => '#555555'
palette :grey => '#999999'
palette :light_grey => '#aaaaaa'
palette :light_violet => '#ae81ff'
palette :soft_cyan => '#66d9ef'
palette :soft_yellow => '#e6db74'
palette :very_dark => '#1e0010'
palette :whitish => '#f8f8f2'
palette :orange => '#ff860F'
palette :yellow => '#f7d250'
palette :white => '#ffffff'

style Generic::Heading, :fg => :grey
style Literal::String::Regex, :fg => :orange
style Generic::Output, :fg => :dark_grey
style Generic::Prompt, :fg => :emperor
style Generic::Strong, :bold => false
style Generic::Subheading, :fg => :light_grey
style Name::Builtin, :fg => :orange
style Comment::Multiline,
Comment::Preproc,
Comment::Single,
Comment::Special,
Comment, :fg => :dimgrey
style Error,
Generic::Error,
Generic::Traceback, :fg => :carmine
style Generic::Deleted,
Generic::Inserted,
Generic::Emph, :fg => :dark
style Keyword::Constant,
Keyword::Declaration,
Keyword::Reserved,
Name::Constant,
Keyword::Type, :fg => :soft_cyan
style Literal::Number::Float,
Literal::Number::Hex,
Literal::Number::Integer::Long,
Literal::Number::Integer,
Literal::Number::Oct,
Literal::Number,
Literal::String::Char,
Literal::String::Escape,
Literal::String::Symbol, :fg => :light_violet
style Literal::String::Doc,
Literal::String::Double,
Literal::String::Backtick,
Literal::String::Heredoc,
Literal::String::Interpol,
Literal::String::Other,
Literal::String::Single,
Literal::String, :fg => :yellow
style Name::Attribute,
Name::Class,
Name::Decorator,
Name::Exception,
Name::Function, :fg => :bright_green
style Name::Variable::Class,
Name::Namespace,
Name::Entity,
Name::Builtin::Pseudo,
Name::Variable::Global,
Name::Variable::Instance,
Name::Variable,
Text::Whitespace,
Text,
Name, :fg => :white
style Name::Label, :fg => :orange
style Operator::Word,
Name::Tag,
Keyword,
Keyword::Namespace,
Keyword::Pseudo,
Operator, :fg => :orange
end
end
end
28 changes: 21 additions & 7 deletions lib/toc_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,27 @@ def toc_data(page_content)
# get a flat list of headers
headers = []
html_doc.css('h1, h2, h3').each do |header|
headers.push({
id: header.attribute('id').to_s,
content: header.children,
title: header.children.to_s.gsub(/<[^>]*>/, ''),
level: header.name[1].to_i,
children: []
})
if header.attribute('type').to_s == 'beta'
idxTrim = header.children.to_s.index("<span")
content = header.children.to_s[0,idxTrim] + "<span class='tags beta'>BETA</span>"
headers.push({
id: header.attribute('id').to_s,
content: content,
title: header.children.to_s.gsub(/<[^>]*>/, ''),
level: header.name[1].to_i,
releases: true,
children: []
})
else
headers.push({
id: header.attribute('id').to_s,
content: header.children,
title: header.children.to_s.gsub(/<[^>]*>/, ''),
level: header.name[1].to_i,
releases: false,
children: []
})
end
end

[3,2].each do |header_level|
Expand Down
36 changes: 35 additions & 1 deletion lib/unique_head.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,54 @@ class UniqueHeadCounter < Middleman::Renderers::MiddlemanRedcarpetHTML
def initialize
super
@head_count = {}
@previous = {}
end
def header(text, header_level)
friendly_text = text.gsub(/<[^>]*>/,"").parameterize
if(friendly_text.include? "release-")
idxTrim = friendly_text.index('release-')
friendly_text = friendly_text[0, idxTrim]
if friendly_text[friendly_text.length-1] == '-'
friendly_text = friendly_text[0, friendly_text.length-1]
end
end
if(friendly_text.include? "new")
idxTrim = friendly_text.index('new')
friendly_text = friendly_text[0, idxTrim]
if friendly_text[friendly_text.length-1] == '-'
friendly_text = friendly_text[0, friendly_text.length-1]
end
end
if friendly_text.strip.length == 0
# Looks like parameterize removed the whole thing! It removes many unicode
# characters like Chinese and Russian. To get a unique URL, let's just
# URI escape the whole header
friendly_text = Digest::SHA1.hexdigest(text)[0,10]
end
if (@previous[header_level] == nil )|| (@previous[header_level] != friendly_text)
@previous[header_level] = friendly_text
end

if header_level > 1
friendly_text += "-#{@previous[header_level-1]}"
end

@head_count[friendly_text] ||= 0
@head_count[friendly_text] += 1
if @head_count[friendly_text] > 1
friendly_text += "-#{@head_count[friendly_text]}"
end
return "<h#{header_level} id='#{friendly_text}'>#{text}</h#{header_level}>"
if(text.include? "RELEASE")
idxTrim = text.index("RELEASE-")
content = text[0,idxTrim]
releaseDate = text[idxTrim+"RELEASE-".length, text.length]
return "<h#{header_level} id='#{friendly_text}' type='beta'>#{content} <span class='tags beta'>release on #{releaseDate}</span> </h#{header_level}>"
elsif(text.include? "NEW")
idxTrim = text.index("NEW")
content = text[0,idxTrim]
return "<h#{header_level} id='#{friendly_text}' type='new'>#{content} <span class='tags new'>NEW</span> </h#{header_level}>"
else
return "<h#{header_level} id='#{friendly_text}' type='normal'>#{text}</h#{header_level}>"
end
end
end
10 changes: 10 additions & 0 deletions locales/en.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
en:
title: "Product Documentation"
home: "Home"
register: "Register Now"
login: "Log In"
api: "API Docs"
lang: "ID"
search: "Search Documentation"

10 changes: 10 additions & 0 deletions locales/id.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
id:
title: "Dokumentasi Produk"
home: "Beranda"
register: "Daftar Sekarang"
login: "Masuk Dashboard"
api: "Dok API"
lang: "EN"
search: "Pencarian Dokumentasi"

1 change: 1 addition & 0 deletions source/CNAME
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
docs.oyindonesia.com
Binary file added source/images/3p1p_preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/images/API_Biller.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/images/As_Parent_Subs_1_Initial(2).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/images/As_Parent_Subs_5a_Top_Up.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/images/Choose_SoF_4_Type_or_search_sub.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/images/Flow_API_Biller.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/images/Login_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/images/Login_OTP.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/images/Login_OTP.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/images/MEM_Add_Sub_Entity_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/images/MEM_Add_Sub_Entity_2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/images/Payment_Routing_Flow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit a800ab5

Please sign in to comment.