doing 1.0.34 → 1.0.35

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bc07b5fb8388f698785ffa70f0c12c208cd57dcc1716d07af252d93a7d427e09
4
- data.tar.gz: 168816a713de9f7a4379fb094b4ec16b7ad8f301663dca5e950b552934488295
3
+ metadata.gz: 4a6e33a93b18f4a9e8ebd13602ba59ab98021296c7e7d5a7df848eba3b914c64
4
+ data.tar.gz: 0772cfb068a9ea75223c6d2e62292b44244b35db576ac9c0b350a4428fe46a05
5
5
  SHA512:
6
- metadata.gz: e840428a46112abbec42ba184627935b73e7d2814362500d9d1410d309eec940f68c14a60a9aa0ee947088fc5f7ee5fd97892f3760a8a991e0084e763a46dfcc
7
- data.tar.gz: e677b2f9434ac46b538e513038f0a16ef6d775321de5079dab9bff66f9065480bb5db15f0af4dc9ad01ad488d0e05ac8c6b896a95ab7f3988efc4dbc07594c9f
6
+ metadata.gz: fd1d6f8e2c58ddb0282df2724adc64440185c093a85c9b9523dbe5ae64e02fedff32ccb87bad06a16dea6f0c4a688a082c8ab79e52b53120e156386375da019f
7
+ data.tar.gz: e2839e739b8a7fb5072f4d1c7f5d63ec0135971e0eca44411121c47409684b7dcc42738ce7566a80f32b527d5f8405c4926690b924b793234de88b1f5e8c6bca
data/README.md CHANGED
@@ -464,6 +464,16 @@ To add autotagging, include a section like this in your `~/.doingrc` file:
464
464
  - posting
465
465
  - publishing
466
466
 
467
+ ###### Tag transformation
468
+
469
+ You can include a `transform` section in the autotag config which contains pairs of regular expressions and replacement patterns separated by a colon. These will be used to look at existing tags in the text and generate additional tags from them. For example:
470
+
471
+ autotag:
472
+ transform:
473
+ - (\w+)-\d+:$1
474
+
475
+ This creates a search pattern looking for a string of word characters followed by a hyphen and one or more digits, e.g. `@projecttag-12`. Do not include the @ symbol in the pattern. The replacement (`$1`) indicates that the first matched group (in parenthesis) should be used to generate the new tag, resulting in `@projecttag` being added to the entry.
476
+
467
477
  ##### Annotating
468
478
 
469
479
  `note` lets you append a note to the last entry. You can specify a section to grab the last entry from with `-s section_name`. `-e` will open your `$EDITOR` for typing the note, but you can also just include it on the command line after any flags. You can also pipe a note in on STDIN (`echo "fun stuff"|doing note`). If you don't use the `-r` switch, new notes will be appended to the existing notes, and using the `-e` switch will let you edit and add to an existing note. The `-r` switch will remove/replace a note; if there's new note text passed when using the `-r` switch, it will replace any existing note. If the `-r` switch is used alone, any existing note will be removed.
@@ -1,3 +1,3 @@
1
1
  module Doing
2
- VERSION = '1.0.34'
2
+ VERSION = '1.0.35'
3
3
  end
@@ -1695,6 +1695,25 @@ EOS
1695
1695
  end
1696
1696
  }
1697
1697
  }
1698
+ if @config['autotag'].key? 'transform'
1699
+ @config['autotag']['transform'].each {|tag|
1700
+ if tag =~ /\S+:\S+/
1701
+ rx, r = tag.split(/:/)
1702
+ r.gsub!(/\$/,'\\')
1703
+ rx.sub!(/^@/,'')
1704
+ regex = Regexp.new('@' + rx + '\b')
1705
+
1706
+ matches = text.scan(regex)
1707
+
1708
+ matches.each {|m|
1709
+ puts rx,r
1710
+ new_tag = m[0].sub(Regexp.new(rx), r)
1711
+ puts new_tag
1712
+ tail_tags.push(new_tag)
1713
+ } if matches
1714
+ end
1715
+ }
1716
+ end
1698
1717
  if whitelisted.length > 0
1699
1718
  @results.push("Whitelisted tags: #{whitelisted.join(', ')}")
1700
1719
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: doing
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.34
4
+ version: 1.0.35
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-15 00:00:00.000000000 Z
11
+ date: 2020-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake