]> git.wincent.com - docvim.git/log
docvim.git
6 years agoDon't rely on transformers
Greg Hurrell [Sun, 5 Jun 2016 08:44:47 +0000 (01:44 -0700)] 
Don't rely on transformers

Don't want two monad transformer libraries at play here
needlessly.

6 years agoKill off an out-of-date comment
Greg Hurrell [Sun, 5 Jun 2016 08:40:24 +0000 (01:40 -0700)] 
Kill off an out-of-date comment

6 years agoFix copy pasta error
Greg Hurrell [Sun, 5 Jun 2016 08:40:07 +0000 (01:40 -0700)] 
Fix copy pasta error

Suprised neither the compiler nor the tests seemed to
complain about this.

6 years agoDRY up other visitors
Greg Hurrell [Sun, 5 Jun 2016 08:35:55 +0000 (01:35 -0700)] 
DRY up other visitors

6 years agoMore simplification
Greg Hurrell [Sun, 5 Jun 2016 08:22:31 +0000 (01:22 -0700)] 
More simplification

6 years agoTrim down imports
Greg Hurrell [Sun, 5 Jun 2016 08:15:18 +0000 (01:15 -0700)] 
Trim down imports

6 years agoMore DRYing
Greg Hurrell [Sun, 5 Jun 2016 08:03:07 +0000 (01:03 -0700)] 
More DRYing

6 years agoFurther visitor DRYing
Greg Hurrell [Sun, 5 Jun 2016 07:57:30 +0000 (00:57 -0700)] 
Further visitor DRYing

6 years agoTidy indentation
Greg Hurrell [Sun, 5 Jun 2016 07:43:06 +0000 (00:43 -0700)] 
Tidy indentation

6 years agoFix lints
Greg Hurrell [Sun, 5 Jun 2016 07:37:04 +0000 (00:37 -0700)] 
Fix lints

6 years agoExtract Visitor module
Greg Hurrell [Sun, 5 Jun 2016 07:30:29 +0000 (00:30 -0700)] 
Extract Visitor module

First step in factoring out some of the duplication here.

6 years agoRemove some old comments
Greg Hurrell [Sun, 5 Jun 2016 06:23:47 +0000 (23:23 -0700)] 
Remove some old comments

6 years agoFix indentation
Greg Hurrell [Sun, 5 Jun 2016 06:23:31 +0000 (23:23 -0700)] 
Fix indentation

6 years agoSuppress unwanted trailing whitespace
Greg Hurrell [Sun, 5 Jun 2016 06:12:13 +0000 (23:12 -0700)] 
Suppress unwanted trailing whitespace

6 years agoFurther refine hard-wrapping
Greg Hurrell [Sun, 5 Jun 2016 05:03:05 +0000 (22:03 -0700)] 
Further refine hard-wrapping

6 years agoBe better about hard-wrap placement
Greg Hurrell [Sun, 5 Jun 2016 04:26:53 +0000 (21:26 -0700)] 
Be better about hard-wrap placement

Still needs a refactor, but the output is better.

6 years agoRename `hardwrap` -> `textwidth`
Greg Hurrell [Sun, 5 Jun 2016 03:39:46 +0000 (20:39 -0700)] 
Rename `hardwrap` -> `textwidth`

Because I want to use the name `hardwrap` for a function as part of some
imminent refactoring.

6 years agoAlign
Greg Hurrell [Sun, 5 Jun 2016 03:37:14 +0000 (20:37 -0700)] 
Align

6 years agoAlways link unconditionally in Vim help output
Greg Hurrell [Sun, 5 Jun 2016 03:35:11 +0000 (20:35 -0700)] 
Always link unconditionally in Vim help output

May not even need the symbol table at all in this printer, but we'll keep it
around for now, just in case.

6 years agoReplace a literal that I missed with a constant
Greg Hurrell [Sun, 5 Jun 2016 03:32:40 +0000 (20:32 -0700)] 
Replace a literal that I missed with a constant

6 years agoMove hardwrapping from `plaintext` into `append`
Greg Hurrell [Sat, 4 Jun 2016 22:01:56 +0000 (15:01 -0700)] 
Move hardwrapping from `plaintext` into `append`

Solves a bunch of issues, creates others, which I will have to fix in a
follow-up. The code itself is a complex, fragile, ugly, clusterfuck, so consider
this a work-in-progress.

Additionally, there are some unfortunate breaks which were there before and
continue to be there, like just inside parens, and things like that. Will need
to sort all that out too.

6 years agoTidy
Greg Hurrell [Sat, 4 Jun 2016 20:36:54 +0000 (13:36 -0700)] 
Tidy

6 years agoGet rid of meaningless distinction in Markdown printer
Greg Hurrell [Sat, 4 Jun 2016 20:35:40 +0000 (13:35 -0700)] 
Get rid of meaningless distinction in Markdown printer

All the cases must return Env, so let's put them all together
whether or not they explicitly access the state.

6 years agoShare integration tests inputs across output types
Greg Hurrell [Sat, 4 Jun 2016 14:20:49 +0000 (07:20 -0700)] 
Share integration tests inputs across output types

May eventually share other things too (I still have some
manual symlinks going on), but this is a good start.

6 years agoMake slurping a little more robust
Greg Hurrell [Sat, 4 Jun 2016 14:01:40 +0000 (07:01 -0700)] 
Make slurping a little more robust

But note remaining caveat inline. This really
should only be used to trim whitespace, at least
for now.

6 years agoRemove unwanted blank lines before fenced code blocks
Greg Hurrell [Sat, 4 Jun 2016 13:52:46 +0000 (06:52 -0700)] 
Remove unwanted blank lines before fenced code blocks

But note that this is a little bit fragile, even though
the tests pass. More work can be done to make this more
robust.

6 years agoFix some lints
Greg Hurrell [Sat, 4 Jun 2016 07:00:06 +0000 (00:00 -0700)] 
Fix some lints

6 years agoReorder things
Greg Hurrell [Sat, 4 Jun 2016 06:57:40 +0000 (23:57 -0700)] 
Reorder things

6 years agoEliminate unwanted trailing whitespace
Greg Hurrell [Sat, 4 Jun 2016 04:20:39 +0000 (21:20 -0700)] 
Eliminate unwanted trailing whitespace

6 years agoInitial primitive cut at hard wrapping
Greg Hurrell [Sat, 4 Jun 2016 02:17:40 +0000 (19:17 -0700)] 
Initial primitive cut at hard wrapping

This isn't ideal as noted inline (no rollback yet, which means we wind up with
trailing whitespace), but it is a reasonable start.

6 years agoRemove last use of Append
Greg Hurrell [Sat, 4 Jun 2016 02:09:32 +0000 (19:09 -0700)] 
Remove last use of Append

6 years agoConvert one more `Append`
Greg Hurrell [Thu, 2 Jun 2016 14:24:06 +0000 (07:24 -0700)] 
Convert one more `Append`

6 years agoContinue `Append` -> `append` conversion
Greg Hurrell [Thu, 2 Jun 2016 14:18:28 +0000 (07:18 -0700)] 
Continue `Append` -> `append` conversion

6 years agoUpdate `fenced` to use `append`
Greg Hurrell [Thu, 2 Jun 2016 14:01:04 +0000 (07:01 -0700)] 
Update `fenced` to use `append`

I wanted to write this using `>>=` but evidently that is not the right tool.

6 years agoInline `return` call inside `fenced` function
Greg Hurrell [Thu, 2 Jun 2016 07:43:14 +0000 (00:43 -0700)] 
Inline `return` call inside `fenced` function

Step 1 of ?.

6 years agoDrop excess blank lines after fenced code blocks in Vim output
Greg Hurrell [Thu, 2 Jun 2016 07:41:17 +0000 (00:41 -0700)] 
Drop excess blank lines after fenced code blocks in Vim output

6 years agoCreate append helper and start using it
Greg Hurrell [Thu, 2 Jun 2016 07:20:19 +0000 (00:20 -0700)] 
Create append helper and start using it

6 years agoFeel the linter love
Greg Hurrell [Thu, 2 Jun 2016 02:19:09 +0000 (19:19 -0700)] 
Feel the linter love

6 years agoGet some TODOs out of the work tree
Greg Hurrell [Thu, 2 Jun 2016 02:12:27 +0000 (19:12 -0700)] 
Get some TODOs out of the work tree

Horrible hygiene I know, but I need to compensate the functional purity somehow.

6 years agoAdd partial line to Vim printer context
Greg Hurrell [Wed, 1 Jun 2016 17:37:28 +0000 (10:37 -0700)] 
Add partial line to Vim printer context

This will be used to perform current line width calculations, so that we can
decide whether or not to hard-wrap.

6 years agoUse operations list in Vim printer
Greg Hurrell [Wed, 1 Jun 2016 17:27:28 +0000 (10:27 -0700)] 
Use operations list in Vim printer

Let's see if I can use this to implement hard-wrapping. It is very ugly, but if
I can get it working I'll have some tests in place and can then try refactoring.

6 years agoDeal with linebreaks inside list items
Greg Hurrell [Wed, 1 Jun 2016 08:07:58 +0000 (01:07 -0700)] 
Deal with linebreaks inside list items

6 years agoFix unwanted stripping of leading whitespace
Greg Hurrell [Wed, 1 Jun 2016 07:55:06 +0000 (00:55 -0700)] 
Fix unwanted stripping of leading whitespace

Stripping trailing whitespace is desired, but the leading
strip was actually busting the output.

6 years agoFix excess line at break tags in blockquotes
Greg Hurrell [Wed, 1 Jun 2016 07:49:28 +0000 (00:49 -0700)] 
Fix excess line at break tags in blockquotes

6 years agoAdd some tests
Greg Hurrell [Wed, 1 Jun 2016 07:39:05 +0000 (00:39 -0700)] 
Add some tests

Revealing some still-unresolved issues to be fixed.

6 years agoShow how linebreaks can be contextual
Greg Hurrell [Wed, 1 Jun 2016 07:33:46 +0000 (00:33 -0700)] 
Show how linebreaks can be contextual

6 years agoFurther flesh out README
Greg Hurrell [Wed, 1 Jun 2016 07:23:16 +0000 (00:23 -0700)] 
Further flesh out README

6 years agoEven sillier example of putting monadic state
Greg Hurrell [Wed, 1 Jun 2016 02:12:35 +0000 (19:12 -0700)] 
Even sillier example of putting monadic state

6 years agoSilly demonstration of getting at monadic state
Greg Hurrell [Wed, 1 Jun 2016 02:07:20 +0000 (19:07 -0700)] 
Silly demonstration of getting at monadic state

Doesn't affect the output, but proves that I can `get` the state.

6 years agoUse State + Reader monad transformer stack
Greg Hurrell [Tue, 31 May 2016 14:47:02 +0000 (07:47 -0700)] 
Use State + Reader monad transformer stack

Doesn't do anything useful yet, but it will: I want to use this to track current
line width, for the purposes of wrapping. As noted here:

https://ro-che.info/articles/2012-01-02-composing-monads

The order in which I compose the State and Reader monad transformers shouldn't
matter at all. If I end up needing Writer too, I will be able to replace this
with the RWS monad transformer.

6 years agoAdd some fixture files that I previously forgot to include
Greg Hurrell [Tue, 31 May 2016 14:29:18 +0000 (07:29 -0700)] 
Add some fixture files that I previously forgot to include

6 years agoFix indentation
Greg Hurrell [Tue, 31 May 2016 14:27:34 +0000 (07:27 -0700)] 
Fix indentation

6 years agoRename `State` to `Metadata`
Greg Hurrell [Tue, 31 May 2016 14:21:34 +0000 (07:21 -0700)] 
Rename `State` to `Metadata`

State was a terrible name to use in conjunction with the Reader monad, as it
easily leads to confusion with the State monad. Let's just call it `Metadata`
(about the project AST) for now; that's a horribly generic name too, but it is
at least an improvement.

6 years agoUpdate .tmux paths for Vim 8-pre
Greg Hurrell [Tue, 31 May 2016 14:14:44 +0000 (07:14 -0700)] 
Update .tmux paths for Vim 8-pre

6 years agoFix lint
Greg Hurrell [Tue, 31 May 2016 14:13:21 +0000 (07:13 -0700)] 
Fix lint

6 years agoUpgrade README
Greg Hurrell [Tue, 31 May 2016 14:12:21 +0000 (07:12 -0700)] 
Upgrade README

6 years agoHook up plugin and footer extraction
Greg Hurrell [Tue, 31 May 2016 07:38:57 +0000 (00:38 -0700)] 
Hook up plugin and footer extraction

Obviously the horrible `ast2` binding name will have to go away, but this works.

6 years agoExtract footers and plugin sections
Greg Hurrell [Tue, 31 May 2016 07:36:24 +0000 (00:36 -0700)] 
Extract footers and plugin sections

6 years agoFix trailing whitespace at end of file
Greg Hurrell [Tue, 31 May 2016 06:56:10 +0000 (23:56 -0700)] 
Fix trailing whitespace at end of file

6 years agoActually write output files
Greg Hurrell [Tue, 31 May 2016 06:50:29 +0000 (23:50 -0700)] 
Actually write output files

6 years agoSimplify some case statements with the LambdaCase extension
Greg Hurrell [Tue, 31 May 2016 05:55:00 +0000 (22:55 -0700)] 
Simplify some case statements with the LambdaCase extension

Via:

  https://www.schoolofhaskell.com/school/to-infinity-and-beyond/pick-of-the-week/guide-to-ghc-extensions/basic-syntax-extensions

6 years agoUse MultiWayIf extension to make a nested `if` less ugly
Greg Hurrell [Tue, 31 May 2016 05:44:51 +0000 (22:44 -0700)] 
Use MultiWayIf extension to make a nested `if` less ugly

Still pretty ugly though...

Via:

  https://www.schoolofhaskell.com/school/to-infinity-and-beyond/pick-of-the-week/guide-to-ghc-extensions/basic-syntax-extensions

6 years agoSort link targets for Markdown output too
Greg Hurrell [Tue, 31 May 2016 05:37:48 +0000 (22:37 -0700)] 
Sort link targets for Markdown output too

6 years agoSort link targets
Greg Hurrell [Tue, 31 May 2016 05:36:20 +0000 (22:36 -0700)] 
Sort link targets

6 years agoRight-align link targets
Greg Hurrell [Tue, 31 May 2016 05:34:38 +0000 (22:34 -0700)] 
Right-align link targets

6 years agoStart prepping to hangle hard-wrapping
Greg Hurrell [Mon, 30 May 2016 14:36:25 +0000 (07:36 -0700)] 
Start prepping to hangle hard-wrapping

This is going to be ugly...

6 years agoFix @plugin printing in Vim printer
Greg Hurrell [Mon, 30 May 2016 14:28:32 +0000 (07:28 -0700)] 
Fix @plugin printing in Vim printer

6 years agoMake Vim printer more useful
Greg Hurrell [Mon, 30 May 2016 14:09:42 +0000 (07:09 -0700)] 
Make Vim printer more useful

Still a work-in-progress, but it is close to what we want now.

6 years agoFix some lints
Greg Hurrell [Mon, 30 May 2016 07:06:41 +0000 (00:06 -0700)] 
Fix some lints

6 years agoFix test breakage caused by missing modules
Greg Hurrell [Mon, 30 May 2016 07:00:51 +0000 (00:00 -0700)] 
Fix test breakage caused by missing modules

6 years agoAdd Mappings visitor
Greg Hurrell [Mon, 30 May 2016 06:57:26 +0000 (23:57 -0700)] 
Add Mappings visitor

6 years agoAdd extract function to Plugin visitor
Greg Hurrell [Mon, 30 May 2016 06:51:10 +0000 (23:51 -0700)] 
Add extract function to Plugin visitor

Lots of duplication/similarity with the Footer visitor, but I want to do this a
few times before I dry to identify and abstract away the pattern.

6 years agoTrim down footer extraction to its "final" form
Greg Hurrell [Sun, 29 May 2016 23:13:37 +0000 (16:13 -0700)] 
Trim down footer extraction to its "final" form

Want the external interface provided by "extract" to
be simple, so we wrap the `runWriter` call and return
a List instead of a DList.

6 years agoAdd some notes about footer extraction
Greg Hurrell [Sun, 29 May 2016 14:27:55 +0000 (07:27 -0700)] 
Add some notes about footer extraction

Likely going to settle on postorder uniplate technique
at which point I will remove some of the extraneous
exports and simplify.

6 years agoTeach CLI to operate on target arguments
Greg Hurrell [Sat, 28 May 2016 14:02:34 +0000 (07:02 -0700)] 
Teach CLI to operate on target arguments

Still not writing to filesystem, but will add that in a bit.
For now, just debugging everything over standard out is
super convenient.

Obviously, this code is super ugly with that staggered `if`
statement, so will refactor.

6 years agoMake CLI tool print markdown
Greg Hurrell [Sat, 28 May 2016 06:37:04 +0000 (23:37 -0700)] 
Make CLI tool print markdown

Apologies for the shitty commit with a bunch of very stale lingering worktree
changes just thrown in there for no good reason.

6 years agoInclude a couple of examples of alternatives to `walk`
Greg Hurrell [Thu, 7 Apr 2016 14:39:39 +0000 (07:39 -0700)] 
Include a couple of examples of alternatives to `walk`

6 years agoFix lints
Greg Hurrell [Thu, 7 Apr 2016 06:57:54 +0000 (23:57 -0700)] 
Fix lints

6 years agoRemove explicit Plated instance
Greg Hurrell [Thu, 7 Apr 2016 06:56:24 +0000 (23:56 -0700)] 
Remove explicit Plated instance

Thought I would need it based on reading:

  https://hackage.haskell.org/package/lens-4.13.2.1/docs/Control-Lens-Plated.html

but it seems that I do not.

6 years agoUse lens library and uniplate functionality to simplify `walk`
Greg Hurrell [Thu, 7 Apr 2016 06:53:46 +0000 (23:53 -0700)] 
Use lens library and uniplate functionality to simplify `walk`

As suggested here:

  http://stackoverflow.com/questions/36417814/recursively-walking-an-ast-using-foldl-and-the-reader-monad-without-boilerplate

6 years agoRevert "(Temporarily) switch to partitioning footer visitor"
Greg Hurrell [Wed, 6 Apr 2016 14:00:33 +0000 (07:00 -0700)] 
Revert "(Temporarily) switch to partitioning footer visitor"

This reverts commit e1b6966168f9618ad28f.

As explained in that commit message, back to the old drawing board.

6 years ago(Temporarily) switch to partitioning footer visitor
Greg Hurrell [Wed, 6 Apr 2016 13:51:27 +0000 (06:51 -0700)] 
(Temporarily) switch to partitioning footer visitor

This is semi-broken, so will revert, but I wanted to show where my
thinking erroneously took me.

The main idea is that if I extract the footer sections from the tree,
then I am left with "something" that I need to pass to the Markdown
printer and that "something" should _not_ have the extracted contents in
it as well, otherwise they will appear as duplicated in the output.

So, I thought to partition instead of extract. One list would be
extracted footer nodes and another whatever was left. I could then
string these extractors into a pipeline, effectively filtering the
remaining output down as I went. Or I could merge them into one big
extractor/classifier which would return a collection of non-overlapping
subsets.

This is flawed for two reasons:

(1) My implementation was wrong. As committed here, the partitioning is
half-busted because of my `nodes` implementation. I tried a few
different ways, only some of which type-checked and none of which
actually produced the right results (either too much was accumulated,
producing repeated entries, or not enough).

(2) The conceptual model is fundamentally flawed because what I need is
a tree pruning process and not something that can only output arrays
(even if those arrays contain trees). This was my principal mistake,
because I thought this could be made to work because we're dealing with
subtrees. Maybe it can, but I don't think so: a `Unit` might be a list
`Node`s, but all the interesting distinctions happen inside some nested
child (usually a DocBlock, but not always: for example it might be
inside a DocBlock inside a FunctionDeclaration).

So, I am going to back this out and reconsider my approach.

Footer extraction will still work but I need to figure out what to do
with what's left, and whether I can really do this properly by pruning
at a tree level.

6 years agoDRY up Footer visitor
Greg Hurrell [Wed, 6 Apr 2016 06:14:40 +0000 (23:14 -0700)] 
DRY up Footer visitor

6 years agoFurther flesh out footer visitor
Greg Hurrell [Wed, 6 Apr 2016 06:05:13 +0000 (23:05 -0700)] 
Further flesh out footer visitor

6 years agoStart working on Footer visitor
Greg Hurrell [Wed, 6 Apr 2016 05:46:25 +0000 (22:46 -0700)] 
Start working on Footer visitor

This one uses the State monad to do a context-sensitive traversal: the
traversal is either in capturing or non-capturing mode, and it
accumulates nodes into the final result list on that basis.

6 years agoBrevity
Greg Hurrell [Wed, 6 Apr 2016 01:32:25 +0000 (18:32 -0700)] 
Brevity

6 years agoBe a little more generic
Greg Hurrell [Tue, 5 Apr 2016 05:40:27 +0000 (22:40 -0700)] 
Be a little more generic

6 years agoSimplify `walk` callers by using monoidal nature of argument
Greg Hurrell [Tue, 5 Apr 2016 03:26:34 +0000 (20:26 -0700)] 
Simplify `walk` callers by using monoidal nature of argument

We can let `walk` do the `mappend` for all the callers, simplifying
them.

6 years agoMay as well line these up with what follows them
Greg Hurrell [Tue, 5 Apr 2016 01:13:40 +0000 (18:13 -0700)] 
May as well line these up with what follows them

6 years agoDrop unnecessary parens
Greg Hurrell [Tue, 5 Apr 2016 01:13:17 +0000 (18:13 -0700)] 
Drop unnecessary parens

6 years agoSort
Greg Hurrell [Tue, 5 Apr 2016 01:12:59 +0000 (18:12 -0700)] 
Sort

6 years agoTraverse into functions in Markdown printer
Greg Hurrell [Tue, 5 Apr 2016 01:04:21 +0000 (18:04 -0700)] 
Traverse into functions in Markdown printer

Wondering if I should be able to re-use `walk` here. Not sure how easy
it will be to get the Reader monad and the `walk` function to play
nicely together. I think it will be worth figuring it out though, as
I'll need to make a bunch of pruned AST trees in order to produce the
different document sections (mappings, options etc) so otherwise will
wind up writing a lot of similar code in walkers for each one.

6 years agointercalate -> unwords as per linter
Greg Hurrell [Tue, 5 Apr 2016 01:01:47 +0000 (18:01 -0700)] 
intercalate -> unwords as per linter

6 years agoSkip past tabs in LetStatement RHS
Greg Hurrell [Tue, 5 Apr 2016 00:41:24 +0000 (17:41 -0700)] 
Skip past tabs in LetStatement RHS

We already do this with spaces, so we should do it with tabs too.

6 years agoDon't suppress all whitespace in GenericStatement representation
Greg Hurrell [Tue, 5 Apr 2016 00:39:22 +0000 (17:39 -0700)] 
Don't suppress all whitespace in GenericStatement representation

We're compressing it, which means that a string literal with an embedded
run of whitespace will get squished, but such is life.

6 years agoRemove an errant >
Greg Hurrell [Mon, 4 Apr 2016 15:52:05 +0000 (08:52 -0700)] 
Remove an errant >

6 years agoCopy parser integration fixtures over to Markdown directory
Greg Hurrell [Mon, 4 Apr 2016 15:50:10 +0000 (08:50 -0700)] 
Copy parser integration fixtures over to Markdown directory

Some rough edges in there, but these mostly work.

6 years agoFix overly eager GenericStatement parsing and eos issues
Greg Hurrell [Mon, 4 Apr 2016 15:42:04 +0000 (08:42 -0700)] 
Fix overly eager GenericStatement parsing and eos issues

Too much stuff was getting parsed as generic statement. Here we fix that
and the related issue of "lw 100 f" being parsed as "lw 100" + "f"
(GenericStatement).

This does introduce a slight regression in that trailing comments are
now considered part of the RHS of a let statement, but it still fixes
more than it breaks, so I am keeping this in.

If I get to proper expression parsing (or at least proper string
literals) then I'll be able to fix that.

6 years agoStore ints rather than strings in AST
Greg Hurrell [Mon, 4 Apr 2016 15:27:23 +0000 (08:27 -0700)] 
Store ints rather than strings in AST

And note horrible bug where my `eos` parser doesn't seem to be enforcing
an actual end of statement.

6 years agoFix silly bug with lwindow parsing
Greg Hurrell [Mon, 4 Apr 2016 15:18:04 +0000 (08:18 -0700)] 
Fix silly bug with lwindow parsing