SystemOrganization addCategory: #'TextLint-Seaside'! !TLSyntacticElement methodsFor: '*textlint-seaside' stamp: 'lr 10/25/2010 20:59'! css ^ nil! ! !TLSyntacticElement methodsFor: '*textlint-seaside' stamp: 'lr 10/25/2010 21:17'! renderStart: aFailure on: html html document openTag: 'span' attributes: (WAHtmlAttributes new at: 'class' put: 'problem'; at: 'title' put: aFailure rule name , ': ' , aFailure rule rationale; yourself) closed: false! ! !TLSyntacticElement methodsFor: '*textlint-seaside' stamp: 'lr 10/25/2010 21:11'! renderStarts: starts stops: stops on: html [ starts notEmpty and: [ starts first element start <= self start ] ] whileTrue: [ self renderStart: starts removeFirst on: html ]. html span class: self css; with: self text. [ stops notEmpty and: [ stops first element stop <= self stop ] ] whileTrue: [ self renderStop: stops removeFirst on: html ]! ! !TLSyntacticElement methodsFor: '*textlint-seaside' stamp: 'lr 10/25/2010 21:15'! renderStop: aFailure on: html html document closeTag: 'span'! ! !TLWhitespace methodsFor: '*textlint-seaside' stamp: 'lr 10/25/2010 21:00'! css ^ 'whitespace'! ! !TLWord methodsFor: '*textlint-seaside' stamp: 'lr 10/25/2010 21:00'! css ^ 'word'! ! !TLMarkup methodsFor: '*textlint-seaside' stamp: 'lr 10/25/2010 20:59'! css ^ 'markup'! ! !TLElement methodsFor: '*textlint-seaside' stamp: 'lr 10/25/2010 20:51'! renderStarts: starts stops: stops on: html self children do: [ :each | each renderStarts: starts stops: stops on: html ]! ! WAComponent subclass: #TLRootComponent instanceVariableNames: 'checker results' classVariableNames: '' poolDictionaries: '' category: 'TextLint-Seaside'! !TLRootComponent class methodsFor: 'initialization' stamp: 'lr 10/25/2010 22:28'! initialize | application | application := WAAdmin register: self asApplicationAt: 'textlint'. application preferenceAt: #serverPath put: '/'. WAAdmin defaultDispatcher defaultName: 'textlint'. WAAdmin applicationDefaults removeParent: WADevelopmentConfiguration instance! ! !TLRootComponent methodsFor: 'actions' stamp: 'lr 10/25/2010 22:29'! analyze: aString checker := TLTextLintChecker new. checker addStyle: TLWritingStyle scientificPaperStyle. results := checker check: (aString first: (aString size min: self size))! ! !TLRootComponent methodsFor: 'rendering' stamp: 'lr 10/25/2010 20:32'! renderBodyOn: html html form: [ results isNil ifTrue: [ self renderTextOn: html ] ifFalse: [ self renderResultOn: html ] ]! ! !TLRootComponent methodsFor: 'rendering' stamp: 'lr 10/25/2010 19:25'! renderContentOn: html html div class: 'head'; with: [ self renderHeadOn: html ]. html div class: 'body'; with: [ self renderBodyOn: html ]. html div class: 'foot'; with: [ self renderFootOn: html ]! ! !TLRootComponent methodsFor: 'rendering' stamp: 'JorgeRessia 10/26/2010 09:57'! renderFootOn: html html paragraph: [ html anchor url: 'http://scg.unibe.ch/research/textlint'; with: 'TextLint'. html text: ' is a '. html anchor url: 'http://scg.unibe.ch/staff/fabrizioperin/'; with: 'Fabrizio Perin'. html text: ', '. html anchor url: 'http://www.lukas-renggli.ch/'; with: 'Lukas Renggli'. html text: ', and '. html anchor url: 'http://www.jorgeressia.com/'; with: 'Jorge Ressia'. html text: ' production.' ]! ! !TLRootComponent methodsFor: 'rendering' stamp: 'lr 10/25/2010 20:37'! renderHeadOn: html html heading level: 1; with: [ html span: self title ]. html paragraph: 'TextLint is a tool to check your texts for common style errors. Just paste your text, HTML or LaTeX source into the text field below to give it a try.'! ! !TLRootComponent methodsFor: 'rendering' stamp: 'lr 10/25/2010 20:55'! renderResultOn: html | starts stops | starts := results sortBy: [ :a :b | a element start < b element start ]. stops := results sortBy: [ :a :b | a element stop < b element stop ]. html paragraph class: 'result'; with: [ checker document renderStarts: starts stops: stops on: html ]. html paragraph class: 'buttons'; with: [ html submitButton callback: [ results := nil ]; with: 'Go Back' ]! ! !TLRootComponent methodsFor: 'rendering' stamp: 'lr 10/25/2010 20:45'! renderTextOn: html html textArea value: (checker isNil ifFalse: [ checker document text ]); callback: [ :value | self analyze: value ]. html paragraph class: 'buttons'; with: [ html submitButton: 'Analyze Text' ]! ! !TLRootComponent methodsFor: 'accessing' stamp: 'lr 10/25/2010 22:29'! size ^ 1024 * 1024! ! !TLRootComponent methodsFor: 'accessing' stamp: 'lr 10/25/2010 21:08'! style ^ '.head, .body, .foot { width: 800px; margin: 0 auto; } .head h1 { width: 263px; height: 100px; background-image: url("http://textlint.lukas-renggli.ch/images/logo.png"); } .head h1 span { display: none; } .body textarea, .body p.result { resize: none; width: 100%; height: 600px; padding: 5px; line-height: 1.5; margin:0 0 1.5em; border: 1px solid #bbb; font: 1em "andale mono", "lucida console", monospace; } .body p.result { overflow: auto; white-space: pre-wrap; white-space: -moz-pre-wrap !!important; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word; } .body p.result .markup { color: gray; } .body p.result .problem { border-bottom: 1px dotted red; } .body p.result .problem:hover { background: #fbe3e4; } .body p.buttons { text-align: center; } .foot p { font-size: .8em; text-align: center; }'! ! !TLRootComponent methodsFor: 'accessing' stamp: 'lr 10/25/2010 19:23'! title ^ 'TextLint'! ! !TLRootComponent methodsFor: 'updating' stamp: 'lr 10/25/2010 20:00'! updateRoot: aHtmlRoot super updateRoot: aHtmlRoot. aHtmlRoot title: self title. aHtmlRoot stylesheet url: 'http://textlint.lukas-renggli.ch/blueprint/screen.css'! ! !TLPunctuationMark methodsFor: '*textlint-seaside' stamp: 'lr 10/25/2010 21:00'! css ^ 'punctuation'! ! TLRootComponent initialize!