Skip to content

Commit 883c93c

Browse files
author
James Brundage
committed
feat: MarkX.get_SiteType ( Fixes #93 )
Also aliasing to get_PageType
1 parent cfcd9b6 commit 883c93c

2 files changed

Lines changed: 40 additions & 0 deletions

File tree

‎Types/MarkX/Alias.psd1‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
'Markpub.at' = 'Markpub'
66
'At.Markpub' = 'Markpub'
77

8+
# Page type is akin to SiteType.
9+
PageType = 'SiteType'
10+
811
# Plurals
912
FindCodeblocks = 'FindCodeBlock'
1013
FindReferences = 'FindReference'

‎Types/MarkX/get_SiteType.ps1‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<#
2+
.SYNOPSIS
3+
Gets the Site Type
4+
.DESCRIPTION
5+
Gets the Site or Page Type.
6+
7+
Will scan any files in the site or page for what technology is being used.
8+
9+
Multiple site types will most likely be detected.
10+
#>
11+
param()
12+
13+
# This list will expand with time
14+
15+
@(switch -regex ($this.File.Name) {
16+
'\.css(?>\.|$)' { 'css'}
17+
'\.c(?>\.|$)' { 'c' }
18+
'\.cpp(?>\.|$)' { 'c++' }
19+
'\.rs(?>\.|$)' { 'rust' }
20+
'\.go(?>\.|$)' { 'go' }
21+
'\.html(?>\.|$)' { 'html '}
22+
'\.js(?>\.|$)' { 'javascript' }
23+
'\.json(?>\.|$)' { 'json' }
24+
'\.jsx(?>\.|$)' { 'jsx'}
25+
'\.md(?>\.|$)' { 'markdown'}
26+
'\.mdx(?>\.|$)' { 'mdx'}
27+
'\.ps[dm]?1$' { 'PowerShell' }
28+
'\.pl(?>\.|$)' { 'Perl'}
29+
'\.php(?>\.|$)' { 'PHP'}
30+
'\.ts(?>\.|$)' { 'typescript' }
31+
'^hugo\.' { 'hugo' }
32+
'astro' { 'astro'}
33+
'eleventy' { 'eleventy' }
34+
'jekyll' { 'jekyll' }
35+
'package\.json' { 'javascript' }
36+
'tsconfig' { 'typescript'}
37+
}) | Select-Object -Unique

0 commit comments

Comments
 (0)