From 45fa50e511f3256890e3f2aaa2d93946531328a3 Mon Sep 17 00:00:00 2001 From: Kirk Hansen Date: Tue, 18 Feb 2014 17:31:15 -0600 Subject: [PATCH] Adding Yii files --- lib/docs/filters/yii/clean_html.rb | 48 +++++++++++++++++++++++++++++ lib/docs/filters/yii/entries.rb | 30 ++++++++++++++++++ lib/docs/scrapers/yii.rb | 12 ++++++++ public/icons/docs/yii/16.png | Bin 0 -> 890 bytes public/icons/docs/yii/16@2x.png | Bin 0 -> 2050 bytes 5 files changed, 90 insertions(+) create mode 100644 lib/docs/filters/yii/clean_html.rb create mode 100644 lib/docs/filters/yii/entries.rb create mode 100755 lib/docs/scrapers/yii.rb create mode 100644 public/icons/docs/yii/16.png create mode 100644 public/icons/docs/yii/16@2x.png diff --git a/lib/docs/filters/yii/clean_html.rb b/lib/docs/filters/yii/clean_html.rb new file mode 100644 index 00000000..5adebcc6 --- /dev/null +++ b/lib/docs/filters/yii/clean_html.rb @@ -0,0 +1,48 @@ +module Docs + class Yii + class CleanHtmlFilter < Filter + def call + + #remove irrelevant content + css('div').each do |node| + if node['class'] == "layout-main-header" + node.remove + elsif node['class'] == "layout-main-submenu" + node.remove + elsif node['class'] == "layout-main-shortcuts" + node.remove + elsif node['class'] == "layout-main-footer" + node.remove + elsif node['class'] == "grid_3 alpha" + node.remove + elsif node['class'] == "comments" + node.remove + elsif node['class'] == "api-suggest clearfix" + node.remove + elsif node['id'] == "comments" + node.remove + elsif node['id'] == "nav" + node.remove + else + end + end + + # Put code blocks in
 tags
+        css('.code').each do |node|
+          node.name = 'pre'
+        end
+
+        #remove Hide inherited methods / properties and show links
+        css('a').each do |node|
+          if node['class'] == 'toggle'
+            node.remove
+          elsif node['class'] == 'show'
+            node.remove
+          end
+        end
+
+        doc
+      end
+    end
+  end
+end
\ No newline at end of file
diff --git a/lib/docs/filters/yii/entries.rb b/lib/docs/filters/yii/entries.rb
new file mode 100644
index 00000000..803d32be
--- /dev/null
+++ b/lib/docs/filters/yii/entries.rb
@@ -0,0 +1,30 @@
+module Docs
+  class Yii
+    class EntriesFilter < Docs::EntriesFilter
+
+      def get_name
+        #class names exist in the 

content. + name = at_css('h1').content.strip + end + + def get_type + #need to get the table with a class of summaryTable. Then we need the content of the first td in the first tr. + type = css('table.summaryTable td')[0].content + type + end + + def additional_entries + css('table.summaryTable tr[id]').inject [] do |entries,node| + #need to ignore inherited methods and properties + if (node['class'] != 'inherited' and node.parent().parent()['class'] == "summary docMethod") + #name should be Class.method() id will take you to the link in the summary block. + name = slug + "." + node['id'] + "()" + entries << [name, node['id']] + end + entries + end + end + + end + end +end \ No newline at end of file diff --git a/lib/docs/scrapers/yii.rb b/lib/docs/scrapers/yii.rb new file mode 100755 index 00000000..4467319b --- /dev/null +++ b/lib/docs/scrapers/yii.rb @@ -0,0 +1,12 @@ +module Docs + class Yii < UrlScraper + self.name = 'Yii' + self.slug = 'yii' + self.type = 'yii' + self.version = '1.1.14' + self.base_url = 'http://www.yiiframework.com/doc/api/1.1/' + + html_filters.push 'yii/clean_html', 'yii/entries' + + end +end diff --git a/public/icons/docs/yii/16.png b/public/icons/docs/yii/16.png new file mode 100644 index 0000000000000000000000000000000000000000..85a6ad44c49fede8a90fd1a6321b71b6fa32eae8 GIT binary patch literal 890 zcmV-=1BLvFP)?k0|!Y& zK~y-)b&_jn6lWNP&o|#U_u1Lqi6)!W)N7O)(<1&ef<_BQtA)m>Ewsh_5bFhrSSgC& z4KJt=6l|1=C}=UL#7m65u+mb}6l5z%#TY~+Au$`0U9;KUnVs3$&p#@WCg=BaUe0^o zm;CYVSD3b9Eg6b7i@GL(S*2((KXn&{6Ijx)1pp9zd=3$77OgB@<~Lpcp`mfjv1^@O z?YSv~^E?u*tr08l-4FC^`@F$Wm?0KT8>-mTbOvMe?B%~gS#V~gx#PROSLktRu1MOy z>NWuY0s#M1Pvu1+*&`<9G$aZn5M+K?dHc-9pFc}HY!R*b>%H@Te)G~sZjzVJGN<6# zieGYs5aEOX0Q!vbK^~Hr5LP7;QW-TFOcGz(f8k3$TDdOFQ@jLhG-5EH>9PimX|f=? zt9LBFm=mIlCrK$Qa+ax{O%w%8Q$Yg^g03sFk(=ow@JEq@m4Qfa!-+qz`|Z3ZA*D6GkLa3f|O8X!gTuGvhODk^bB_u$k=nG zx_^UYRUsL>D3&hY?Eye6cJ;Eul68(FHJMiTo{a6JmVA6F2mrNpV>*~fdv8AFIa%U0 zA9VXc*70KD)B_9pMjxf8L_R41fH0n^>Tm}DV8^A-zxqdP+sR}}XWw*IJ@;V6lf)G# zX~zn0SvKB)4GS!)|Nh^?%YXMSDh~T_xde?H0D!sWU%O-3|0URXycIiZKk_f!d9c~G zxj!_LMKbAUopk(U^^yBhb8GZHe!>psH@5I$rvSrLof&!_ZTsp~0BCNFV)GZvCQh*F z=p_I^!uFB2bFjRTuC{&k>YHDA&pcrV08kZ3?Z2~Y&QD}kO+Nq(aPaZC*SVD`tNBiM Qe*gdg07*qoM6N<$f_`j|FaQ7m literal 0 HcmV?d00001 diff --git a/public/icons/docs/yii/16@2x.png b/public/icons/docs/yii/16@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..5d613ab407c5a3fcd1fab8c237c7b92df4b6f1b3 GIT binary patch literal 2050 zcmV+d2>thoP)`ltW^2aica zK~z}7wO4zL)x{P5&YXGOd-vXbxGb-NC{!effTA@B7?eL+LII^dDpeXlO;GEjF$Fbh z8=)mF8pVcKDoVAWg2hGMfL3ayrYyxp3T(j*h=MH3va-AE-g|$qnf^gRQE6E$Cz=0d zzVDlJPUbrUoS~@Mv-9B-q1hnN3=uyLe z6K2glsermi=HT7CXVDV?pA7I{&&}6<&qm5`s6HhDrDc_Ko~W7XKMCHMkuTeN{(B8C z{B*^p->mxbJ_!IV?HxSo@!#rfN$G-rG;SKHbZV$X43&`}nQ28u_sy*#FQ$H%E*}Dr z_Z~;;|Kf9lul!o_x3@pNYQvuD3319H9hI5@9zK)c{k^YE{-E}+V-MR;-WxmgrVs$= z*r9jF4&R*)_EwdYmRr(N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