Re: [DISCUSS] Asciidoc Header Reformat

2017-09-19 Thread Misha Brukman
I ran into this problem previously as well; it's also interesting that the
build will break if the length of the heading is much longer/shorter than
the length of the underline (I think a difference of more than 2 characters
causes a build error).

Here is a Python and shell script I wrote to do the fix for an entire repo:

#!/usr/bin/python

import re
import sys

def main(argv):
# http://asciidoctor.org/docs/asciidoc-recommended-practices/#section-titles
patterns = [
(re.compile('^=+$'), '='),
(re.compile('^-+$'), '=='),
(re.compile('^~+$'), '==='),
(re.compile('^\^+$'), ''),
(re.compile('^\++$'), '='),
]

with open(argv[1], 'r') as input_file:
prev_line = None
curr_line = None
for line in input_file.readlines():
prev_line = curr_line
curr_line = line

if prev_line is None:
continue

for pattern, heading in patterns:
if pattern.match(curr_line) and len(prev_line) ==
len(curr_line):
sys.stdout.write('%s %s' % (heading, prev_line))
prev_line = None
curr_line = None
break

if prev_line is not None:
sys.stdout.write(prev_line)

# end for
if curr_line is not None:
sys.stdout.write(curr_line)

# end with

if __name__ == '__main__':
main(sys.argv)


and here's a shell script driver:

#!/bin/bash

tmp="$(mktemp /tmp/asciidoc-cleanup.XX)"
for file in *.txt ; do
  ./asciidoc.py $file > $tmp
  if [[ $? == 0 ]]; then
mv $tmp $file
  else
echo "error in $file" >&2
  fi
done


YMMV, etc.

Hope this helps!

On Tue, Sep 19, 2017 at 12:23 PM, Stephen Mallette 
wrote:

> For whatever reason we started writing our headers in our docs with:
>
> Header
> ==
>
> Subheader
> -
>
> SubSubHeader
> 
>
> as opposed to the alternative:
>
> = This Is A Header
>
> == Subheader
>
> === SubSubHeader
>
> The downside with the first approach is that it forces us to do two things:
>
> 1. Remember the syntax for each header layer (which we all probably know
> pretty well at this point, but still...)
> 2. Ensure that the width of the header formatting line is equal to the
> length of the text above it.
>
> That second point is a killer sometimes. While I've trained myself to be
> good at noticing that problem I know it's bitten us in releases over and
> over and over again.
>
> Anyway, I think going to the alternative formatting would be better and
> propose to do a full reformatting. Please let me know if there are any
> concerns about doing that - if I don't hear back in the next few days I'll
> proceed with the changes.
>
> Thanks,
>
> Stephen
>


Re: Microsoft's CosmoDB supports Gremlin

2017-05-11 Thread Misha Brukman
On Thu, May 11, 2017 at 11:18 AM, Jason Plurad  wrote:

> I'm +1 on adding CosmoDB.
>
> I think we have a bit of a branding issue though. Most of their docs talk
> about the Gremlin graph language, and they generally fail to mention
> "Apache TinkerPop", which perhaps makes sense if they're not directly
> implementing TinkerPop's Java APIs. I don't think "Apache Gremlin" was
> trademarked by the ASF?
>
> Google still isn't helping either since many of the top links refer to
> TinkerPop 2 items (which do have the deprecated warning). A couple ideas
> based on the top search results:
> * redirect http://gremlin.tinkerpop.com to
> http://tinkerpop.apache.org/gremlin.html
> * update the text description and URL to make Apache TinkerPop more
> prominent on https://github.com/tinkerpop/gremlin


You can use robots.txt to decrease ranking and/or drop the page out of the
index altogether over time (incoming links may prevent immediate drop out
of the index):

   -
   https://developers.google.com/webmasters/control-crawl-index/docs/faq#h17
   - https://support.google.com/webmasters/answer/6062608?hl=en

Misha