Skip to content

Commit

Permalink
update paths to use #
Browse files Browse the repository at this point in the history
  • Loading branch information
sransara committed Jul 13, 2024
1 parent 891e229 commit f474de1
Show file tree
Hide file tree
Showing 21 changed files with 44 additions and 40 deletions.
6 changes: 3 additions & 3 deletions adocx/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import path from 'node:path';
// @ts-ignore: Types are not available
import { register as krokiPluginRegisterHandle } from 'asciidoctor-kroki';

import { register as inlineMacroCalloutRegisterHandle } from './extensions/inlineMacroCallout';
import { register as inlineMacroCalloutRegisterHandle } from '#/adocx/extensions/inlineMacroCallout';
import {
type AdocNodeConverters,
register as nodeConvertingConverterRegisterHandle,
} from './nodeConvertingConverter';
} from '#/adocx/nodeConvertingConverter';

const nodeConverters = Object.fromEntries(
Object.entries(import.meta.glob('./nodeConverters/*.ts', { eager: true, import: 'convert' })).map(
Expand Down Expand Up @@ -41,7 +41,7 @@ export const adocxConfig = {
},
astroLayouts: {
note: {
path: '@/src/layouts/adocNoteLayout/AdocNoteLayout.astro',
path: '#/src/layouts/adocNoteLayout/AdocNoteLayout.astro',
args: 'poster={poster} metadata={metadata}',
},
},
Expand Down
5 changes: 3 additions & 2 deletions adocx/nodeConverters/image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@

import { atag } from '@sransara/astro-adocx/utils/asx';
import type { Block, Inline } from 'asciidoctor';
import { type AdocNodeConverter } from '../nodeConvertingConverter';
import { convertImageNode } from './inline_image.js';

import { convertImageNode } from '#/adocx/nodeConverters/inline_image';
import { type AdocNodeConverter } from '#/adocx/nodeConvertingConverter';

export const convert: AdocNodeConverter<Block> = (node: Block, opts?: any) => {
const target = node.getAttribute('target');
Expand Down
3 changes: 2 additions & 1 deletion adocx/nodeConverters/inline_image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
import { addOnceToAstroFence } from '@sransara/astro-adocx/utils/astroFence';
import { Aexpr, aexpr, atag } from '@sransara/astro-adocx/utils/asx';
import type { Inline } from 'asciidoctor';
import { type AdocNodeConverter } from '../nodeConvertingConverter';

import { type AdocNodeConverter } from '#/adocx/nodeConvertingConverter';

export const convert: AdocNodeConverter<Inline> = (node: Inline, _opts?: any) => {
if (node.getType() === 'icon' && node.getDocument().getAttribute('icons') === 'font') {
Expand Down
5 changes: 3 additions & 2 deletions adocx/nodeConverters/inline_quoted.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { addOnceToAstroFence } from '@sransara/astro-adocx/utils/astroFence';
import type { Inline } from 'asciidoctor';
import { type AdocNodeConverter } from '../nodeConvertingConverter';

import { type AdocNodeConverter } from '#/adocx/nodeConvertingConverter';

export const convert: AdocNodeConverter<Inline> = (node: Inline, _opts?: any) => {
const nodeType = node.getType();
if (['asciimath', 'latexmath'].includes(nodeType)) {
addOnceToAstroFence(node, "import Mathtex from '@/src/lib/astro/mathtex/Mathtex.astro';");
addOnceToAstroFence(node, "import Mathtex from '#/src/lib/astro/mathtex/Mathtex.astro';");
return `<Mathtex block={false} lang="${nodeType}" is:raw={true}>${node.getText()}</Mathtex>`;
}
return null;
Expand Down
5 changes: 3 additions & 2 deletions adocx/nodeConverters/listing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
import { addOnceToAstroFence } from '@sransara/astro-adocx/utils/astroFence';
import { atag } from '@sransara/astro-adocx/utils/asx';
import type { Block } from 'asciidoctor';
import { type AdocNodeConverter } from '../nodeConvertingConverter';

import { type AdocNodeConverter } from '#/adocx/nodeConvertingConverter';

export const convert: AdocNodeConverter<Block> = (node: Block, _opts?: any) => {
const id = node.getId();
Expand All @@ -15,7 +16,7 @@ export const convert: AdocNodeConverter<Block> = (node: Block, _opts?: any) => {

addOnceToAstroFence(
node,
"import CodeListing from '@/src/lib/astro/codeListing/CodeListing.astro';",
"import CodeListing from '#/src/lib/astro/codeListing/CodeListing.astro';",
);
return atag('div', {
id,
Expand Down
4 changes: 2 additions & 2 deletions adocx/nodeConverters/stem.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
// Reference:
// - https://github.com/asciidoctor/asciidoctor-backends/blob/master/erb/html5/block_math.html.erb

import { type AdocNodeConverter } from '#/adocx/nodeConvertingConverter';
import { addOnceToAstroFence } from '@sransara/astro-adocx/utils/astroFence';
import { atag } from '@sransara/astro-adocx/utils/asx';
import type { Block } from 'asciidoctor';
import { type AdocNodeConverter } from '../nodeConvertingConverter';

export const convert: AdocNodeConverter<Block> = (node: Block, _opts?: any) => {
const id = node.getId();
const title = node.getCaptionedTitle();
const roles = node.getRoles().join(' ');
const content = node.getContent();
const style = node.getStyle();
addOnceToAstroFence(node, "import Mathtex from '@/src/lib/astro/mathtex/Mathtex.astro';");
addOnceToAstroFence(node, "import Mathtex from '#/src/lib/astro/mathtex/Mathtex.astro';");
return atag('div', {
id,
class: `mathblock ${roles}`,
Expand Down
6 changes: 3 additions & 3 deletions src/layouts/adocNoteLayout/AdocNoteLayout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
import type { ImageMetadata } from 'astro';
import type { Outline } from '@sransara/astro-adocx/utils/outline';
import type { Metadata } from '@/src/lib/types/notes';
import NoteLayout from '@/src/layouts/noteLayout/NoteLayout.astro';
import Asciidoc from '@/src/lib/astro/asciidoc/Asciidoc.astro';
import type { Metadata } from '#/src/lib/types/notes';
import NoteLayout from '#/src/layouts/noteLayout/NoteLayout.astro';
import Asciidoc from '#/src/lib/astro/asciidoc/Asciidoc.astro';
interface Props {
metadata: Metadata;
Expand Down
2 changes: 1 addition & 1 deletion src/layouts/baseLayout/BaseLayout.astro
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
import './base.css';
import siteValues from '@/site.values.js';
import siteValues from '#/site.values.js';
export interface Props {
title?: string;
Expand Down
8 changes: 4 additions & 4 deletions src/layouts/noteLayout/NoteLayout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
import { Image } from 'astro:assets';
import type { ImageMetadata } from 'astro';
import type { Outline } from '@sransara/astro-adocx/utils/outline';
import siteValues from '@/site.values.js';
import siteValues from '#/site.values.js';
import type { Metadata } from '@/src/lib/types/notes';
import BaseLayout from '@/src/layouts/baseLayout/BaseLayout.astro';
import NavBar from '@/src/lib/astro/navBar/NavBar.astro';
import type { Metadata } from '#/src/lib/types/notes';
import BaseLayout from '#/src/layouts/baseLayout/BaseLayout.astro';
import NavBar from '#/src/lib/astro/navBar/NavBar.astro';
interface Props {
metadata: Metadata;
Expand Down
2 changes: 1 addition & 1 deletion src/pages/_metas.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Metadata } from '@/src/lib/types/notes';
import type { Metadata } from '#/src/lib/types/notes';

type Metas = Record<string, { metadata: Metadata }>;
const metas = import.meta.glob('./**/_meta/metadata.ts', { eager: true }) as Metas;
Expand Down
4 changes: 2 additions & 2 deletions src/pages/about/index.astro
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
import BaseLayout from '@/src/layouts/baseLayout/BaseLayout.astro';
import NavBar from '@/src/lib/astro/navBar/NavBar.astro';
import BaseLayout from '#/src/layouts/baseLayout/BaseLayout.astro';
import NavBar from '#/src/lib/astro/navBar/NavBar.astro';
---

<style>
Expand Down
4 changes: 2 additions & 2 deletions src/pages/index.astro
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
import BaseLayout from '@/src/layouts/baseLayout/BaseLayout.astro';
import NavBar from '@/src/lib/astro/navBar/NavBar.astro';
import BaseLayout from '#/src/layouts/baseLayout/BaseLayout.astro';
import NavBar from '#/src/lib/astro/navBar/NavBar.astro';
---

<BaseLayout>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Metadata } from '@/src/lib/types/notes';
import type { Metadata } from '#/src/lib/types/notes';

export const metadata: Metadata = {
title: 'Build yourself a Git',
Expand Down
2 changes: 1 addition & 1 deletion src/pages/notes/2019/hello-world/_meta/metadata.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Metadata } from '@/src/lib/types/notes';
import type { Metadata } from '#/src/lib/types/notes';

export const metadata: Metadata = {
title: 'Hello world',
Expand Down
2 changes: 1 addition & 1 deletion src/pages/notes/2023/bazel-python-venv/_meta/metadata.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Metadata } from '@/src/lib/types/notes';
import type { Metadata } from '#/src/lib/types/notes';

export const metadata: Metadata = {
title: 'Quick guide: Bazel Python virtual environment',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Metadata } from '@/src/lib/types/notes';
import type { Metadata } from '#/src/lib/types/notes';

export const metadata: Metadata = {
title: 'Power to tail recursion',
Expand Down
6 changes: 3 additions & 3 deletions src/pages/notes/[year]/index.astro
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
import { format, parseISO } from 'date-fns';
import BaseLayout from '@/src/layouts/baseLayout/BaseLayout.astro';
import NavBar from '@/src/lib/astro/navBar/NavBar.astro';
import { routes } from '@/src/pages/_metas.ts';
import BaseLayout from '#/src/layouts/baseLayout/BaseLayout.astro';
import NavBar from '#/src/lib/astro/navBar/NavBar.astro';
import { routes } from '#/src/pages/_metas.ts';
export function getStaticPaths() {
let years = routes('/notes').reduce((result, { route }) => {
Expand Down
8 changes: 4 additions & 4 deletions src/pages/notes/index.astro
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
import { format, parseISO } from 'date-fns';
import BaseLayout from '@/src/layouts/baseLayout/BaseLayout.astro';
import NavBar from '@/src/lib/astro/navBar/NavBar.astro';
import { routes } from '@/src/pages/_metas.ts';
import { groupBy } from '@/src/lib/utils.ts';
import BaseLayout from '#/src/layouts/baseLayout/BaseLayout.astro';
import NavBar from '#/src/lib/astro/navBar/NavBar.astro';
import { routes } from '#/src/pages/_metas.ts';
import { groupBy } from '#/src/lib/utils.ts';
const notesGroupedByYear = groupBy(
routes('/notes'),
Expand Down
4 changes: 2 additions & 2 deletions src/pages/projects/index.astro
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
import BaseLayout from '@/src/layouts/baseLayout/BaseLayout.astro';
import NavBar from '@/src/lib/astro/navBar/NavBar.astro';
import BaseLayout from '#/src/layouts/baseLayout/BaseLayout.astro';
import NavBar from '#/src/lib/astro/navBar/NavBar.astro';
---

<BaseLayout title="Projects">
Expand Down
2 changes: 1 addition & 1 deletion src/pages/rss.xml.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import siteValues from '@/site.values.js';
import siteValues from '#/site.values.js';
import rss from '@astrojs/rss';
import type { APIRoute } from 'astro';
import { routes } from './_metas.ts';
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["./*"]
"#/*": ["./*"]
},
"checkJs": true,
"jsx": "preserve",
Expand Down

0 comments on commit f474de1

Please sign in to comment.