• nodepad代码格式复制到word发布到博客


    本文主要描述如何将notepad++中的语法着色代码复制到word,再通过word将这些代码按照原格式

    发布到博客园;

    1、首先使用notepad++打开源代码文件,这里使用lua文件做演示,以下是代码在notepad++中的截图:

    注意:代码的缩进请严格使用制表符,如上头中的,否则代码排版将会无缩进;

    2、将代码复制到word中:

    3、将代码粘贴到word中,显示:

    package.cpath = "luaclib/?.so"
    package.path = "lualib/?.lua;myexample/eg1/?.lua"

    if _VERSION ~= "Lua 5.3" then
        error "Use lua 5.3"    
    end

    local socket = require "client.socket"

    local fd = assert(socket.connect("127.0.0.1", 8888))

    socket.send(fd, "Hello world")
    while true do
        --
    接收服务器返回消息

        local str = socket.recv(fd)
        if str~=nil and str~="" then
                print("server says: "..str)
                -- socket.close(fd)
                -- break;
        end

        --
    读取用户输入消息
        local readstr = socket.readstdin()
        if readstr then
            if readstr == "quit" then
                socket.close(fd)
                break;
            else
                --
    把用户输入消息发送给服务器
                socket.send(fd, readstr)
            end
        else
            socket.usleep(100)
        end
    end
    过来的代码行底色是黄色,选中黄色底色的代码,点击word中的:

    将底色变为无色,显示如下:

    package.cpath = "luaclib/?.so"
    package.path = "lualib/?.lua;myexample/eg1/?.lua"

    if _VERSION ~= "Lua 5.3" then
        error "Use lua 5.3"    
    end

    local socket = require "client.socket"

    local fd = assert(socket.connect("127.0.0.1", 8888))

    socket.send(fd, "Hello world")
    while true do
        --
    接收服务器返回消息

        local str = socket.recv(fd)
        if str~=nil and str~="" then
                print("server says: "..str)
                -- socket.close(fd)
                -- break;
        end

        --
    读取用户输入消息
        local readstr = socket.readstdin()
        if readstr then
            if readstr == "quit" then
                socket.close(fd)
                break;
            else
                --
    把用户输入消息发送给服务器
                socket.send(fd, readstr)
            end
        else
            socket.usleep(100)
        end
    end
    然后将代码行末尾的替换为

    为了代码的一体性看起来舒适,给代码加上底纹:

    package.cpath = "luaclib/?.so"
    package.path = "lualib/?.lua;myexample/eg1/?.lua"

    if _VERSION ~= "Lua 5.3" then
        error "Use lua 5.3"    
    end

    local socket = require "client.socket"

    local fd = assert(socket.connect("127.0.0.1", 8888))

    socket.send(fd, "Hello world")
    while true do

        --
    接收服务器返回消息
        local str = socket.recv(fd)
        if str~=nil and str~="" then
                print("server says: "..str)
                -- socket.close(fd)
                -- break;
        end

        --
    读取用户输入消息
        local readstr = socket.readstdin()
        if readstr then
            if readstr == "quit" then
                socket.close(fd)
                break;
            else
                --
    把用户输入消息发送给服务器
                socket.send(fd, readstr)
            end
        else
            socket.usleep(100)
        end
    end


    然后发布到博客园中;

     

     

     

  • 相关阅读:
    Java 连oracle 12C 起步
    powershell excel 导入 sqlserver
    移动端适配方案(上)
    ie7兼容问题
    node学习第三天(2)
    node学习第三天(1)
    HTMl5的sessionStorage和localStorage的一些区别
    html5+css3实战之-幽灵按钮
    node.js理论知识梳理
    node.js学习第二天
  • 原文地址:https://www.cnblogs.com/skiing886/p/7695566.html
Copyright © 2020-2023  润新知