mirror of
				https://github.com/KevinMidboe/linguist.git
				synced 2025-10-29 17:50:22 +00:00 
			
		
		
		
	Remove file extensions with multiple segments
This commit is contained in:
		
							
								
								
									
										146
									
								
								samples/Clojure/index.cljs.hl
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										146
									
								
								samples/Clojure/index.cljs.hl
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,146 @@
 | 
			
		||||
;; Copyright (c) Alan Dipert and Micha Niskin. All rights reserved.
 | 
			
		||||
;; The use and distribution terms for this software are covered by the
 | 
			
		||||
;; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
 | 
			
		||||
;; which can be found in the file epl-v10.html at the root of this distribution.
 | 
			
		||||
;; By using this software in any fashion, you are agreeing to be bound by
 | 
			
		||||
;; the terms of this license.
 | 
			
		||||
;; You must not remove this notice, or any other, from this software.
 | 
			
		||||
 | 
			
		||||
(page "index.html"
 | 
			
		||||
  (:refer-clojure :exclude [nth])
 | 
			
		||||
  (:require
 | 
			
		||||
   [tailrecursion.hoplon.reload        :refer [reload-all]]
 | 
			
		||||
   [tailrecursion.hoplon.util          :refer [nth name pluralize]]
 | 
			
		||||
   [tailrecursion.hoplon.storage-atom  :refer [local-storage]]))
 | 
			
		||||
 | 
			
		||||
;; utility functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 | 
			
		||||
 | 
			
		||||
(declare route state editing)
 | 
			
		||||
 | 
			
		||||
(reload-all)
 | 
			
		||||
 | 
			
		||||
(def mapvi  (comp vec map-indexed))
 | 
			
		||||
 | 
			
		||||
(defn dissocv [v i]
 | 
			
		||||
  (let [z (- (dec (count v)) i)]
 | 
			
		||||
    (cond (neg?  z) v
 | 
			
		||||
          (zero? z) (pop v)
 | 
			
		||||
          (pos?  z) (into (subvec v 0 i) (subvec v (inc i))))))
 | 
			
		||||
 | 
			
		||||
(defn decorate [todo route editing i]
 | 
			
		||||
  (let [{done? :completed text :text} todo]
 | 
			
		||||
    (-> todo (assoc :editing (= editing i)
 | 
			
		||||
                    :visible (and (not (empty? text))
 | 
			
		||||
                                  (or (= "#/" route)
 | 
			
		||||
                                      (and (= "#/active" route) (not done?))
 | 
			
		||||
                                      (and (= "#/completed" route) done?)))))))
 | 
			
		||||
 | 
			
		||||
;; persisted state cell (AKA: stem cell) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 | 
			
		||||
 | 
			
		||||
(def   state        (-> (cell []) (local-storage ::store)))
 | 
			
		||||
 | 
			
		||||
;; local state cells ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 | 
			
		||||
 | 
			
		||||
(defc  loaded?      false)
 | 
			
		||||
(defc  editing      nil)
 | 
			
		||||
(def   route        (route-cell "#/"))
 | 
			
		||||
 | 
			
		||||
;; formula cells (computed state) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 | 
			
		||||
 | 
			
		||||
(defc= completed    (filter :completed state))
 | 
			
		||||
(defc= active       (remove :completed state))
 | 
			
		||||
(defc= plural-item  (pluralize "item" (count active)))
 | 
			
		||||
(defc= todos        (mapvi #(list %1 (decorate %2 route editing %1)) state))
 | 
			
		||||
 | 
			
		||||
;; state transition functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 | 
			
		||||
 | 
			
		||||
(defn  todo        [t]   {:completed false :text t})
 | 
			
		||||
(defn  destroy!    [i]   (swap! state dissocv i))
 | 
			
		||||
(defn  done!       [i v] (swap! state assoc-in [i :completed] v))
 | 
			
		||||
(defn  clear-done! [& _] (swap! state #(vec (remove :completed %))))
 | 
			
		||||
(defn  new!        [t]   (when (not (empty? t)) (swap! state conj (todo t))))
 | 
			
		||||
(defn  all-done!   [v]   (swap! state #(mapv (fn [x] (assoc x :completed v)) %)))
 | 
			
		||||
(defn  editing!    [i v] (reset! editing (if v i nil)))
 | 
			
		||||
(defn  text!       [i v] (if (empty? v) (destroy! i) (swap! state assoc-in [i :text] v)))
 | 
			
		||||
 | 
			
		||||
;; page ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 | 
			
		||||
 | 
			
		||||
(html :lang "en"
 | 
			
		||||
  (head
 | 
			
		||||
    (meta :charset "utf-8")
 | 
			
		||||
    (meta :http-equiv "X-UA-Compatible" :content "IE=edge,chrome=1")
 | 
			
		||||
    (link :rel "stylesheet" :href "base.css")
 | 
			
		||||
    (title "Hoplon • TodoMVC"))
 | 
			
		||||
  (body
 | 
			
		||||
    (noscript
 | 
			
		||||
      (div :id "noscript"
 | 
			
		||||
        (p "JavaScript is required to view this page.")))
 | 
			
		||||
    (div
 | 
			
		||||
      (section :id "todoapp"
 | 
			
		||||
        (header :id "header"
 | 
			
		||||
          (h1 "todos")
 | 
			
		||||
          (form :on-submit #(do (new! (val-id :new-todo))
 | 
			
		||||
                                (do! (by-id :new-todo) :value ""))
 | 
			
		||||
            (input
 | 
			
		||||
              :id "new-todo"
 | 
			
		||||
              :type "text"
 | 
			
		||||
              :autofocus true
 | 
			
		||||
              :placeholder "What needs to be done?"
 | 
			
		||||
              :on-blur #(do! (by-id :new-todo) :value ""))))
 | 
			
		||||
        (section
 | 
			
		||||
          :id "main"
 | 
			
		||||
          :do-toggle (cell= (not (and (empty? active) (empty? completed))))
 | 
			
		||||
          (input
 | 
			
		||||
            :id "toggle-all"
 | 
			
		||||
            :type "checkbox"
 | 
			
		||||
            :do-attr (cell= {:checked (empty? active)}) 
 | 
			
		||||
            :on-click #(all-done! (val-id :toggle-all)))
 | 
			
		||||
          (label :for "toggle-all"
 | 
			
		||||
            "Mark all as complete")
 | 
			
		||||
          (ul :id "todo-list"
 | 
			
		||||
            (loop-tpl
 | 
			
		||||
              :reverse true
 | 
			
		||||
              :bind-ids [done# edit#]
 | 
			
		||||
              :bindings [[i {edit? :editing done? :completed todo-text :text show? :visible}] todos] 
 | 
			
		||||
              (li
 | 
			
		||||
                :do-class (cell= {:completed done? :editing edit?}) 
 | 
			
		||||
                :do-toggle show?
 | 
			
		||||
                (div :class "view" :on-dblclick #(editing! @i true)
 | 
			
		||||
                  (input
 | 
			
		||||
                    :id done# 
 | 
			
		||||
                    :type "checkbox"
 | 
			
		||||
                    :class "toggle"
 | 
			
		||||
                    :do-attr (cell= {:checked done?}) 
 | 
			
		||||
                    :on-click #(done! @i (val-id done#)))
 | 
			
		||||
                  (label (text "~{todo-text}"))
 | 
			
		||||
                  (button
 | 
			
		||||
                    :type "submit"
 | 
			
		||||
                    :class "destroy"
 | 
			
		||||
                    :on-click  #(destroy! @i)))
 | 
			
		||||
                (form :on-submit #(editing! @i false)
 | 
			
		||||
                  (input
 | 
			
		||||
                    :id edit#
 | 
			
		||||
                    :type "text"
 | 
			
		||||
                    :class "edit"
 | 
			
		||||
                    :do-value todo-text
 | 
			
		||||
                    :do-focus edit?
 | 
			
		||||
                    :on-blur #(when @edit? (editing! @i false))
 | 
			
		||||
                    :on-change #(when @edit? (text! @i (val-id edit#)))))))))
 | 
			
		||||
        (footer 
 | 
			
		||||
          :id "footer"
 | 
			
		||||
          :do-toggle (cell= (not (and (empty? active) (empty? completed))))
 | 
			
		||||
          (span :id "todo-count"
 | 
			
		||||
            (strong (text "~(count active) "))
 | 
			
		||||
            (span (text "~{plural-item} left")))
 | 
			
		||||
          (ul :id "filters"
 | 
			
		||||
            (li (a :href "#/"          :do-class (cell= {:selected (= "#/" route)})          "All"))
 | 
			
		||||
            (li (a :href "#/active"    :do-class (cell= {:selected (= "#/active" route)})    "Active"))
 | 
			
		||||
            (li (a :href "#/completed" :do-class (cell= {:selected (= "#/completed" route)}) "Completed")))
 | 
			
		||||
          (button
 | 
			
		||||
            :type      "submit"
 | 
			
		||||
            :id        "clear-completed"
 | 
			
		||||
            :on-click  #(clear-done!)
 | 
			
		||||
            (text "Clear completed (~(count completed))"))))
 | 
			
		||||
      (footer :id "info" 
 | 
			
		||||
        (p "Double-click to edit a todo")
 | 
			
		||||
        (p "Part of " (a :href "http://github.com/tailrecursion/hoplon-demos/" "hoplon-demos")))))) 
 | 
			
		||||
							
								
								
									
										31
									
								
								samples/HTML+ERB/fishbowl.html.erb.deface
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								samples/HTML+ERB/fishbowl.html.erb.deface
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,31 @@
 | 
			
		||||
<!-- insert_before '[data-hook="buttons"]' -->
 | 
			
		||||
<% if Spree::Config[:enable_fishbowl] %>
 | 
			
		||||
<div class="row">
 | 
			
		||||
  <div class="twelve columns" id="fishbowl_preferences">
 | 
			
		||||
    <fieldset class="no-border-bottom">
 | 
			
		||||
      <legend align="center"><%= t(:fishbowl_settings)%></legend>
 | 
			
		||||
      <% @fishbowl_options.each do |key| %>
 | 
			
		||||
          <div class="field">
 | 
			
		||||
            <%= label_tag(key, t(key.to_s.gsub('fishbowl_', '').to_sym) + ': ') + tag(:br) %>
 | 
			
		||||
            <%= text_field_tag('preferences[' + key.to_s + ']', Spree::Config[key], { :size => 10, :class => 'fullwidth' }) %>
 | 
			
		||||
          </div>
 | 
			
		||||
      <% end %>
 | 
			
		||||
      <div class="field">
 | 
			
		||||
        <%= hidden_field_tag 'preferences[fishbowl_always_fetch_current_inventory]', '0' %>
 | 
			
		||||
        <%= check_box_tag('preferences[fishbowl_always_fetch_current_inventory]', "1", Spree::Config[:fishbowl_always_fetch_current_inventory]) %>
 | 
			
		||||
        <%= t(:always_fetch_current_inventory) %>
 | 
			
		||||
      </div>
 | 
			
		||||
      <% if !@location_groups.empty? %>
 | 
			
		||||
        <div class="field">
 | 
			
		||||
          <%= label_tag(:fishbowl_location_group, t(:location_group) + ': ') + tag(:br) %>
 | 
			
		||||
          <%= select('preferences', 'fishbowl_location_group', @location_groups, { :selected => Spree::Config[:fishbowl_location_group]}, { :class => ['select2', 'fullwidth'] }) %>
 | 
			
		||||
        </div>
 | 
			
		||||
      <% end %>
 | 
			
		||||
    </fieldset>
 | 
			
		||||
  </div>
 | 
			
		||||
</div>
 | 
			
		||||
 | 
			
		||||
<script type="text/javascript">
 | 
			
		||||
  $('.select2').select2();
 | 
			
		||||
</script>
 | 
			
		||||
<% end %>
 | 
			
		||||
							
								
								
									
										39
									
								
								samples/HTML+ERB/index.html.erb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								samples/HTML+ERB/index.html.erb
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,39 @@
 | 
			
		||||
<% provide(:title, @header) %>
 | 
			
		||||
<% present @users do |user_presenter| %>
 | 
			
		||||
	<div class="row key-header">
 | 
			
		||||
		<h1><%= @header %></h1>
 | 
			
		||||
	</div>
 | 
			
		||||
 | 
			
		||||
	<div class='row'>
 | 
			
		||||
		<div class='small-12 columns'>
 | 
			
		||||
			<%= will_paginate %>
 | 
			
		||||
		</div>
 | 
			
		||||
	</div>
 | 
			
		||||
	<div class="row key-table">
 | 
			
		||||
		<div class="small-12 columns">
 | 
			
		||||
			<div class="row key-table-row">
 | 
			
		||||
				<div class="small-2 columns">Name</div>
 | 
			
		||||
				<div class="small-3 columns">Email</div>
 | 
			
		||||
				<div class="small-1 columns">Chords</div>
 | 
			
		||||
				<div class="small-1 columns">Keys</div>
 | 
			
		||||
				<div class="small-1 columns">Tunings</div>
 | 
			
		||||
				<div class="small-1 columns">Credits</div>
 | 
			
		||||
				<div class="small-1 columns">Prem?</div>
 | 
			
		||||
				<div class="small-2 columns">Since?</div>
 | 
			
		||||
			</div>
 | 
			
		||||
 | 
			
		||||
			<% if @users == [] %>
 | 
			
		||||
				<div class="row key-table-row">
 | 
			
		||||
					<div class="small-4 small-centered columns">No Users</div>
 | 
			
		||||
				</div>
 | 
			
		||||
			<% else %>
 | 
			
		||||
				<%= render @users %>
 | 
			
		||||
			<% end %>
 | 
			
		||||
		</div>
 | 
			
		||||
	</div>
 | 
			
		||||
	<div class='row'>
 | 
			
		||||
		<div class='small-12 columns'>
 | 
			
		||||
			<%= will_paginate %>
 | 
			
		||||
		</div>
 | 
			
		||||
	</div>
 | 
			
		||||
<% end %>
 | 
			
		||||
							
								
								
									
										29
									
								
								samples/Haml/buttons.html.haml.deface
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								samples/Haml/buttons.html.haml.deface
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,29 @@
 | 
			
		||||
/
 | 
			
		||||
  replace '.actions'
 | 
			
		||||
 | 
			
		||||
.pull-right
 | 
			
		||||
  .btn-group
 | 
			
		||||
    = link_to page.url, target: "_blank", title: t('.view_live_html'), class: "tip btn btn-xs btn-default" do
 | 
			
		||||
      %i.icon-picture.row-black
 | 
			
		||||
      
 | 
			
		||||
    = link_to refinery.edit_admin_page_path(page.nested_url,
 | 
			
		||||
        switch_locale: (page.translations.first.locale unless page.translated_to_default_locale?)),
 | 
			
		||||
        title: t('edit', :scope => 'refinery.admin.pages'),
 | 
			
		||||
        class: "tip btn btn-xs btn-default" do
 | 
			
		||||
      %i.icon-edit.row-blue
 | 
			
		||||
      
 | 
			
		||||
    
 | 
			
		||||
    - if page.deletable?
 | 
			
		||||
      = link_to refinery.admin_page_path(page.nested_url), 
 | 
			
		||||
          methode: :delete,
 | 
			
		||||
          title: t('delete', :scope => 'refinery.admin.pages'), 
 | 
			
		||||
          class: "tip cancel confirm-delete btn btn-xs btn-default", 
 | 
			
		||||
          data: { confirm: t('message', scope: 'refinery.admin.delete', title: page_title_with_translations(page)) } do
 | 
			
		||||
        %i.icon-trash.row-red
 | 
			
		||||
    - else
 | 
			
		||||
      %button.btn.btn-xs.btn-default.disabled
 | 
			
		||||
        %i.icon-trash
 | 
			
		||||
      
 | 
			
		||||
  .btn-group
 | 
			
		||||
    = link_to refinery.new_admin_page_path(:parent_id => page.id), title: t('new', :scope => 'refinery.admin.pages'), class: "tip btn btn-xs btn-default" do
 | 
			
		||||
      %i.icon-plus.row-green
 | 
			
		||||
		Reference in New Issue
	
	Block a user