Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jmk0 committed Sep 9, 2016
0 parents commit 3a5f5cf
Show file tree
Hide file tree
Showing 15 changed files with 1,553 additions and 0 deletions.
Empty file added TIDY
Empty file.
46 changes: 46 additions & 0 deletions data/Sandbox/AutoSubPluginExamples.txt
@@ -0,0 +1,46 @@
%META:TOPICPARENT{name="AutoSubPlugin"}%
---+!! Auto Sub Plugin Examples

%TOC%

---++ Tests

* Set AUTOSUBPLUGIN_DEBUG = 1

Links that shouldn't be corrupted:
* [[WebHome][no foo corruption]]
* http://www.google.com/foo/bar
* mailto:foo@bar.com

---++ Formatting Macros
Examples of how AutoSubPlugin might be used. First, a series of formatting macros that are not directly associated with the plugin.

* Set ASPEXAPPFMT = <code><b>%DEFAULT%</b></code>
* Set ASPEXDATAFMT = <i><b>%DEFAULT%</b></i>
* Set ASPEXAPP = <code><b>[[Main.ASPEXApp%DEFAULT%][%DEFAULT%]]</b></code>
* Set AUTOSUBPLUGIN_DEBUG = 0

---++ Plugin Macro Usage

Note that in the following table, the rendered macros will be blanks. Only in the example usage of substitutions after the table should any obvious effects be present.

| *You Type* | *You Get* |
| <verbatim>%ASPEXAPPFMT{helloWorld}%</verbatim> <br/>(non-plugin example) | %ASPEXAPPFMT{helloWorld}% |
| <verbatim>%AUTOSUB{"foo" repl="%ASPEXAPP{foo}%"}%</verbatim> | %AUTOSUB{"foo" repl="%ASPEXAPP{foo}%"}% |
| <verbatim>%AUTOSUB{name="bar" repl="%ASPEXDATAFMT{bar}%"}%</verbatim> | %AUTOSUB{name="bar" repl="%ASPEXDATAFMT{bar}%"}% |
| <verbatim>%AUTOSUB{"sampapp2" repl="%ASPEXAPP{sampapp2}%"}%</verbatim> | %AUTOSUB{"sampapp2" repl="%ASPEXAPP{sampapp2}%"}% |

---++ Substitution Usage

The following table is meant to show how text is automatically substituted, based on the macros used above.

| *You Type* | *You Get* |
| <verbatim>The application foo produces data type bar when it runs. So there.</verbatim> | The application foo produces data type bar when it runs. So there. |
| <verbatim>But if this !foo is linked, there's a problem. Also if this <nop>bar is linked.</verbatim> | But if this !foo is linked, there's a problem. Also if this <nop>bar is linked. |
| <verbatim><noautolink>None of this foo text should be bar linked.</noautolink></verbatim> | <noautolink>None of this foo text should be bar linked.</noautolink> |
| <verbatim>sampapp2 should be linked but probably will not link to an existing topic.</verbatim> | sampapp2 should be linked but probably will not link to an existing topic. |

---++ Substitution Table

The following table is the list of substitutions known in this topic, as produced by <verbatim>%AUTOSUBS%</verbatim>.
%AUTOSUBS%
7 changes: 7 additions & 0 deletions data/Sandbox/PluginTestAutoSubPlugin.txt
@@ -0,0 +1,7 @@
%META:TOPICINFO{author="ProjectContributor" date="1297286796" format="1.1" version="1"}%
%META:TOPICPARENT{name="AutoSubPlugin"}%
---+!! Testing !AutoSubPlugin

SOME EXAMPLES OF THE PLUGIN

__Related:__ %SYSTEMWEB%.AutoSubPlugin
70 changes: 70 additions & 0 deletions data/System/AutoSubPlugin.txt
@@ -0,0 +1,70 @@
%META:TOPICPARENT{name="Plugins"}%
---+ Auto Sub Plugin
<!--
One line description, required for extensions repository catalog.
* Set SHORTDESCRIPTION = Plugin designed to substitute links (or any other formatting) for wiki-words and non-wiki-words alike.
-->

%SHORTDESCRIPTION%

%TOC%

---++ Macros

Gives the ability to do substitution of text in a wiki document, which may include things like:
1 Automatic formatting of keywords
1 Automatic linking of keywords
1 Translation of keywords

%INCLUDE{VarAUTOSUB}%

%INCLUDE{VarAUTOSUBS}%

%INCLUDE{VarNOAUTOSUB}%

---++ <nop>%TOPIC% Settings

You can override the default settings as documented in [[%SYSTEMWEB%.PreferenceSettings][preferences]]. These preferences can be set in your %USERSWEB%.SitePreferences, or in !WebPreferences, or in individual topics.

| *Preference* | *Use to* | *Default* |
| =AUTOSUBPLUGIN_DEBUG= | Enable debugging output, which is stored in files in the plug-in's work area on the server and is not accessible via the web | 0 |
| =AUTOSUBPLUGIN_PROTECTED= | Specify HTML or HTML-style tags to be protected from substitutions by this plug-in | "pre noautolink dot verbatim plantuml" |

If the protected tags value is changed, it is *strongly* recommended that ==pre== and ==noautolink== remain in the list, at the beginning and in that order.

---++ Examples
Examples can be found in Sandbox.AutoSubPluginExamples.

---++ Plugin Installation Instructions
You do not need to install anything in the browser to use this extension. The following instructions are for the administrator who installs the extension on the server.

---+++ Installation
Open configure, and open the "Extensions" section. Use "Find More Extensions" to get a list of available extensions. Select "Install".

If you have any problems, or if the extension isn't available in =configure=, then you can still install manually from the command-line. See http://foswiki.org/Support/ManuallyInstallingExtensions for more help.

---+++ Dependencies
No dependencies.

---++ Known Bugs
None.

---++ TODO

---++ Plugin Info

| Change&nbsp;History: | <!-- versions below in reverse order -->&nbsp; |
| 13 Aug 2015 | 1.0.0 Initial release. |



%META:FORM{name="PackageForm"}%
%META:FIELD{name="Author" title="Author" value="Foswiki:Main.JohnKnutson"}%
%META:FIELD{name="Version" title="Version" value="v1.0.0"}%
%META:FIELD{name="Release" title="Release" value="1.0.0"}%
%META:FIELD{name="Repository" title="Repository" value="https://github.com/foswiki/AutoSubPlugin"}%
%META:FIELD{name="Copyright" title="Copyright" value="&copy; 2015, Applied Research Laboratories, the University of Texas at Austin"}%
%META:FIELD{name="License" title="License" value="[[%25ATTACHURLPATH%25/COPYING.txt][GPLv3]]"}%
%META:FIELD{name="Home" title="Home" value="http://foswiki.org/Extensions/AutoSubPlugin"}%
%META:FIELD{name="Support" title="Support" value="http://foswiki.org/Support/AutoSubPlugin"}%
%META:FILEATTACHMENT{name="COPYING.txt" attachment="COPYING.txt" attr="" comment="GNU General Public License v3" date="1417819886" path="COPYING.txt" size="35147" user="ProjectContributor" version="1"}%
8 changes: 8 additions & 0 deletions data/System/VarAUTOSUB.txt
@@ -0,0 +1,8 @@
%META:TOPICPARENT{name="AutoSubPlugin"}%
#VarAUTOSUB
---+++ AUTOSUB{...} -- define text substitutions for wiki pages
* Parameters:
| *Parameter* | *Description* | *Default* |
| name | Text to auto-replace | none, required parameter |
| fmtMacro | Replacement text. May be a wiki macro, however, the wiki macro being substituted may not encorporate other macros. If this is done, the wiki will complain to the administrator. | none - no substitution |

6 changes: 6 additions & 0 deletions data/System/VarAUTOSUBS.txt
@@ -0,0 +1,6 @@
%META:TOPICPARENT{name="AutoSubPlugin"}%
#VarAUTOSUBS
---+++ AUTOSUBS -- Generate a table of all known links/substitutions
* Syntax: =%<nop>AUTOSUBS%=
* =%<nop>AUTOSUBS%= generates a table in place containing all links/substitutions known to this plug-in, which are only those in the topic page in which this macro appears and any included topics.

11 changes: 11 additions & 0 deletions data/System/VarNOAUTOSUB.txt
@@ -0,0 +1,11 @@
%META:TOPICPARENT{name="AutoSubPlugin"}%
#VarNOAUTOSUB
---+++ NOAUTOSUB{...} -- disable a text substitution for a wiki page
* Parameters:
| *Parameter* | *Description* | *Default* |
| name | Text to auto-replace | none, required parameter |

If a link/substitution has been defined for the text specified by the "name" parameter, this will prevent that text from being substituted in the page on which this macro is used.

This may be useful if, for example, a list of AUTOSUB macros is used on a topic being included on a page where the including topic does not want the substitution to be made.

0 comments on commit 3a5f5cf

Please sign in to comment.