> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clo...@googlegroups.com
> Note that posts from new members are moderated - please be patient with your first post.
> To unsubscribe from this group, send email to
> clojure+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
Bruce Williams
Concepts, like individuals, have their histories and are just as incapable of
withstanding the ravages of time as are individuals. But in and
through all this
they retain a kind of homesickness for the scenes of their childhood.
Soren Kierkegaard
In Enlive there are at least two approaches available:
The first approach is to use the 'select' function to pick out the
interesting part of the element tree. You use CSS-style selectors to
describe the element.
The second approach is to use the 'at' macro. You give it an element
tree and pairs of selectors and transformations. For each
selector-transformation pair, the transformation is applied to all
elements that matches the selector. A transformation takes a node and
returns what it should be replaced with. You can do almost anything
with them, including removing the element (which might be useful for
the ads in your case) or extracting the text of the node (the matching
nodes deepest in the tree are processed first). The result of the 'at'
form is the element tree with all transformations applied.
Both 'select' and 'at' accepts a element tree which you can create
with the html-resource function which accepts, among other things,
URLs.
You probably need to write some html element processing functions, so
it's probably a good idea to get familiar with the data format of the
nodes:
Element: {:tag :a, :attrs {:href "http://example.com/"}, :content
<sequence of nodes>}
Text: "text node"
Comment: {:type :comment, :data "comment node"}
I found the wiki of Enlive very useful. The "Getting Started" explains
what's there and how to use it very well, I think.
https://github.com/cgrand/enlive/wiki/_pages
I should also mention David Nolen's comprehensive tutorial which
begins with scraping: https://github.com/swannodette/enlive-tutorial
// raek
I am a newbie on clojure have decided to try it out after many years doing Ruby mostly.
I have been trying lately some basic tutorials and I am also reading the joy of clojure.
Anyways in the process I am trying to decide on a suitable project creation workflow with Leiningen and IntelliJ with out much luck.
What I am trying to do is to understand what are the steps in order to have the project correctly working on intelliJ so that REPL and the dependencies are caught etc.
I have currently the following SW:
- Leiningen 1.5.2
- IntelliJ 10.5
- LA Clojure latest plugin
- Leiningen-IntelliJ plugin installed and configured to point to the binary.
I have currently tried the following.
1) Create project with Leiningen on the command console: lein new monkeyproject
2) If I select to open an existing project and point out to the project.clj:
- I have to add manually the lib folder to the dependencies otherwise running wont work.
- It does not add directly the clojure "aspect" or tooling
3) When I select run on the project.clj it indicates me:
/Users/vbosch/Programming/Clojure/hello/project.clj
Exception in thread "main" java.lang.Exception: Unable to resolve symbol: defproject in this context
I understand that is part of the Leiningen project and of course it is not indicated anywhere in the project.clj so maybe Leiningen know how to treat the file and that "intelligence" is missing in intellij
(or maybe just my intelligence... ).
What is the correct way to setup a project with Leiningen and intelliJ?
How should the execution workflow go ? ( I can launch REPL and load files to it, no issues but should I do a lein run from outside the IDE to launch the full project or what ? )
Sorry for my legthy email. ( I promise I have looked at guides like http://blog.kartikshah.info/2010/12/how-to-intellij-idea-for.html ... but no luck )
Regards,
Vicente
Run: lein pom Then in intellij goto file->open project and goto the directory of the project and click on the pom.xml file. |
Hi, I am a newbie on clojure have decided to try it out after many years doing Ruby mostly. I have been trying lately some basic tutorials and I am also reading the joy of clojure. Anyways in the process I am trying to decide on a suitable project creation workflow with Leiningen and IntelliJ with out much luck. What I am trying to do is to understand what are the steps in order to have the project correctly working on intelliJ so that REPL and the dependencies are caught etc. I have currently the following SW: - Leiningen 1.5.2 - IntelliJ 10.5 - LA Clojure latest plugin - Leiningen-IntelliJ plugin installed and configured to point to the binary. I have currently tried the following. |
| 1) Create project with Leiningen on the command console: lein new monkeyproject 2) If I select to open an existing project and point out to the project.clj: - I have to add manually the lib folder to the dependencies otherwise running wont work. - It does not add directly the clojure "aspect" or tooling 3) When I select run on the project.clj it indicates me: /Users/vbosch/Programming/Clojure/hello/project.clj Exception in thread "main" java.lang.Exception: Unable to resolve symbol: defproject in this context |
| I understand that is part of the Leiningen project and of course it is not indicated anywhere in the project.clj so maybe Leiningen know how to treat the file and that "intelligence" is missing in intellij (or maybe just my intelligence... ). What is the correct way to setup a project with Leiningen and intelliJ? How should the execution workflow go ? ( I can launch REPL and load files to it, no issues but should I do a lein run from outside the IDE to launch the full project or what ? ) Sorry for my legthy email. ( I promise I have looked at guides like http://blog.kartikshah.info/2010/12/how-to-intellij-idea-for.html ... but no luck ) Regards, Vicente |
| -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clo...@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to |
| clojure+unsub...@googlegroups.com |
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to