asciidoctor-intellij-plugin icon indicating copy to clipboard operation
asciidoctor-intellij-plugin copied to clipboard

Extract variable (document attribute)

Open ggrossetie opened this issue 5 years ago • 1 comments

Feature request

It would be nice to be able to use the extract variable feature when editing an AsciiDoc document.

Here's an example:

= Document

The IntelliJ AsciiDoc Plugin provides support for the AsciiDoc markup language. 
You can install the IntelliJ AsciiDoc Plugin from the plugins section inside your JetBrains IDE or download it from the JetBrains Plugin Repository.

Here the product name ("IntelliJ AsciiDoc Plugin") is duplicated. What I want to do is select the text "IntelliJ AsciiDoc Plugin", then type Ctrl+Alt+v:

extract

The "Variable declaration" block could ask if the variable should be extract as a document attribute (ie. in the document header) or as an "inline" attribute in the paragraph/section.

Ideally we should also ask the user to replace all the occurrences: replace

Let's say I want to extract the variable as a document attribute and that I want to replace all occurrences, here's the result:

= Document
:product-name: IntelliJ AsciiDoc Plugin

The {product-name} provides support for the AsciiDoc markup language. 
You can install the {product-name} from the plugins section inside your JetBrains IDE or download it from the JetBrains Plugin Repository.

Here's another example:

= Document
:gh-repo-browser-ext: https://github.com/asciidoctor/asciidoctor-browser-extension
:gh-repo-intellij-plugin: https://github.com/asciidoctor/asciidoctor-intellij-plugin
= Document
:gh-org: https://github.com/asciidoctor
:gh-repo-browser-ext: {gh-org}/asciidoctor-browser-extension
:gh-repo-intellij-plugin: {gh-org}/asciidoctor-intellij-plugin

Versions

AsciiDoc Plugin Version: 0.28.25
WebStorm 2019.2
Build #WS-192.5728.87, built on July 22, 2019
Subscription is active until November 27, 2019
Runtime version: 11.0.3+12-b304.10 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.15.0-47-generic
GC: ParNew, ConcurrentMarkSweep
Memory: 4029M
Cores: 8
Registry: debugger.watches.in.variables=false
Non-Bundled Plugins: net.seesharpsoft.intellij.plugins.csv, org.asciidoctor.intellij.asciidoc, org.toml.lang

ggrossetie avatar Jul 30 '19 15:07 ggrossetie

I like the idea, thank you for sharing it.

ahus1 avatar Jul 30 '19 16:07 ahus1