wikimd 0.3.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/wikimd/app.rb +39 -4
- data/lib/wikimd/app/public/assets/css/wikimd.css +1 -1
- data/lib/wikimd/app/public/assets/js/app.js +1 -1
- data/lib/wikimd/app/views/edit.slim +8 -0
- data/lib/wikimd/app/views/file.slim +5 -3
- data/lib/wikimd/repository.rb +24 -1
- data/lib/wikimd/version.rb +1 -1
- metadata +3 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 8c3d12592d2ddaa5e9bbc6e5bd1cbb7ccbd99adb
         | 
| 4 | 
            +
              data.tar.gz: 5ef29121046a9c4be842660f21e2a19f3c3c88ae
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 788e37a8236313bf065d438f67955831910a4b8615f4e01241e61d0a4bec618448555926f0c7699beb09a173267f8b779c4b3188a062d3ee8bc02fee6d3b9199
         | 
| 7 | 
            +
              data.tar.gz: 6f2143d6a1e9de98ea4f29950b2ff31dc6f28f9528cdcf13ad0e17eedc1df2f634008432c244e19d8aec28d5069d8036bd33ce62485f491b951cdd24984154d8
         | 
    
        data/lib/wikimd/app.rb
    CHANGED
    
    | @@ -29,6 +29,7 @@ module WikiMD | |
| 29 29 |  | 
| 30 30 | 
             
                  set :fs_created, Time.new(0)
         | 
| 31 31 | 
             
                  set :fs, nil
         | 
| 32 | 
            +
                  set(:repo) { WikiMD::Repository.new(settings.repo_path) }
         | 
| 32 33 | 
             
                end
         | 
| 33 34 |  | 
| 34 35 | 
             
                # :nocov:
         | 
| @@ -69,6 +70,19 @@ module WikiMD | |
| 69 70 | 
             
                    url('/h/' + path)
         | 
| 70 71 | 
             
                  end
         | 
| 71 72 |  | 
| 73 | 
            +
                  # URL helper for the Edit page of a document
         | 
| 74 | 
            +
                  #
         | 
| 75 | 
            +
                  # @param path [String] relative path of the document in the Repository
         | 
| 76 | 
            +
                  # @return [String] full URI to the edit page
         | 
| 77 | 
            +
                  def edit_path(path)
         | 
| 78 | 
            +
                    url('/e/' + path)
         | 
| 79 | 
            +
                  end
         | 
| 80 | 
            +
             | 
| 81 | 
            +
                  # CSS class for a diff line
         | 
| 82 | 
            +
                  #
         | 
| 83 | 
            +
                  # @param line [String] the line in question
         | 
| 84 | 
            +
                  # @return [String] "addition", if the line starts with "+", "removal" if
         | 
| 85 | 
            +
                  #   the line starts with "-", nil otherwise.
         | 
| 72 86 | 
             
                  def class_for_diff(line)
         | 
| 73 87 | 
             
                    case line[0]
         | 
| 74 88 | 
             
                    when '+'
         | 
| @@ -81,7 +95,7 @@ module WikiMD | |
| 81 95 |  | 
| 82 96 | 
             
                # If no route matches, render the 404 page
         | 
| 83 97 | 
             
                not_found do
         | 
| 84 | 
            -
                  @path = env['PATH_INFO'].sub( | 
| 98 | 
            +
                  @path = env['PATH_INFO'].sub(%r{^/([ceh]/)?}, '')
         | 
| 85 99 | 
             
                  slim :'404'
         | 
| 86 100 | 
             
                end
         | 
| 87 101 |  | 
| @@ -120,10 +134,32 @@ module WikiMD | |
| 120 134 | 
             
                # History Page
         | 
| 121 135 | 
             
                get '/h/*' do |path|
         | 
| 122 136 | 
             
                  @path = path
         | 
| 123 | 
            -
                   | 
| 137 | 
            +
                  begin
         | 
| 138 | 
            +
                    @history = repo.history(@path)
         | 
| 139 | 
            +
                  rescue WikiMD::Repository::GitError
         | 
| 140 | 
            +
                    @history = []
         | 
| 141 | 
            +
                  end
         | 
| 124 142 | 
             
                  slim :history
         | 
| 125 143 | 
             
                end
         | 
| 126 144 |  | 
| 145 | 
            +
                # Update
         | 
| 146 | 
            +
                post '/e/*' do |path|
         | 
| 147 | 
            +
                  repo.update(path, params[:content])
         | 
| 148 | 
            +
                  session[:flash] = { 'info' => "'#{path}' has been saved!" }
         | 
| 149 | 
            +
                  redirect to(path)
         | 
| 150 | 
            +
                end
         | 
| 151 | 
            +
             | 
| 152 | 
            +
                # Edit page
         | 
| 153 | 
            +
                get '/e/*' do |path|
         | 
| 154 | 
            +
                  begin
         | 
| 155 | 
            +
                    @content = repo.read(path)
         | 
| 156 | 
            +
                  rescue WikiMD::Repository::FileNotFound
         | 
| 157 | 
            +
                    pass
         | 
| 158 | 
            +
                  end
         | 
| 159 | 
            +
                  @path = path
         | 
| 160 | 
            +
                  slim :edit
         | 
| 161 | 
            +
                end
         | 
| 162 | 
            +
             | 
| 127 163 | 
             
                # Document Page
         | 
| 128 164 | 
             
                get '/*' do |path|
         | 
| 129 165 | 
             
                  begin
         | 
| @@ -132,7 +168,6 @@ module WikiMD | |
| 132 168 | 
             
                    pass
         | 
| 133 169 | 
             
                  end
         | 
| 134 170 | 
             
                  @path = path
         | 
| 135 | 
            -
                  session[:test] = path
         | 
| 136 171 | 
             
                  @extension = (m = path.match(/(?:\.)([^.]+)$/)) ? m[1].downcase : ''
         | 
| 137 172 | 
             
                  slim :file
         | 
| 138 173 | 
             
                end
         | 
| @@ -146,7 +181,7 @@ module WikiMD | |
| 146 181 |  | 
| 147 182 | 
             
                # create or return Repository
         | 
| 148 183 | 
             
                def repo
         | 
| 149 | 
            -
                   | 
| 184 | 
            +
                  settings.repo
         | 
| 150 185 | 
             
                end
         | 
| 151 186 |  | 
| 152 187 | 
             
                # create or return the Search Index
         | 
| @@ -1 +1 @@ | |
| 1 | 
            -
            /*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:bold}dfn{font-style:italic}h1{font-size:2em;margin:0.67em 0}mark{background:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-0.5em}sub{bottom:-0.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{box-sizing:content-box;height:0}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace, monospace;font-size:1em}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0}button{overflow:visible}button,select{text-transform:none}button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}input{line-height:normal}input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0}input[type="number"]::-webkit-inner-spin-button,input[type="number"]::-webkit-outer-spin-button{height:auto}input[type="search"]{-webkit-appearance:textfield;box-sizing:content-box}input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none}fieldset{border:1px solid #c0c0c0;margin:0 2px;padding:0.35em 0.625em 0.75em}legend{border:0;padding:0}textarea{overflow:auto}optgroup{font-weight:bold}table{border-collapse:collapse;border-spacing:0}td,th{padding:0}.highlight table td{padding:5px}.highlight table pre{margin:0}.highlight .cm{color:#999988;font-style:italic}.highlight .cp{color:#999999;font-weight:bold}.highlight .c1{color:#999988;font-style:italic}.highlight .cs{color:#999999;font-weight:bold;font-style:italic}.highlight .c,.highlight .cd{color:#999988;font-style:italic}.highlight .err{color:#a61717;background-color:#e3d2d2}.highlight .gd{color:#000000;background-color:#ffdddd}.highlight .ge{color:#000000;font-style:italic}.highlight .gr{color:#aa0000}.highlight .gh{color:#999999}.highlight .gi{color:#000000;background-color:#ddffdd}.highlight .go{color:#888888}.highlight .gp{color:#555555}.highlight .gs{font-weight:bold}.highlight .gu{color:#aaaaaa}.highlight .gt{color:#aa0000}.highlight .kc{color:#000000;font-weight:bold}.highlight .kd{color:#000000;font-weight:bold}.highlight .kn{color:#000000;font-weight:bold}.highlight .kp{color:#000000;font-weight:bold}.highlight .kr{color:#000000;font-weight:bold}.highlight .kt{color:#445588;font-weight:bold}.highlight .k,.highlight .kv{color:#000000;font-weight:bold}.highlight .mf{color:#009999}.highlight .mh{color:#009999}.highlight .il{color:#009999}.highlight .mi{color:#009999}.highlight .mo{color:#009999}.highlight .m,.highlight .mb,.highlight .mx{color:#009999}.highlight .sb{color:#d14}.highlight .sc{color:#d14}.highlight .sd{color:#d14}.highlight .s2{color:#d14}.highlight .se{color:#d14}.highlight .sh{color:#d14}.highlight .si{color:#d14}.highlight .sx{color:#d14}.highlight .sr{color:#009926}.highlight .s1{color:#d14}.highlight .ss{color:#990073}.highlight .s{color:#d14}.highlight .na{color:#008080}.highlight .bp{color:#999999}.highlight .nb{color:#0086B3}.highlight .nc{color:#445588;font-weight:bold}.highlight .no{color:#008080}.highlight .nd{color:#3c5d5d;font-weight:bold}.highlight .ni{color:#800080}.highlight .ne{color:#990000;font-weight:bold}.highlight .nf{color:#990000;font-weight:bold}.highlight .nl{color:#990000;font-weight:bold}.highlight .nn{color:#555555}.highlight .nt{color:#000080}.highlight .vc{color:#008080}.highlight .vg{color:#008080}.highlight .vi{color:#008080}.highlight .nv{color:#008080}.highlight .ow{color:#000000;font-weight:bold}.highlight .o{color:#000000;font-weight:bold}.highlight .w{color:#bbbbbb}.highlight{background-color:#f8f8f8}@font-face{font-family:'octicons';src:url("/assets/font/octicons.eot?#iefix&v=396334ee3da78f4302d25c758ae3e3ce5dc3c97d") format("embedded-opentype"),url("/assets/font/octicons.woff?v=396334ee3da78f4302d25c758ae3e3ce5dc3c97d") format("woff"),url("/assets/font/octicons.ttf?v=396334ee3da78f4302d25c758ae3e3ce5dc3c97d") format("truetype"),url("/assets/font/octicons.svg?v=396334ee3da78f4302d25c758ae3e3ce5dc3c97d#octicons") format("svg");font-weight:normal;font-style:normal}.octicon,.mega-octicon{font:normal normal normal 16px/1 octicons;display:inline-block;text-decoration:none;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.mega-octicon{font-size:32px}.octicon-alert:before{content:'\f02d'}.octicon-arrow-down:before{content:'\f03f'}.octicon-arrow-left:before{content:'\f040'}.octicon-arrow-right:before{content:'\f03e'}.octicon-arrow-small-down:before{content:'\f0a0'}.octicon-arrow-small-left:before{content:'\f0a1'}.octicon-arrow-small-right:before{content:'\f071'}.octicon-arrow-small-up:before{content:'\f09f'}.octicon-arrow-up:before{content:'\f03d'}.octicon-microscope:before,.octicon-beaker:before{content:'\f0dd'}.octicon-bell:before{content:'\f0de'}.octicon-book:before{content:'\f007'}.octicon-bookmark:before{content:'\f07b'}.octicon-briefcase:before{content:'\f0d3'}.octicon-broadcast:before{content:'\f048'}.octicon-browser:before{content:'\f0c5'}.octicon-bug:before{content:'\f091'}.octicon-calendar:before{content:'\f068'}.octicon-check:before{content:'\f03a'}.octicon-checklist:before{content:'\f076'}.octicon-chevron-down:before{content:'\f0a3'}.octicon-chevron-left:before{content:'\f0a4'}.octicon-chevron-right:before{content:'\f078'}.octicon-chevron-up:before{content:'\f0a2'}.octicon-circle-slash:before{content:'\f084'}.octicon-circuit-board:before{content:'\f0d6'}.octicon-clippy:before{content:'\f035'}.octicon-clock:before{content:'\f046'}.octicon-cloud-download:before{content:'\f00b'}.octicon-cloud-upload:before{content:'\f00c'}.octicon-code:before{content:'\f05f'}.octicon-color-mode:before{content:'\f065'}.octicon-comment-add:before,.octicon-comment:before{content:'\f02b'}.octicon-comment-discussion:before{content:'\f04f'}.octicon-credit-card:before{content:'\f045'}.octicon-dash:before{content:'\f0ca'}.octicon-dashboard:before{content:'\f07d'}.octicon-database:before{content:'\f096'}.octicon-clone:before,.octicon-desktop-download:before{content:'\f0dc'}.octicon-device-camera:before{content:'\f056'}.octicon-device-camera-video:before{content:'\f057'}.octicon-device-desktop:before{content:'\f27c'}.octicon-device-mobile:before{content:'\f038'}.octicon-diff:before{content:'\f04d'}.octicon-diff-added:before{content:'\f06b'}.octicon-diff-ignored:before{content:'\f099'}.octicon-diff-modified:before{content:'\f06d'}.octicon-diff-removed:before{content:'\f06c'}.octicon-diff-renamed:before{content:'\f06e'}.octicon-ellipsis:before{content:'\f09a'}.octicon-eye-unwatch:before,.octicon-eye-watch:before,.octicon-eye:before{content:'\f04e'}.octicon-file-binary:before{content:'\f094'}.octicon-file-code:before{content:'\f010'}.octicon-file-directory:before{content:'\f016'}.octicon-file-media:before{content:'\f012'}.octicon-file-pdf:before{content:'\f014'}.octicon-file-submodule:before{content:'\f017'}.octicon-file-symlink-directory:before{content:'\f0b1'}.octicon-file-symlink-file:before{content:'\f0b0'}.octicon-file-text:before{content:'\f011'}.octicon-file-zip:before{content:'\f013'}.octicon-flame:before{content:'\f0d2'}.octicon-fold:before{content:'\f0cc'}.octicon-gear:before{content:'\f02f'}.octicon-gift:before{content:'\f042'}.octicon-gist:before{content:'\f00e'}.octicon-gist-secret:before{content:'\f08c'}.octicon-git-branch-create:before,.octicon-git-branch-delete:before,.octicon-git-branch:before{content:'\f020'}.octicon-git-commit:before{content:'\f01f'}.octicon-git-compare:before{content:'\f0ac'}.octicon-git-merge:before{content:'\f023'}.octicon-git-pull-request-abandoned:before,.octicon-git-pull-request:before{content:'\f009'}.octicon-globe:before{content:'\f0b6'}.octicon-graph:before{content:'\f043'}.octicon-heart:before{content:'\2665'}.octicon-history:before{content:'\f07e'}.octicon-home:before{content:'\f08d'}.octicon-horizontal-rule:before{content:'\f070'}.octicon-hubot:before{content:'\f09d'}.octicon-inbox:before{content:'\f0cf'}.octicon-info:before{content:'\f059'}.octicon-issue-closed:before{content:'\f028'}.octicon-issue-opened:before{content:'\f026'}.octicon-issue-reopened:before{content:'\f027'}.octicon-jersey:before{content:'\f019'}.octicon-key:before{content:'\f049'}.octicon-keyboard:before{content:'\f00d'}.octicon-law:before{content:'\f0d8'}.octicon-light-bulb:before{content:'\f000'}.octicon-link:before{content:'\f05c'}.octicon-link-external:before{content:'\f07f'}.octicon-list-ordered:before{content:'\f062'}.octicon-list-unordered:before{content:'\f061'}.octicon-location:before{content:'\f060'}.octicon-gist-private:before,.octicon-mirror-private:before,.octicon-git-fork-private:before,.octicon-lock:before{content:'\f06a'}.octicon-logo-github:before{content:'\f092'}.octicon-mail:before{content:'\f03b'}.octicon-mail-read:before{content:'\f03c'}.octicon-mail-reply:before{content:'\f051'}.octicon-mark-github:before{content:'\f00a'}.octicon-markdown:before{content:'\f0c9'}.octicon-megaphone:before{content:'\f077'}.octicon-mention:before{content:'\f0be'}.octicon-milestone:before{content:'\f075'}.octicon-mirror-public:before,.octicon-mirror:before{content:'\f024'}.octicon-mortar-board:before{content:'\f0d7'}.octicon-mute:before{content:'\f080'}.octicon-no-newline:before{content:'\f09c'}.octicon-octoface:before{content:'\f008'}.octicon-organization:before{content:'\f037'}.octicon-package:before{content:'\f0c4'}.octicon-paintcan:before{content:'\f0d1'}.octicon-pencil:before{content:'\f058'}.octicon-person-add:before,.octicon-person-follow:before,.octicon-person:before{content:'\f018'}.octicon-pin:before{content:'\f041'}.octicon-plug:before{content:'\f0d4'}.octicon-repo-create:before,.octicon-gist-new:before,.octicon-file-directory-create:before,.octicon-file-add:before,.octicon-plus:before{content:'\f05d'}.octicon-primitive-dot:before{content:'\f052'}.octicon-primitive-square:before{content:'\f053'}.octicon-pulse:before{content:'\f085'}.octicon-question:before{content:'\f02c'}.octicon-quote:before{content:'\f063'}.octicon-radio-tower:before{content:'\f030'}.octicon-repo-delete:before,.octicon-repo:before{content:'\f001'}.octicon-repo-clone:before{content:'\f04c'}.octicon-repo-force-push:before{content:'\f04a'}.octicon-gist-fork:before,.octicon-repo-forked:before{content:'\f002'}.octicon-repo-pull:before{content:'\f006'}.octicon-repo-push:before{content:'\f005'}.octicon-rocket:before{content:'\f033'}.octicon-rss:before{content:'\f034'}.octicon-ruby:before{content:'\f047'}.octicon-screen-full:before{content:'\f066'}.octicon-screen-normal:before{content:'\f067'}.octicon-search-save:before,.octicon-search:before{content:'\f02e'}.octicon-server:before{content:'\f097'}.octicon-settings:before{content:'\f07c'}.octicon-shield:before{content:'\f0e1'}.octicon-log-in:before,.octicon-sign-in:before{content:'\f036'}.octicon-log-out:before,.octicon-sign-out:before{content:'\f032'}.octicon-squirrel:before{content:'\f0b2'}.octicon-star-add:before,.octicon-star-delete:before,.octicon-star:before{content:'\f02a'}.octicon-stop:before{content:'\f08f'}.octicon-repo-sync:before,.octicon-sync:before{content:'\f087'}.octicon-tag-remove:before,.octicon-tag-add:before,.octicon-tag:before{content:'\f015'}.octicon-telescope:before{content:'\f088'}.octicon-terminal:before{content:'\f0c8'}.octicon-three-bars:before{content:'\f05e'}.octicon-thumbsdown:before{content:'\f0db'}.octicon-thumbsup:before{content:'\f0da'}.octicon-tools:before{content:'\f031'}.octicon-trashcan:before{content:'\f0d0'}.octicon-triangle-down:before{content:'\f05b'}.octicon-triangle-left:before{content:'\f044'}.octicon-triangle-right:before{content:'\f05a'}.octicon-triangle-up:before{content:'\f0aa'}.octicon-unfold:before{content:'\f039'}.octicon-unmute:before{content:'\f0ba'}.octicon-versions:before{content:'\f064'}.octicon-watch:before{content:'\f0e0'}.octicon-remove-close:before,.octicon-x:before{content:'\f081'}.octicon-zap:before{content:'\26A1'}*{box-sizing:border-box}hr{display:block;height:1px;border:0;border-top:1px solid #ccc;margin:1em 0;padding:0}body{font-family:"Helvetica Neue", Helvetica, Arial, sans-serif;font-size:16px;line-height:1.5;font-weight:300;color:#444;background-color:#f2f2f2}h1,h2,h3,h4,h5,h6{color:#444;margin-top:20px;margin-bottom:10px;font-weight:600}h1{font-size:32px;border-bottom:1px solid #ccc}h1 small{color:#919191}p{margin-bottom:10px}a,a:visited{color:#2798dd;text-decoration:none;font-weight:600}code{color:#000;background:#f8f8f8;border:1px solid #e5e5e5;border-radius:3px}pre code{border:none}button{border-radius:0;background:#2798dd;color:#fff;border:1px solid #1c7bb5;box-shadow:0 2px 2px rgba(0,0,0,0.2)}.lead{font-size:1.25rem}.topbar{position:fixed;top:0;right:0;left:0;z-index:999;height:56px;background:#2798dd;box-shadow:0 0 4px rgba(0,0,0,0.14),0 4px 8px rgba(0,0,0,0.28)}.brand{color:#fff;display:inline-block;float:left;font-weight:normal;font-weight:100;letter-spacing:1px;font-size:32px;height:56px;line-height:56px;margin:0;margin-left:24px;padding:0;border:none}.brand:link,.brand:visited{color:#fff}.search{display:block;margin-left:300px;margin-right:30px;height:56px}#search{height:36px;margin:10px 0;padding:7px 8px;line-height:22px;font-size:22px;width:100%;background:#208acb;border:none;outline:none;border-radius:0;box-shadow:none;color:#fff}#search::-webkit-input-placeholder{color:#fff}#search:-moz-placeholder{color:#fff;opacity:1}#search::-moz-placeholder{color:#fff;opacity:1}#search:-ms-input-placeholder{color:#fff}.sidebar{width:300px;height:100%;box-sizing:border-box;padding:16px 8px 0 24px;padding-top:72px;float:left;position:fixed;overflow:auto}.sidebar>ul{list-style:none;padding:0 0 8px 0}.sidebar .title{font-weight:bold;text-transform:uppercase}.sidebar .tree{overflow:auto}.sidebar footer{margin-top:120px;text-align:center;color:#ccc}.sidebar footer a,.sidebar footer a:visited{font-weight:bold;color:#aaa}.sidebar footer a:hover{color:#888}.sidebar footer ul{list-style:none;padding:0}.sidebar footer li{display:inline-block;margin-right:32px}.tree-view{padding-left:0;list-style:none}.tree-view .entry .tree-view{padding-left:16px}.tree-view .directory.collapsed>ul{display:none}.tree-view .entry{white-space:nowrap}.tree-view .entry>a{display:inline-block;width:100%;font-weight:normal}.tree-view .entry:before{font:normal normal normal 16px/1 octicons;display:inline-block;text-decoration:none;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;white-space:nowrap;width:16px;content:' '}.tree-view .entry.collapsed:before{content:'\f078'}.tree-view .entry.expanded:before{content:'\f0a3'}.tree-view .entry.directory{cursor:pointer}.tree-view .entry>:before{font:normal normal normal 16px/1 octicons;display:inline-block;text-decoration:none;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;white-space:nowrap;width:16px;margin-right:4px}.tree-view .entry>a:before{content:""}.tree-view .entry.directory>span:before{content:'\f016'}.tree-view .entry.current a{font-weight:bold;background:#e8e8e8}main{padding-left:300px;padding-top:56px}.content{margin:30px;margin-left:0;padding:30px;background:#fff;box-shadow:0 0 5px rgba(0,0,0,0.1);border:1px solid #ddd}.content h1:first-of-type{margin-top:0}.highlight{background-color:#f8f8f8;padding:10px;border-radius:4px}.actions{text-align:right;margin-bottom:-24px}.alert{border:1px solid;padding:8px 16px}.alert-info{color:#5d8915;background-color:#c2eb7f;border-color:#3f5c0f}.alert-error{color:#89155d;background-color:#eb7fc2;border-color:#5c0f3f}.history{border:1px solid #bbb;padding:0;list-style:none}.history li{border-bottom:1px solid #bbb;padding:8px 16px}.history li:last-child{border:none}.history input[type='checkbox']{margin-right:8px}.history .rev{display:inline-block;width:80px}.history .date{display:inline-block;width:160px}.diff{width:100%;overflow-x:hidden;font-family:monospace;border:1px solid #ccc;margin:10px 0;background:#eee}.diff th{text-align:left;border-bottom:1px solid #ccc;background:#ddd;padding:4px}.diff tr td:first-child{width:24px;text-align:center;vertical-align:top}.addition{background:#ccffcc;color:#060;border-color:#060}.removal{background:#ffcccc;color:#600;border-color:#600}a.addition,a.removal{padding-left:4px;padding-right:4px;font-weight:normal;font-family:monospace;border:1px solid;border-radius:3px}
         | 
| 1 | 
            +
            /*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:bold}dfn{font-style:italic}h1{font-size:2em;margin:0.67em 0}mark{background:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-0.5em}sub{bottom:-0.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{box-sizing:content-box;height:0}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace, monospace;font-size:1em}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0;outline:none}button{overflow:visible}button,select{text-transform:none}button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}input{line-height:normal}input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0}input[type="number"]::-webkit-inner-spin-button,input[type="number"]::-webkit-outer-spin-button{height:auto}input[type="search"]{-webkit-appearance:textfield;box-sizing:content-box}input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none}fieldset{border:1px solid #c0c0c0;margin:0 2px;padding:0.35em 0.625em 0.75em}legend{border:0;padding:0}textarea{overflow:auto}optgroup{font-weight:bold}table{border-collapse:collapse;border-spacing:0}td,th{padding:0}.highlight table td{padding:5px}.highlight table pre{margin:0}.highlight .cm{color:#999988;font-style:italic}.highlight .cp{color:#999999;font-weight:bold}.highlight .c1{color:#999988;font-style:italic}.highlight .cs{color:#999999;font-weight:bold;font-style:italic}.highlight .c,.highlight .cd{color:#999988;font-style:italic}.highlight .err{color:#a61717;background-color:#e3d2d2}.highlight .gd{color:#000000;background-color:#ffdddd}.highlight .ge{color:#000000;font-style:italic}.highlight .gr{color:#aa0000}.highlight .gh{color:#999999}.highlight .gi{color:#000000;background-color:#ddffdd}.highlight .go{color:#888888}.highlight .gp{color:#555555}.highlight .gs{font-weight:bold}.highlight .gu{color:#aaaaaa}.highlight .gt{color:#aa0000}.highlight .kc{color:#000000;font-weight:bold}.highlight .kd{color:#000000;font-weight:bold}.highlight .kn{color:#000000;font-weight:bold}.highlight .kp{color:#000000;font-weight:bold}.highlight .kr{color:#000000;font-weight:bold}.highlight .kt{color:#445588;font-weight:bold}.highlight .k,.highlight .kv{color:#000000;font-weight:bold}.highlight .mf{color:#009999}.highlight .mh{color:#009999}.highlight .il{color:#009999}.highlight .mi{color:#009999}.highlight .mo{color:#009999}.highlight .m,.highlight .mb,.highlight .mx{color:#009999}.highlight .sb{color:#d14}.highlight .sc{color:#d14}.highlight .sd{color:#d14}.highlight .s2{color:#d14}.highlight .se{color:#d14}.highlight .sh{color:#d14}.highlight .si{color:#d14}.highlight .sx{color:#d14}.highlight .sr{color:#009926}.highlight .s1{color:#d14}.highlight .ss{color:#990073}.highlight .s{color:#d14}.highlight .na{color:#008080}.highlight .bp{color:#999999}.highlight .nb{color:#0086B3}.highlight .nc{color:#445588;font-weight:bold}.highlight .no{color:#008080}.highlight .nd{color:#3c5d5d;font-weight:bold}.highlight .ni{color:#800080}.highlight .ne{color:#990000;font-weight:bold}.highlight .nf{color:#990000;font-weight:bold}.highlight .nl{color:#990000;font-weight:bold}.highlight .nn{color:#555555}.highlight .nt{color:#000080}.highlight .vc{color:#008080}.highlight .vg{color:#008080}.highlight .vi{color:#008080}.highlight .nv{color:#008080}.highlight .ow{color:#000000;font-weight:bold}.highlight .o{color:#000000;font-weight:bold}.highlight .w{color:#bbbbbb}.highlight{background-color:#f8f8f8}@font-face{font-family:'octicons';src:url("/assets/font/octicons.eot?#iefix&v=396334ee3da78f4302d25c758ae3e3ce5dc3c97d") format("embedded-opentype"),url("/assets/font/octicons.woff?v=396334ee3da78f4302d25c758ae3e3ce5dc3c97d") format("woff"),url("/assets/font/octicons.ttf?v=396334ee3da78f4302d25c758ae3e3ce5dc3c97d") format("truetype"),url("/assets/font/octicons.svg?v=396334ee3da78f4302d25c758ae3e3ce5dc3c97d#octicons") format("svg");font-weight:normal;font-style:normal}.octicon,.mega-octicon{font:normal normal normal 16px/1 octicons;display:inline-block;text-decoration:none;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.mega-octicon{font-size:32px}.octicon-alert:before{content:'\f02d'}.octicon-arrow-down:before{content:'\f03f'}.octicon-arrow-left:before{content:'\f040'}.octicon-arrow-right:before{content:'\f03e'}.octicon-arrow-small-down:before{content:'\f0a0'}.octicon-arrow-small-left:before{content:'\f0a1'}.octicon-arrow-small-right:before{content:'\f071'}.octicon-arrow-small-up:before{content:'\f09f'}.octicon-arrow-up:before{content:'\f03d'}.octicon-microscope:before,.octicon-beaker:before{content:'\f0dd'}.octicon-bell:before{content:'\f0de'}.octicon-book:before{content:'\f007'}.octicon-bookmark:before{content:'\f07b'}.octicon-briefcase:before{content:'\f0d3'}.octicon-broadcast:before{content:'\f048'}.octicon-browser:before{content:'\f0c5'}.octicon-bug:before{content:'\f091'}.octicon-calendar:before{content:'\f068'}.octicon-check:before{content:'\f03a'}.octicon-checklist:before{content:'\f076'}.octicon-chevron-down:before{content:'\f0a3'}.octicon-chevron-left:before{content:'\f0a4'}.octicon-chevron-right:before{content:'\f078'}.octicon-chevron-up:before{content:'\f0a2'}.octicon-circle-slash:before{content:'\f084'}.octicon-circuit-board:before{content:'\f0d6'}.octicon-clippy:before{content:'\f035'}.octicon-clock:before{content:'\f046'}.octicon-cloud-download:before{content:'\f00b'}.octicon-cloud-upload:before{content:'\f00c'}.octicon-code:before{content:'\f05f'}.octicon-color-mode:before{content:'\f065'}.octicon-comment-add:before,.octicon-comment:before{content:'\f02b'}.octicon-comment-discussion:before{content:'\f04f'}.octicon-credit-card:before{content:'\f045'}.octicon-dash:before{content:'\f0ca'}.octicon-dashboard:before{content:'\f07d'}.octicon-database:before{content:'\f096'}.octicon-clone:before,.octicon-desktop-download:before{content:'\f0dc'}.octicon-device-camera:before{content:'\f056'}.octicon-device-camera-video:before{content:'\f057'}.octicon-device-desktop:before{content:'\f27c'}.octicon-device-mobile:before{content:'\f038'}.octicon-diff:before{content:'\f04d'}.octicon-diff-added:before{content:'\f06b'}.octicon-diff-ignored:before{content:'\f099'}.octicon-diff-modified:before{content:'\f06d'}.octicon-diff-removed:before{content:'\f06c'}.octicon-diff-renamed:before{content:'\f06e'}.octicon-ellipsis:before{content:'\f09a'}.octicon-eye-unwatch:before,.octicon-eye-watch:before,.octicon-eye:before{content:'\f04e'}.octicon-file-binary:before{content:'\f094'}.octicon-file-code:before{content:'\f010'}.octicon-file-directory:before{content:'\f016'}.octicon-file-media:before{content:'\f012'}.octicon-file-pdf:before{content:'\f014'}.octicon-file-submodule:before{content:'\f017'}.octicon-file-symlink-directory:before{content:'\f0b1'}.octicon-file-symlink-file:before{content:'\f0b0'}.octicon-file-text:before{content:'\f011'}.octicon-file-zip:before{content:'\f013'}.octicon-flame:before{content:'\f0d2'}.octicon-fold:before{content:'\f0cc'}.octicon-gear:before{content:'\f02f'}.octicon-gift:before{content:'\f042'}.octicon-gist:before{content:'\f00e'}.octicon-gist-secret:before{content:'\f08c'}.octicon-git-branch-create:before,.octicon-git-branch-delete:before,.octicon-git-branch:before{content:'\f020'}.octicon-git-commit:before{content:'\f01f'}.octicon-git-compare:before{content:'\f0ac'}.octicon-git-merge:before{content:'\f023'}.octicon-git-pull-request-abandoned:before,.octicon-git-pull-request:before{content:'\f009'}.octicon-globe:before{content:'\f0b6'}.octicon-graph:before{content:'\f043'}.octicon-heart:before{content:'\2665'}.octicon-history:before{content:'\f07e'}.octicon-home:before{content:'\f08d'}.octicon-horizontal-rule:before{content:'\f070'}.octicon-hubot:before{content:'\f09d'}.octicon-inbox:before{content:'\f0cf'}.octicon-info:before{content:'\f059'}.octicon-issue-closed:before{content:'\f028'}.octicon-issue-opened:before{content:'\f026'}.octicon-issue-reopened:before{content:'\f027'}.octicon-jersey:before{content:'\f019'}.octicon-key:before{content:'\f049'}.octicon-keyboard:before{content:'\f00d'}.octicon-law:before{content:'\f0d8'}.octicon-light-bulb:before{content:'\f000'}.octicon-link:before{content:'\f05c'}.octicon-link-external:before{content:'\f07f'}.octicon-list-ordered:before{content:'\f062'}.octicon-list-unordered:before{content:'\f061'}.octicon-location:before{content:'\f060'}.octicon-gist-private:before,.octicon-mirror-private:before,.octicon-git-fork-private:before,.octicon-lock:before{content:'\f06a'}.octicon-logo-github:before{content:'\f092'}.octicon-mail:before{content:'\f03b'}.octicon-mail-read:before{content:'\f03c'}.octicon-mail-reply:before{content:'\f051'}.octicon-mark-github:before{content:'\f00a'}.octicon-markdown:before{content:'\f0c9'}.octicon-megaphone:before{content:'\f077'}.octicon-mention:before{content:'\f0be'}.octicon-milestone:before{content:'\f075'}.octicon-mirror-public:before,.octicon-mirror:before{content:'\f024'}.octicon-mortar-board:before{content:'\f0d7'}.octicon-mute:before{content:'\f080'}.octicon-no-newline:before{content:'\f09c'}.octicon-octoface:before{content:'\f008'}.octicon-organization:before{content:'\f037'}.octicon-package:before{content:'\f0c4'}.octicon-paintcan:before{content:'\f0d1'}.octicon-pencil:before{content:'\f058'}.octicon-person-add:before,.octicon-person-follow:before,.octicon-person:before{content:'\f018'}.octicon-pin:before{content:'\f041'}.octicon-plug:before{content:'\f0d4'}.octicon-repo-create:before,.octicon-gist-new:before,.octicon-file-directory-create:before,.octicon-file-add:before,.octicon-plus:before{content:'\f05d'}.octicon-primitive-dot:before{content:'\f052'}.octicon-primitive-square:before{content:'\f053'}.octicon-pulse:before{content:'\f085'}.octicon-question:before{content:'\f02c'}.octicon-quote:before{content:'\f063'}.octicon-radio-tower:before{content:'\f030'}.octicon-repo-delete:before,.octicon-repo:before{content:'\f001'}.octicon-repo-clone:before{content:'\f04c'}.octicon-repo-force-push:before{content:'\f04a'}.octicon-gist-fork:before,.octicon-repo-forked:before{content:'\f002'}.octicon-repo-pull:before{content:'\f006'}.octicon-repo-push:before{content:'\f005'}.octicon-rocket:before{content:'\f033'}.octicon-rss:before{content:'\f034'}.octicon-ruby:before{content:'\f047'}.octicon-screen-full:before{content:'\f066'}.octicon-screen-normal:before{content:'\f067'}.octicon-search-save:before,.octicon-search:before{content:'\f02e'}.octicon-server:before{content:'\f097'}.octicon-settings:before{content:'\f07c'}.octicon-shield:before{content:'\f0e1'}.octicon-log-in:before,.octicon-sign-in:before{content:'\f036'}.octicon-log-out:before,.octicon-sign-out:before{content:'\f032'}.octicon-squirrel:before{content:'\f0b2'}.octicon-star-add:before,.octicon-star-delete:before,.octicon-star:before{content:'\f02a'}.octicon-stop:before{content:'\f08f'}.octicon-repo-sync:before,.octicon-sync:before{content:'\f087'}.octicon-tag-remove:before,.octicon-tag-add:before,.octicon-tag:before{content:'\f015'}.octicon-telescope:before{content:'\f088'}.octicon-terminal:before{content:'\f0c8'}.octicon-three-bars:before{content:'\f05e'}.octicon-thumbsdown:before{content:'\f0db'}.octicon-thumbsup:before{content:'\f0da'}.octicon-tools:before{content:'\f031'}.octicon-trashcan:before{content:'\f0d0'}.octicon-triangle-down:before{content:'\f05b'}.octicon-triangle-left:before{content:'\f044'}.octicon-triangle-right:before{content:'\f05a'}.octicon-triangle-up:before{content:'\f0aa'}.octicon-unfold:before{content:'\f039'}.octicon-unmute:before{content:'\f0ba'}.octicon-versions:before{content:'\f064'}.octicon-watch:before{content:'\f0e0'}.octicon-remove-close:before,.octicon-x:before{content:'\f081'}.octicon-zap:before{content:'\26A1'}*{box-sizing:border-box}hr{display:block;height:1px;border:0;border-top:1px solid #ccc;margin:1em 0;padding:0}body{font-family:"Helvetica Neue", Helvetica, Arial, sans-serif;font-size:16px;line-height:1.5;font-weight:300;color:#444;background-color:#f2f2f2}h1,h2,h3,h4,h5,h6{color:#444;margin-top:20px;margin-bottom:10px;font-weight:600}h1{font-size:32px;border-bottom:1px solid #ccc}h1 small{color:#919191}p{margin-bottom:10px}a,a:visited{color:#2798dd;text-decoration:none;font-weight:600}code{color:#000;background:#f8f8f8;border:1px solid #e5e5e5;border-radius:3px}pre code{border:none}textarea{width:100%;border:1px solid #ccc;border-radius:2px;padding:4px;resize:vertical;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075)}textarea:focus{border:1px solid #2798dd}button,.btn{border-radius:2px;background:#2798dd;color:#fff;background:#2798dd;background:linear-gradient(#53ade4, #2798dd);border:1px solid #1c7bb5;position:relative;z-index:10}button:hover,.btn:hover,button:focus,.btn:focus,button:active,.btn:active{background:#2798dd}button::before,.btn::before{content:"";position:absolute;top:0;bottom:0;left:0;right:0;z-index:9;box-shadow:0 2px 2px rgba(0,0,0,0.2)}.form-actions{text-align:right}.lead{font-size:1.25rem}.topbar{position:fixed;top:0;right:0;left:0;z-index:999;height:56px;background:#2798dd;box-shadow:0 0 4px rgba(0,0,0,0.14),0 4px 8px rgba(0,0,0,0.28)}.brand{color:#fff;display:inline-block;float:left;font-weight:normal;font-weight:100;letter-spacing:1px;font-size:32px;height:56px;line-height:56px;margin:0;margin-left:24px;padding:0;border:none}.brand:link,.brand:visited{color:#fff}.search{display:block;margin-left:300px;margin-right:30px;height:56px}#search{height:36px;margin:10px 0;padding:7px 8px;line-height:22px;font-size:22px;width:100%;background:#208acb;border:none;outline:none;border-radius:0;box-shadow:none;color:#fff}#search::-webkit-input-placeholder{color:#fff}#search:-moz-placeholder{color:#fff;opacity:1}#search::-moz-placeholder{color:#fff;opacity:1}#search:-ms-input-placeholder{color:#fff}.sidebar{width:300px;height:100%;box-sizing:border-box;padding:16px 8px 0 24px;padding-top:72px;float:left;position:fixed;overflow:auto}.sidebar>ul{list-style:none;padding:0 0 8px 0}.sidebar .title{font-weight:bold;text-transform:uppercase}.sidebar .tree{overflow:auto}.sidebar footer{margin-top:120px;text-align:center;color:#ccc}.sidebar footer a,.sidebar footer a:visited{font-weight:bold;color:#aaa}.sidebar footer a:hover{color:#888}.sidebar footer ul{list-style:none;padding:0}.sidebar footer li{display:inline-block;margin-right:32px}.tree-view{padding-left:0;list-style:none}.tree-view .entry .tree-view{padding-left:16px}.tree-view .directory.collapsed>ul{display:none}.tree-view .entry{white-space:nowrap}.tree-view .entry>a{display:inline-block;width:100%;font-weight:normal}.tree-view .entry:before{font:normal normal normal 16px/1 octicons;display:inline-block;text-decoration:none;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;white-space:nowrap;width:16px;content:' '}.tree-view .entry.collapsed:before{content:'\f078'}.tree-view .entry.expanded:before{content:'\f0a3'}.tree-view .entry.directory{cursor:pointer}.tree-view .entry>:before{font:normal normal normal 16px/1 octicons;display:inline-block;text-decoration:none;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;white-space:nowrap;width:16px;margin-right:4px}.tree-view .entry>a:before{content:""}.tree-view .entry.directory>span:before{content:'\f016'}.tree-view .entry.current a{font-weight:bold;background:#e8e8e8}main{padding-left:300px;padding-top:56px}.content{margin:30px;margin-left:0;padding:30px;background:#fff;box-shadow:0 0 5px rgba(0,0,0,0.1);border:1px solid #ddd}.content h1:first-of-type{margin-top:0}.highlight{background-color:#f8f8f8;padding:10px;border-radius:4px}.actions{text-align:right;margin-bottom:-24px}.actions a{border-right:none;color:#fff;font-weight:normal;padding:2px 4px}.actions a:first-of-type{border-top-right-radius:0;border-bottom-right-radius:0}.actions a:last-of-type{border-top-left-radius:0;border-bottom-left-radius:0;border-right:1px solid #1c7bb5}.alert{border:1px solid;padding:8px 16px;margin-bottom:16px}.alert-info{color:#5d8915;background-color:#c2eb7f;border-color:#3f5c0f}.alert-error{color:#89155d;background-color:#eb7fc2;border-color:#5c0f3f}.history{border:1px solid #bbb;padding:0;list-style:none}.history li{border-bottom:1px solid #bbb;padding:8px 16px}.history li:last-child{border:none}.history input[type='checkbox']{margin-right:8px}.history .rev{display:inline-block;width:80px}.history .date{display:inline-block;width:160px}.diff{width:100%;overflow-x:hidden;font-family:monospace;border:1px solid #ccc;margin:10px 0;background:#eee}.diff th{text-align:left;border-bottom:1px solid #ccc;background:#ddd;padding:4px}.diff tr td:first-child{width:24px;text-align:center;vertical-align:top}.addition{background:#ccffcc;color:#060;border-color:#060}.removal{background:#ffcccc;color:#600;border-color:#600}a.addition,a.removal{padding-left:4px;padding-right:4px;font-weight:normal;font-family:monospace;border:1px solid;border-radius:3px}.edit textarea{font-family:monospace;line-height:1.1;font-size:0.9em}
         | 
| @@ -7,7 +7,7 @@ $(document).ready(function() { | |
| 7 7 | 
             
              // collapse all directories
         | 
| 8 8 | 
             
              $('.tree-view > .entry.directory').addClass('collapsed');
         | 
| 9 9 | 
             
              // expand current tree
         | 
| 10 | 
            -
              var path = document.location.pathname.replace(/^\/([ | 
| 10 | 
            +
              var path = document.location.pathname.replace(/^\/([ceh]\/)?/, '');
         | 
| 11 11 | 
             
              var current = $('[data-path="'+path+'"]')
         | 
| 12 12 | 
             
              current.trigger('expand-tree');
         | 
| 13 13 | 
             
              current.addClass('current');
         | 
| @@ -6,10 +6,12 @@ | |
| 6 6 |  | 
| 7 7 |  | 
| 8 8 | 
             
            .actions
         | 
| 9 | 
            -
              a href=history_path(@path)
         | 
| 10 | 
            -
                 | 
| 9 | 
            +
              a.btn href=history_path(@path)
         | 
| 10 | 
            +
                span.octicon.octicon-history>
         | 
| 11 11 | 
             
                | History
         | 
| 12 | 
            -
             | 
| 12 | 
            +
              a.btn href=edit_path(@path)
         | 
| 13 | 
            +
                span.octicon.octicon-pencil>
         | 
| 14 | 
            +
                | Edit
         | 
| 13 15 |  | 
| 14 16 | 
             
            - if TYPE_MARKDOWN.include?(@extension)
         | 
| 15 17 | 
             
              == render_markdown(@content)
         | 
    
        data/lib/wikimd/repository.rb
    CHANGED
    
    | @@ -94,7 +94,7 @@ module WikiMD | |
| 94 94 |  | 
| 95 95 | 
             
                def diff(path, old, new)
         | 
| 96 96 | 
             
                  path = pathname(path)
         | 
| 97 | 
            -
                  raw_diff = git :diff, "-p --no-color #{old} #{new} -- #{path}"
         | 
| 97 | 
            +
                  raw_diff = git :diff, "-p --no-color #{old} #{new} -- #{path.to_s.shellescape}"
         | 
| 98 98 | 
             
                  diff = []
         | 
| 99 99 | 
             
                  raw_diff.each_line do |line|
         | 
| 100 100 | 
             
                    next if line =~ /^(diff|index|\+\+\+|---)/
         | 
| @@ -112,6 +112,29 @@ module WikiMD | |
| 112 112 | 
             
                  diff
         | 
| 113 113 | 
             
                end
         | 
| 114 114 |  | 
| 115 | 
            +
                # Updates the given file with `content`. The file must be present!
         | 
| 116 | 
            +
                #
         | 
| 117 | 
            +
                # @param path [String] absolute path of file to update.
         | 
| 118 | 
            +
                # @param content [String] the new file content
         | 
| 119 | 
            +
                # @raise [FileNotFound] if +file+ doesn't exist within the repo or is a dir
         | 
| 120 | 
            +
                def update(path, content)
         | 
| 121 | 
            +
                  file = pathname(path)
         | 
| 122 | 
            +
             | 
| 123 | 
            +
                  # fail if path is a dir or similar
         | 
| 124 | 
            +
                  fail FileNotFound unless file.file?
         | 
| 125 | 
            +
             | 
| 126 | 
            +
                  # get rid of CRLFs
         | 
| 127 | 
            +
                  content.gsub!(/\r\n?/, "\n")
         | 
| 128 | 
            +
             | 
| 129 | 
            +
                  # don't do anything if the contents are identical
         | 
| 130 | 
            +
                  return if file.read == content
         | 
| 131 | 
            +
             | 
| 132 | 
            +
                  # write, add, commit
         | 
| 133 | 
            +
                  file.write(content)
         | 
| 134 | 
            +
                  git :add, path.shellescape
         | 
| 135 | 
            +
                  git :commit, "-m 'update #{path}' -- #{path.shellescape}"
         | 
| 136 | 
            +
                end
         | 
| 137 | 
            +
             | 
| 115 138 | 
             
                private
         | 
| 116 139 |  | 
| 117 140 | 
             
                def git(cmd, arg)
         | 
    
        data/lib/wikimd/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: wikimd
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.4.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Manuel Hutter
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2015-10- | 
| 11 | 
            +
            date: 2015-10-02 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: fuzzy_set
         | 
| @@ -222,6 +222,7 @@ files: | |
| 222 222 | 
             
            - lib/wikimd/app/public/favicon.ico
         | 
| 223 223 | 
             
            - lib/wikimd/app/views/404.slim
         | 
| 224 224 | 
             
            - lib/wikimd/app/views/diff.slim
         | 
| 225 | 
            +
            - lib/wikimd/app/views/edit.slim
         | 
| 225 226 | 
             
            - lib/wikimd/app/views/file.slim
         | 
| 226 227 | 
             
            - lib/wikimd/app/views/history.slim
         | 
| 227 228 | 
             
            - lib/wikimd/app/views/layout.slim
         |